undeclared loop variable

B

Brad Smallridge

It seems that I can drop this into a testbench without
declaring col as a signal or a variable or anything.
What is vhdl doing with col?

for col in 1 to 16 loop
wait for clkperiod;
end loop;
 
K

Kai Harrekilde-Petersen

Brad Smallridge said:
It seems that I can drop this into a testbench without
declaring col as a signal or a variable or anything.
What is vhdl doing with col?

VHDL considers the iteration variable to be constant for each pass
through the loop.

Regards,


Kai
 
M

My Name

Brad said:
It seems that I can drop this into a testbench without
declaring col as a signal or a variable or anything.
What is vhdl doing with col?

for col in 1 to 16 loop
wait for clkperiod;
end loop;


the only potential draw back that I see to this type of a construct is
that you can't reference "col" anywhere outside of the loop
 
N

Neo

The looping index is considered an implicit variable in vhdl and is
local to the for loop.
 
A

Alan Fitch

Neo said:
The looping index is considered an implicit variable in vhdl and is
local to the for loop.

In fact as Kai pointed out, the loop index is a constant.

All that means in practice is that you can't, for instance, do

col := 10;

inside the loop.

regards
Alan
 
P

Paul Uiterlinden

My said:
the only potential draw back that I see to this type of a construct is
that you can't reference "col" anywhere outside of the loop

I don't see that as a drawback. What value would you expect "col" to
have outside the loop anyway?

Paul.
 
J

Jonathan Bromley

[VHDL 'for' loop index is an implied constant within the loop...]
the only potential draw back that I see to this type of a construct is
that you can't reference "col" anywhere outside of the loop

Can you show me an example of this kind of thing that I could
read and yet still retain my lunch?
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:[email protected]
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

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

Similar Threads

I Need Fix In Code 1
Uhhhhh, What can I do next? 6
Help with Loop 0
Vhdl Test Bench 0
exit if item >10 9
Another Password Confirmation 2
pls help me ; vhdl; 0
While loop unclear, can someone help? 4

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top