I am designing a simple LFSR with a variable polynomial for a randomizer. The lfsr length is being defined as a generic. I need to initialize the starting value constant as something other than zeros/ones. I've found the answer to this before, but I can't seem to find the answer again. Here is what I'm trying to do:
entity GaloisLfsr is
generic
(
g_LFSR_LENGTH : integer := 5
);
...
end entity GaloisLfsr;
architecture zGaloisLfsr of GaloisLfsr is
constant c_INITIAL : std_logic_vector((g_LFSR_LENGTH - 1) downto 0) := ((others => '0'), '1');
What is the proper syntax for defining a constant with varying size to something that a pure '(others => '0')' can't capture?
Assuming one would like to initialize the 5-bit constant c_INITIAL
to "00001"
, then the declaration of the constant would be:
constant c_INITIAL : std_logic_vector((g_LFSR_LENGTH - 1) downto 1) := ((others => '0'), 0 => '1');