------------------------------------------------------------------------
-- IAY0105 - Digitaalsüsteemid. Kodutöö #1.
-- Loogikaelemendid.
------------------------------------------------------------------------
-- (C) Peeter Ellervee - 2007 - Tallinn
------------------------------------------------------------------------

-- NOT - 1.5/1.5
entity inv is
  port (a: in bit; o: out bit);
end inv;
architecture str of inv is begin
  o <= not a after 1500 ps;
end str;

-- 2-AND - 2.0/2.0
entity and2 is
  port (a, b: in bit; o: out bit);
end and2;
architecture str of and2 is begin
  o <= (a and b) after 2000 ps;
end str;

-- 3-AND - 2.5/2.5
entity and3 is
  port (a, b, c: in bit; o: out bit);
end and3;
architecture str of and3 is begin
  o <= (a and b and c) after 2500 ps;
end str;

-- 2-NAND - 1.0/1.0
entity nand2 is
  port (a, b: in bit; o: out bit);
end nand2;
architecture str of nand2 is begin
  o <= not (a and b) after 1000 ps;
end str;

-- 3-NAND - 1.5/1.5
entity nand3 is
  port (a, b, c: in bit; o: out bit);
end nand3;
architecture str of nand3 is begin
  o <= not (a and b and c) after 1500 ps;
end str;

-- 2-OR - 2.0/2.0
entity or2 is
  port (a, b: in bit; o: out bit);
end or2;
architecture str of or2 is begin
  o <= (a or b) after 2000 ps;
end str;

-- 3-OR - 2.5/2.5
entity or3 is
  port (a, b, c: in bit; o: out bit);
end or3;
architecture str of or3 is begin
  o <= (a or b or c) after 2500 ps;
end str;

-- 2-NOR - 1.5/1.5
entity nor2 is
  port (a, b: in bit; o: out bit);
end nor2;
architecture str of nor2 is begin
  o <= not (a or b) after 1500 ps;
end str;

-- 3-NOR - 2.0/2.0
entity nor3 is
  port (a, b, c: in bit; o: out bit);
end nor3;
architecture str of nor3 is begin
  o <= not (a or b or c) after 2000 ps;
end str;

-- 2-XOR - 2.0/2.0
entity xor2 is
  port (a, b: in bit; o: out bit);
end xor2;
architecture str of xor2 is begin
  o <= (a xor b) after 2000 ps;
end str;

-- 3-XOR - 2.5/2.5
entity xor3 is
  port (a, b, c: in bit; o: out bit);
end xor3;
architecture str of xor3 is begin
  o <= (a xor b xor c) after 2500 ps;
end str;
