Signal assignment inside for loop

Joined
Jun 14, 2009
Messages
4
Reaction score
0
Hello all,
I'm new to VHDL and having a problem.

I know that signal assignment does not take effect until the end of the process unlike the variable assignment.
ie cnt <= cnt +1;
out <= cnt;
If cnt is a signal then out will have the value of cnt before adding 1.

My problem is I want to have same kind of signal assignment inside a for loop
ie for i 0 to 2 loop
cnt <= cnt +1;
end loop;

cnt is a signal, how can i do that and have the right cnt value?

Thanks.
 
Joined
Jun 2, 2009
Messages
23
Reaction score
1
for i 0 to 2 loop
cnt <= cnt +1;
end loop;

The above is ok if you declare 'cnt' as a variable. Is it necessary to declare it as a signal ?

Later when ur looping is complete you can saaign the variable 'cnt' to a signal or an output port.
 

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,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top