Running for loop and stopping it in VHDL

Status
Not open for further replies.

info_req

Member level 5
Joined
Jun 20, 2007
Messages
81
Helped
6
Reputation
12
Reaction score
4
Trophy points
1,288
Location
Pakistan
Activity points
1,764
Heloo dear,
I want to make cumulative histogram in VHDL. I am using for loop with wait ststement. It runs for ever. I need to run this for loop only once and then stop. Can any one tell me how it is possible.

Thanks
 

for loop

u have to put the for loop in an always block or a initial block according to verilog syntax which runs forever. so put a variable in the loop and check it before entering the loop.
this should work.
ex.
var=0;
if(var ==0)
begin
for()
var=1
end
end
regards
 

Re: for loop

1. If you are doing a design, and are using a 'wait' statement in it. Its not going to synthesize.
2. Anyway... here is how u exit a vhdl loop.
use 'exit' thats it.

example:

process blah_blah:
variable index_var : integer ;
begin
index_var := 0;
for i in 0 to 10 loop
index_var := index_var+1;
-- do your loop things here
if(index_var = 1) then
exit;
end if;
end loop;
end process bhah_blah;
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…