library ieee;
use ieee.std_logic_1164.all;
Entity comparator is
port(A0,B0,A1,B1,A2,B2,A3,B3,I0,I1,I2:in std_logic;y0,y1,y2:out std_logic);
end comparator;
architecture arch_comparator of comparator is
signal c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,ta,tb,tc,td:std_logic;
component nand_gate
port(a,b:in std_logic; c: out std_logic);
end component;
component and_gate
port(a,b:in std_logic; c: out std_logic);
end component;
component nor_gate
port(a,b:in std_logic; c: out std_logic);
end component;
component fouripand_gate
port(a,b,c,d:in std_logic; e:out std_logic);
end component;
component fiveand_gate
port(a,b,c,d,e:in std_logic; f:out std_logic);
end component;
component sixnorgate
port(a,b,c,d,e,f:in std_logic; g:out std_logic);
end component;
component threeipand_gate
port(a,b,c :in std_logic;d:out std_logic);
end component;
begin
l1: nand_gate port map(A3,B3,c);
l2: nand_gate port map(A2,B2,s);
l3: nand_gate port map(A1,B1,w);
l4: nand_gate port map(A0,B0,ta);
l5: and_gate port map(A3,c,d);
l6: and_gate port map(c,B3,e);
l7: and_gate port map(A2,s,t);
l8: and_gate port map(s,B2,u);
l9: and_gate port map(A1,w,x);
l10: and_gate port map(w,B1,y);
l11: and_gate port map(A0,ta,tb);
l12: and_gate port map(ta,B0,tc);
l13: and_gate port map(B3,c,g);
l14: and_gate port map(c,A3,r);
l15: nor_gate port map(d,e,f);
l16: nor_gate port map(t,u,v);
l17: nor_gate port map(x,y,z);
l18: nor_gate port map(tb,tc,td);
l19: threeipand_gate port map(B2,s,f,h);
l20: threeipand_gate port map(s,A2,f,q);
l21: fouripand_gate port map(B1,w,f,v,i);
l22: fouripand_gate port map(f,v,w,A1,p);
l23: fiveand_gate port map(f,v,z,td,I0,k);
l24: fiveand_gate port map(f,v,z,td,I1,l);
l25: fiveand_gate port map(f,v,z,td,I1,y1);
l26: fiveand_gate port map(f,v,z,td,I1,m);
l27: fiveand_gate port map(f,v,z,td,I2,n);
l28: fiveand_gate port map(f,v,z,ta,A0,o);
l29: fiveand_gate port map(f,v,z,ta,B0,j);
l30: sixnorgate port map(g,h,i,j,k,l,y0);
l31: sixnorgate port map(m,n,o,p,q,r,y2);
end arch_comparator;