easier assignment of the vector in testbench

Joined
Jan 11, 2010
Messages
1
Reaction score
0
Hi,
I have a small question. In my VHDL code i have a 32 bit std_logic_vector.
ex: data_in: in std_logic_vector (31 downto 0);

suppose in my test bench i need to assign some value to it. i need to type for all 32 bits.


ex: data_in <= "00000000000000000000000000000000"

i was wondering if there is other easier method, with which i can assign say first 5 bits differently and assign all the others bits by '0' or '1'.

thanks in advance :)

Milind
 
Joined
Jan 15, 2010
Messages
1
Reaction score
0
Hi,
A statement like this is an option
data <= (0 => '1', 1 => '1', 2 => '1', 4 => '1', 8 => '1', others => '0');
You can assign specific bits in a vector and set the others to a default.

With a 32b val, you might want to assign this way:
data <= X"0000_0000";
which is clean and compact, using the hex designator (X).

regards, Jerry
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top