Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Using loop vars in a testbench

 
Thread Tools Search this Thread
Old 02-16-2004, 07:46 PM   #1
Default Using loop vars in a testbench


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.


sku11monkey
  Reply With Quote
Old 02-16-2004, 08:43 PM   #2
Egbert Molenkamp
 
Posts: n/a
Default Re: Using loop vars in a testbench
http://www.vhdl.org/vi/comp.lang.vhdl/FAQ1.html#4.8.1
Will answer all your question.

Egbert Molenkamp

"sku11monkey" <> schreef in bericht
news:YrKdnRZcXYOVg6zdRVn-...
> 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.





Egbert Molenkamp
  Reply With Quote
Old 02-18-2004, 07:24 AM   #3
Grigorios Angelis
 
Posts: n/a
Default Re: Using loop vars in a testbench
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;


Grigorios Angelis
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
loop according to the delay kavidream24 Software 0 12-23-2008 02:18 AM
Xilinx 7.1 and testbench error boitsas Software 0 01-15-2008 04:14 PM
Catalyst 2960 loop problem...Help me some one plz dorjko Hardware 1 12-13-2007 06:10 AM
Phase locked loop VHDL code mreddy.a Hardware 0 09-16-2007 09:43 AM
Keeping in the loop DavidRivers@vnet.net DVD Video 0 02-13-2006 05:02 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46