On 4 Jan 2005 08:08:05 -0800,
(ALuPin) wrote:
>Hi newsgroup users,
>
>I am trying to implement the following in my VHDL testbench:
>
>Within a process (without sensitivity list) I call a procedure "wait_delay".
>In the most test cases the signal 't_order_burst_data' gets high when
>the procedure is left again.
>But there are also some cases where it gets high while the loop
>in the procedure is busy. I want the procedure to abort then.
>But how can I make the signal 't_order_burst_data' visible for the procedure
>all the time ?
Write it in Verilog and use "disable"
Seriously... this is a common problem. The only solution I know of
is to do a simultaneous wait for all the things that could possibly
affect the waiting. VHDL's "wait on" (dynamic sensitivity list)
makes this easy, but processing the signal changes can be a little
messy.
>procedure wait_delay ( signal clock : std_logic;
> signal order_burst_data_in : std_logic) is
>variable i : natural;
>begin
> for i in 0 to 4 loop
> exit when order_burst_data_in='1';
> wait until rising_edge(clock);
> end loop;
>end wait_delay;
In this case you have only one "wait" so it's quite easy to fix:
OuterLoop: for i in 0 to 4 loop
while not rising_edge(clock) loop
wait on clock, order_burst_data;
exit OuterLoop when order_burst_data_in='1';
end loop;
end loop; -- OuterLoop
Or perhaps you prefer this version:
for i in 0 to 4 loop
wait until (order_burst_data = '1') or rising_edge(clock);
exit when order_burst_data_in='1';
end loop;
Personally I find the first version easier to think about
and to maintain, but it's only a matter of choice.
In general it's a smart move to ensure that processes of this kind
have only one "wait" in them, centralising the waiting so that you
can be sure not to miss anything. This kind of trick works nicely
for resets, interrupts, aborts and similar asynchronous stuff.
--
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:
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.