-- Copyright © 1993 by McGraw-Hill, Inc. and Zainalabedin Navabi
-- FIGURE 5.1
-- ENTITY DECLARATION OF BIT COMPARATOR :
ENTITY bit_comparator IS
PORT (a, b, -- data inputs
gt, -- previous greater than
eq, -- previous equal
lt : IN BIT; -- previous less than
a_gt_b, -- greater
a_eq_b, -- equal
a_lt_b : OUT BIT); -- less than
END bit_comparator;
--
-- FUNCTIONAL ARCHITECTURE OF BIT COMPARATOR :
ARCHITECTURE functional OF bit_comparator IS
FUNCTION fgl (w, x, gl : BIT) RETURN BIT IS
BEGIN
RETURN (w AND gl) OR (NOT x AND gl) OR (w AND NOT x);
END fgl;
FUNCTION feq (w, x, eq : BIT) RETURN BIT IS
BEGIN
RETURN (w AND x AND eq) OR (NOT w AND NOT x AND eq);
END feq;
BEGIN
a_gt_b <= fgl (a, b, gt) AFTER 12 NS;
a_eq_b <= feq (a, b, eq) AFTER 12 NS;
a_lt_b <= fgl (b, a, lt) AFTER 12 NS;
END functional;
--