04-19-2021 01:58 AM - edited 04-19-2021 03:40 AM
I have a problem with an initialisation of an array.
- main process
architecture Behavioral of fir is type h_array is array (integer range 0 to 31) of std_logic_vector (9 downto 0); signal coeff_int : h_array := (others => (others => '0')); ... if rising_edge(MainClk) then ... coeff_int <= coeff_int(conv_integer(coeff_input))((bits - 1) downto 0); -- error line ... --> write a h_array to coeff_input_address in the h_array if coeff_write = '1' then coeff_int (conv_integer(coeff_input_address)) <= coeff_input; end if;
***Error:*** Indexed name is not a h_array
Can anyone help me to fix this error?
My corrections in the File:
- I have fixed an error in the beginning ( "port description"
coeff_write: in std_logic;
04-19-2021 02:29 AM
try to use to_integer() instead of conv_integer()
Consider giving "Kudos" if you like my answer. Please mark my post "Accept as solution" if my answer has solved your problem
Asking for solutions to problems via PM will be ignored.
04-19-2021 02:42 AM
Please post the whole code and the actual error.
It appears you are trying to assign a slice from a single std_logic_vector back to the entire array. Maybe you have a typo? We cant see without the real code?
04-19-2021 03:50 AM
The problem as as I specified before - this line:
coeff_int <= coeff_int(to_integer(signed(coeff_input)))((bits - 1) downto 0); -- signed(coeff_input)
coeff_int is an array, and oeff_int(to_integer(signed(coeff_input)))((bits - 1) downto 0) is a single std_logic_vector
You cannot assigned a single std_logic_vector to a signal of type h_array. This would be clear from the error.
04-19-2021 04:08 AM
originally I used
coeff_int <= coeff_int(conv_integer(coeff_input))((bits - 1) downto 0);
This code was given as example.
coeff_int should be used later to take a product (" multiplier"). I was thinking to define a new variable as
coeff_int_new <= coeff_int(conv_integer(coeff_input))((bits - 1) downto 0);
Then it should be defined and it is not what I want