VHDL Programming

(C. Jardin) #1

Predefined Attributes 163


If the optional time expression for attribute ’DELAYEDis not specified,
0 ns is assumed. A signal delayed by 0 ns is delayed by one delta. (Delta
delay is discussed in Chapter 2.)
Another application for the ’DELAYEDattribute is to perform a hold-check.
Earlier in this chapter, we discussed what setup and hold times were and
how to implement the setup check using ’LAST_EVENT. Implementing the
hold-check requires the use of a delayed version of the clksignal. The
example shown earlier has been modified to include the hold-check function
as shown here:

LIBRARY IEEE;

USE IEEE.std_logic_1164.ALL;
ENTITY dff IS
GENERIC ( setup_time, hold_time : TIME );
PORT( d, clk : IN std_logic;
PORT( q : OUT std_logic);
BEGIN
setup_check : PROCESS ( clk )
BEGIN
IF ( clk = ’ 1 ’ ) and ( clk’EVENT ) THEN
ASSERT ( d’LAST_EVENT >= setup_time )
REPORT “setup violation”
SEVERITY ERROR;
END IF;
END PROCESS setup_check;

hold_check : PROCESS (clk’DELAYED(hold_time))
BEGIN
IF ( clk’DELAYED(hold_time) = ’ 1 ’ ) and
( clk’DELAYED(hold_time)’EVENT ) THEN

ASSERT ( d’LAST_EVENT = 0 ns ) OR ( d’LAST_EVENT >
hold_time )
REPORT “hold violation”
SEVERITY ERROR;

END IF;
END PROCESS hold_check;
END dff;

ARCHITECTURE dff_behave OF dff IS
BEGIN
dff_process : PROCESS ( clk )
BEGIN
IF ( clk = ’ 1 ’ ) AND ( clk’EVENT ) THEN
q <= d;
END IF;

END PROCESS dff_process;
END dff_behave;
Free download pdf