cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
asai9493
Explorer
Explorer
360 Views
Registered: ‎12-10-2020

Use " array" in VHDL

I have a problem with an initialisation of an array.

**Simualtion**

- 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;

 

 

 

0 Kudos
6 Replies
dpaul24
Scholar
Scholar
352 Views
Registered: ‎08-07-2014

@asai9493 ,

try to use to_integer() instead of conv_integer()

------------FPGA enthusiast------------
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.

0 Kudos
richardhead
Scholar
Scholar
341 Views
Registered: ‎08-01-2012

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?

 

0 Kudos
asai9493
Explorer
Explorer
314 Views
Registered: ‎12-10-2020

@richardhead I have added

 

0 Kudos
richardhead
Scholar
Scholar
302 Views
Registered: ‎08-01-2012

@asai9493 

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.

0 Kudos
asai9493
Explorer
Explorer
284 Views
Registered: ‎12-10-2020

@richardhead 

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

0 Kudos
varunra
Xilinx Employee
Xilinx Employee
255 Views
Registered: ‎01-24-2017

Hi,

Try indexing the array. coeff_int(<variable>)

0 Kudos