Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > easier assignment of the vector in testbench

Reply
Thread Tools

easier assignment of the vector in testbench

 
 
milindas milindas is offline
Junior Member
Join Date: Jan 2010
Posts: 1
 
      01-11-2010
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
 
Reply With Quote
 
 
 
 
jerryo jerryo is offline
Junior Member
Join Date: Jan 2010
Posts: 1
 
      01-16-2010
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
const vector<A> vs vector<const A> vs const vector<const A> Javier C++ 2 09-04-2007 08:46 PM
Initializing vector<vector<int> > and other vector questions... pmatos C++ 6 04-26-2007 05:39 PM
Free memory allocate by a STL vector, vector of vector, map of vector Allerdyce.John@gmail.com C++ 8 02-18-2006 12:48 AM
how the vector is created, how to pass vector to webservices method apachesoap:Vector Rushikesh Joshi Perl Misc 0 07-10-2004 01:04 PM
why vector assignment operator not invoked on const vector& ? zhou C++ 9 09-02-2003 08:19 PM



Advertisments