B
Barry
Guest
Is there a more clever and compact way to do this, rather than writing
a function? The constant INIT_40_VAL is assigned to a generic in a
component instantiation later on.
TIA
entity v5_sysmon is
generic ( SIM_ONLY : integer := 0 ); -- = 1 to set averaging to 1
instead of 16
......
architecture rtl of v5_sysmon is
function set_init_40(sim_only : in integer) return bit_vector is
constant init_40_avg1 : bit_vector := X"0000";
constant init_40_avg16 : bit_vector := X"1000";
begin
if sim_only = 1 then
return init_40_avg1;
else
return init_40_avg16;
end if;
end function set_init_40;
constant INIT_40_VAL : bit_vector := set_init_40(SIM_ONLY);
a function? The constant INIT_40_VAL is assigned to a generic in a
component instantiation later on.
TIA
entity v5_sysmon is
generic ( SIM_ONLY : integer := 0 ); -- = 1 to set averaging to 1
instead of 16
......
architecture rtl of v5_sysmon is
function set_init_40(sim_only : in integer) return bit_vector is
constant init_40_avg1 : bit_vector := X"0000";
constant init_40_avg16 : bit_vector := X"1000";
begin
if sim_only = 1 then
return init_40_avg1;
else
return init_40_avg16;
end if;
end function set_init_40;
constant INIT_40_VAL : bit_vector := set_init_40(SIM_ONLY);