VHDL
VHDL
Dataflow modeling:
AND GATE:
library ieee;
use ieee.std_logic_1164.all;
entity and2 is
port (x,y: in std_logic;
z: out std_logic);
end and2;
entity or2 is
port(x,y: in std_logic;
z: out std_logic);
end or2;
entity nand2 is
port (x,y: in std_logic;
z: out std_logic);
end nand2;
entity nor2 is
port(x,y: in std_logic;
z: out std_logic);
end nor2;
architecture nor2_ data of nor2 is
begin
z<=x nor y;
end nor2_ data;
XOR GATE:
library ieee;
use ieee.std_logic_1164.all;
entity xor2 is
port(x,y: in std_logic;
z: out std_logic);
end xor2;
entity xnor2 is
port(x,y: in std_logic;
z: out std_logic);
end xnor2;
entity not1 is
port(x:in std_logic;
z:out std_logic);
end not1;
entity and2 is
port (x,y: in std_logic;
z: out std_logic);
end and2;
entity or2 is
port(x,y: in std_logic;
z: out std_logic);
end or2;
entity nand2 is
port (x,y: in std_logic;
z: out std_logic);
end nand2;
entity nor2 is
port(x,y: in std_logic;
z: out std_logic);
end nor2;
entity xor2 is
port(x,y: in std_logic;
z: out std_logic);
end xor2;
entity xnor2 is
port(x,y: in std_logic;
z: out std_logic);
end xnor2;
entity not1 is
port(x:in std_logic;
z:out std_logic);
end not1;