VHDL Programming

(C. Jardin) #1
BEGIN

RETURN (s’EVENT AND (To_X01(s) = ‘ 1 ’) AND
(To_X01(s’LAST_VALUE) = ‘ 0 ’));
END;

FUNCTION falling_edge (SIGNAL s : std_ulogic) RETURN
BOOLEAN IS
BEGIN
RETURN (s’EVENT AND (To_X01(s) = ‘ 0 ’) AND
(To_X01(s’LAST_VALUE) = ‘ 1 ’));
END;

--------------------------------------------------------
-- object contains an unknown
--------------------------------------------------------
FUNCTION Is_X ( s : std_ulogic_vector ) RETURN BOOLEAN
IS
BEGIN
FOR i IN s’RANGE LOOP
CASE s(i) IS
WHEN ‘U’ | ‘X’ | ‘Z’ | ‘W’ | ‘-’ => RETURN
TRUE;
WHEN OTHERS => NULL;
END CASE;
END LOOP;
RETURN FALSE;
END;
-------------------------------------------------------
FUNCTION Is_X ( s : std_logic_vector ) RETURN BOOLEAN
IS
BEGIN
FOR i IN s’RANGE LOOP
CASE s(i) IS
WHEN ‘U’ | ‘X’ | ‘Z’ | ‘W’ | ‘-’ => RETURN
TRUE;
WHEN OTHERS => NULL;
END CASE;
END LOOP;
RETURN FALSE;
END;
------------------------------------------------------------
FUNCTION Is_X ( s : std_ulogic ) RETURN BOOLEAN
IS
BEGIN
CASE s IS
WHEN ‘U’ | ‘X’ | ‘Z’ | ‘W’ | ‘-’ => RETURN
TRUE;
WHEN OTHERS => NULL;
END CASE;
RETURN FALSE;
END;

END std_logic_1164;

Appendix A: Standard Logic Package 433

Free download pdf