Using loop vars in a testbench

S

sku11monkey

Is it possible to assign the value of a loop variable to a
std_logic_vector? I'm trying to make the following code work:

--A : in std_logic_vector(7 downto 0);

for i in 0 to 15 loop
A <= --gets value of i
wait for 20 ns;
loop;


Does anyone know the library and type conversion function that I can use to
assign the loop variable (which I think is of type integer) to A, which is
type std_logic_vector, width=8?

Thanks.
 
G

Grigorios Angelis

i) Your declaration (A: in std_logic_vector(7 downto 0);) implies that A is
an input port to the entity (?)
You cannot assign to input ports.

ii) Assuming the above is just a typing error the following code seems to
compile fine for me:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top