J
jjohnson
I need to have generics in lower-level designs that are *conditionally*
assigned based on generics in the top level. Can I do this without a
configuration? If not, how is it done with configurations? The more I
work on it, the more confused I get...
Overview:
Top declares generics A,B,C,D, which are
passed down to instantiated components.
A is given a default value, which can be overridden.
B,C,D need to get whatever A turns out to be as their
default value, but get values from command line if specified.
ModelSim complains (error vcom-1137) that A is not visible when it
tries to set B,C,D := A.
Details follow below
Thanks in advance...
jmj
Details: I have an A/D converter behavioral model that reads samples
from a file:
entity adc_model is
generic(
inp_file := "adc_in.dat"; -- default name to test adc by itself
) -- Name can be overridden on command
line
port(
....
)
end entity adc_model;
Top-level testbench instantiates 3 adc_models: adc1, adc2, adc3.
In one case, I want all 3 models to read input from the same file.
In one case, I want all 3 models to read input from different files.
In last case, I want some to read default file, others to read unique
files, all controlled via the ModelSim command line.
Logic I'm trying to implement is:
entity top_level_tb is
generic(
common_input_file := common.dat;
adc1_infile := common_input_file; -- lower names based on first
generic
adc2_infile := common_input_file;
adc3_infile := common_input_file;
)
end entity top-level_tb;
architecture
begin
-- For each instance, if an individual filename was given on vsim
-- command line, use it; otherwise, use common file; e.g.,
-- vsim -g common_input_file=FOO.DAT -g adc3_infile=BAR.DAT
-- (adc1 and adc2 read from FOO, adc3 reads from BAR)
adc1: adc_model
generic map (
inp_file => adc1_infile
)
adc2: adc_model
generic map (
inp_file => adc2_infile
)
adc3: adc_model
generic map (
inp_file => adc3_infile
)
end architecture;
assigned based on generics in the top level. Can I do this without a
configuration? If not, how is it done with configurations? The more I
work on it, the more confused I get...
Overview:
Top declares generics A,B,C,D, which are
passed down to instantiated components.
A is given a default value, which can be overridden.
B,C,D need to get whatever A turns out to be as their
default value, but get values from command line if specified.
ModelSim complains (error vcom-1137) that A is not visible when it
tries to set B,C,D := A.
Details follow below
Thanks in advance...
jmj
Details: I have an A/D converter behavioral model that reads samples
from a file:
entity adc_model is
generic(
inp_file := "adc_in.dat"; -- default name to test adc by itself
) -- Name can be overridden on command
line
port(
....
)
end entity adc_model;
Top-level testbench instantiates 3 adc_models: adc1, adc2, adc3.
In one case, I want all 3 models to read input from the same file.
In one case, I want all 3 models to read input from different files.
In last case, I want some to read default file, others to read unique
files, all controlled via the ModelSim command line.
Logic I'm trying to implement is:
entity top_level_tb is
generic(
common_input_file := common.dat;
adc1_infile := common_input_file; -- lower names based on first
generic
adc2_infile := common_input_file;
adc3_infile := common_input_file;
)
end entity top-level_tb;
architecture
begin
-- For each instance, if an individual filename was given on vsim
-- command line, use it; otherwise, use common file; e.g.,
-- vsim -g common_input_file=FOO.DAT -g adc3_infile=BAR.DAT
-- (adc1 and adc2 read from FOO, adc3 reads from BAR)
adc1: adc_model
generic map (
inp_file => adc1_infile
)
adc2: adc_model
generic map (
inp_file => adc2_infile
)
adc3: adc_model
generic map (
inp_file => adc3_infile
)
end architecture;