Loop exit

N

Niv

Guest
Q. Is there any way to exit a loop immediately, without waiting for the
loop statements to execute.

e.g. Loop has a long wait statement, but if an event external to loop
happens, I want to quit loop immediately.

TIA, Niv.
 
Niv wrote:
Q. Is there any way to exit a loop immediately, without waiting for the
loop statements to execute.
exit my_loop when hurryup_bool;


-- Mike Treseler
 
"Mike Treseler" <mike.treseler@flukenetworks.com> wrote in message
news:401049C3.40300@flukenetworks.com...
Niv wrote:
Q. Is there any way to exit a loop immediately, without waiting
for the
loop statements to execute.

exit my_loop when hurryup_bool;


-- Mike Treseler
In Niv's original post he said "loop has a long wait statement". If
the
thing you are waiting for is a signal, you could do this...

my_loop: for I ....

wait for 100 ms until Sig = '1';
if Sig'event then
exit my_loop;
end if;
-- rest of loop

end loop;

This only works if Sig is a signal, not a variable.

Actually following your example Mike, I suppose you could say

my_loop: for I ....

wait for 100 ms until Sig = '1';
exit my_loop when Sig'EVENT;
-- rest of loop
end loop;

at the risk of achieving C programmer levels of cryptic code :)

Alan

--
Alan Fitch
Consultant

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

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24
1AW, UK
Tel: +44 (0)1425 471223 mail:
alan.fitch@doulos.com
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.
 
"Alan Fitch" <alan.fitch@doulos.com> wrote in message
news:buqrn1$qrb$1$8300dec7@news.demon.co.uk...

wait for 100 ms until Sig = '1';
...
at the risk of achieving C programmer levels of cryptic code :)
The first statement is also cryptic for VHDL :)
The correct order is:
wait until Sig = '1' for 100 ms ;

Egbert Molenkamp
 
"Egbert Molenkamp" <molenkam_remove_spam@cs.utwente.nl> wrote in
message news:bur2vf$l6p$1@ares.cs.utwente.nl...
"Alan Fitch" <alan.fitch@doulos.com> wrote in message
news:buqrn1$qrb$1$8300dec7@news.demon.co.uk...

wait for 100 ms until Sig = '1';
..
at the risk of achieving C programmer levels of cryptic code :)

The first statement is also cryptic for VHDL :)
The correct order is:
wait until Sig = '1' for 100 ms ;

Egbert Molenkamp
Oops, thanks Egbert - I think I shall rely on the rather feeble
excuse that I am only human :)

Alan

--
Alan Fitch
Consultant

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

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24
1AW, UK
Tel: +44 (0)1425 471223 mail:
alan.fitch@doulos.com
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.
 

Welcome to EDABoard.com

Sponsor

Back
Top