alessandro basili said:
In my procedure there is a loop like the following:
...
signal Timeout: BOOLEAN;
signal All_Done: BOOLEAN;
....
All_Done <= FALSE;
for i in data_buf'length - 1 downto 0 loop
if not(Timeout) then
wait until rising_edge (clock) or Timeout; -- KJ added
Timeout
end if;
if not(Timeout) then
clkdouble := not clkdouble;
data_int := data_buf (i);
strobe <= data_int xor clkdouble;
data <= data_int;
end if;
end loop; -- i
All_Done <= not(Timeout);
-- KJ added process
process
constant Timeout_Period: time := 1 us; -- Or whatever timeout
you want; Could also be a variable if you want.
begin
Timeout <= FALSE;
wait until whatever event it is that will cause you to want to start the
timeout timing;
Timeout <= TRUE after Timeout_Period;
wait until Timeout'event or All_Done'event;
Timeout <= not(All_Done); -- Cancels the above assignment to Timeout
which might still be pending;
end process;
and clock is a signal that my DUT will provide to this procedure in order
to have data and strobe signals out.
If I simply stop the clock they procedure will hang "waiting" the next
clock to come, while I need a way to exit out of it and starting again if
the clock stops for too long.
My system has this DUT which is connected to a peripheral which has an
analog reset on board that occurs if the clock stops. So my attempt is to
test my DUT with a testbench which will reproduce the behaviour of my
peripheral, is not hardware (as Mike said).
Any suggestions?
thanks
See above changes to your code which adds in looking for a new signal called
'Timeout' which will end up getting you out of your procedure. Timeout is
generated in a separate process that I've sketched out. The basic idea is I
think what you're trying to accomplish, the signal 'All_Done' is meant to
signal successful completion of the procedure and 'Timeout' to signal when
the procedure took too long. 'All_Done' gets set inside your existing
process and 'Timeout' in the new process and the two processes cooperate via
these signals to figure out if things are working or not.
KJ