图1 8位比较器的逻辑电路图
【例1-9】 8位比较器的结构化描述法
LIBRARY IEEE;
USE IEEE std_logic_1164.ALL;
ENTITY comparator IS
PORT (a,b: in std_logic_vector(7 downto 0);
g:out std_logic);
END comparator;
USE work.gatespkg.ALL
ARCHITECTURE structural OF comparator IS
signal x: std_logic(0 TO 7);
BEGIN
u0:xnor2 PORT MAP (a(0),b(0),x(0));
u1:xnor2 PORT MAP (a(1),b(1),x(1));
u2:xnor2 PORT MAP (a(2),b(2),x(2));
u3:xnor2 PORT MAP (a(3),b(3),x(3));
u4:xnor2 PORT MAP (a(4),b(4),x(4));
u5:xnor2 PORT MAP (a(5),b(5),x(5));
u6:xnor2 PORT MAP (a(6),b(6),x(6));
u7:xnor2 PORT MAP (a(7),b(7),x(7));
u8:xnor2 PORT MAP (x(0),x(1),x(2),x(3),x(4),x(5),x(6),x(7),
x(8),g);
END structural;