164 Chapter Six
A delayed version of the clkinput is used to trigger the hold-check. The
clkinput is delayed by the amount of the hold-check. If the data input
changes within the hold time,d’LAST_EVENTreturns a value that is less
than the hold time. When dchanges exactly at the same time as the
delayed clkinput,d’LAST_EVENTreturns 0 ns. This is a special case and
is legal so it must be handled specially.
An alternative method for checking the hold time of a device is to trigger
the hold-check process when the dinput changes and then look back at the
last change on the clkinput. However, this is more complicated and
requires the designer to manually keep track of the last reference edge
on the clkinput.
Another interesting feature of attributes that this model pointed out is
the cascading of attributes. In the preceding example, the delayed version
of the clksignal was checked for an event. This necessitated the use of
clk’DELAYED (hold_time)’EVENT. The return value from this attribute
is true whenever the signal created by the ’DELAYEDattribute has an
event during the current delta time point. In general, attributes can be
cascaded any level if the values returned from the previous attribute are
appropriate for the next attribute.
Attribute ’STABLE
Attribute ’STABLEis used to determine the relative activity level of a
signal. It can be used to determine if the signal just changed or has not
changed in a specified period of time. The resulting value output is itself
a signal that can be used to trigger other processes.
Following is an example of how attribute ’STABLEworks:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
ENTITY pulse_gen IS
PORT( a : IN std_logic;
PORT( b : OUT BOOLEAN);
END pulse_gen;
ARCHITECTURE pulse_gen OF pulse_gen IS
BEGIN
b <= a’STABLE( 10 ns );
END pulse_gen;
Figure 6-3 shows the resulting waveform bwhen waveform ais pre-
sented to the model.