Exp 1
Exp 1
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fourinputuniversal is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
d : in STD_LOGIC;
o : out STD_LOGIC);
end fourinputuniversal;
begin
end dataflow;
TESTBENCH CODE
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY fourinputuniversal_tb IS
END fourinputuniversal_tb;
COMPONENT fourinputuniversal
PORT(
a : IN std_logic;
b : IN std_logic;
c : IN std_logic;
d : IN std_logic;
o : OUT std_logic
);
END COMPONENT;
--Inputs
--Outputs
signal o : std_logic;
BEGIN
a => a,
b => b,
c => c,
d => d,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<='0';
b<='1';
c<='0';
d<='1';
a<='0';
b<='0';
c<='0';
d<='1';
b<='0';
c<='1';
d<='0';
a<='0';
b<='0';
c<='1';
d<='1';
wait;
end process;
END;
1)a)nor gate
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fourinputuniversalnor is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
d : in STD_LOGIC;
o : out STD_LOGIC);
end fourinputuniversalnor;
begin
end dataflow;
TESTBENCH CODE
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY fourinputuniversalnor_tb IS
END fourinputuniversalnor_tb;
COMPONENT fourinputuniversalnor
PORT(
a : IN std_logic;
b : IN std_logic;
c : IN std_logic;
d : IN std_logic;
o : OUT std_logic
);
END COMPONENT;
--Inputs
--Outputs
signal o : std_logic;
BEGIN
-- Instantiate the Unit Under Test (UUT)
a => a,
b => b,
c => c,
d => d,
o => o
);
stim_proc: process
begin
a<='0';
b<='1';
c<='0';
d<='1';
a<='0';
b<='0';
c<='0';
d<='1';
a<='1';
b<='0';
c<='1';
d<='0';
a<='0';
b<='0';
c<='1';
d<='1’;
wait;
end process;
END;
1)b xor
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity derivedxor is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
d : in STD_LOGIC;
o : out STD_LOGIC);
end derivedxor;
begin
end dataflow;
TEST BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY derivedxor_tb IS
END derivedxor_tb;
ARCHITECTURE behavior OF derivedxor_tb IS
COMPONENT derivedxor
PORT(
a : IN std_logic;
b : IN std_logic;
c : IN std_logic;
d : IN std_logic;
o : OUT std_logic
);
END COMPONENT;
--Inputs
--Outputs
signal o : std_logic;
BEGIN
a => a,
b => b,
c => c,
d => d,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<='0';
b<='1';
c<='0';
d<='1';
a<='0';
b<='0';
c<='0';
d<='1';
a<='1';
b<='0';
c<='1';
d<='0';
a<='0';
b<='0';
c<='1';
d<='1';
wait;
end process;
END;
1)b xnor
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity derivedxnor is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
d : in STD_LOGIC;
o : out STD_LOGIC);
end derivedxnor;
begin
end dataflow;
TEST BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY derivedxnor_tb IS
END derivedxnor_tb;
COMPONENT derivedxnor
PORT(
a : IN std_logic;
b : IN std_logic;
c : IN std_logic;
d : IN std_logic;
o : OUT std_logic
);
END COMPONENT;
--Inputs
--Outputs
signal o : std_logic;
BEGIN
a => a,
b => b,
c => c,
d => d,
o => o
-- Stimulus process
stim_proc: process
begin
a<='0';
b<='1';
c<='0';
d<='1';
a<='0';
b<='0';
c<='0';
d<='1';
b<='0';
c<='1';
d<='0';
a<='0';
b<='0';
c<='1';
d<='1';
wait;
end process;
END;
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fourinputuniversal is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
d : in STD_LOGIC;
o : out STD_LOGIC);
end fourinputuniversal;
end dataflow;
TESTBENCH CODE
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY fourinputuniversal_tb IS
END fourinputuniversal_tb;
COMPONENT fourinputuniversal
PORT(
a : IN std_logic;
b : IN std_logic;
c : IN std_logic;
d : IN std_logic;
o : OUT std_logic
);
END COMPONENT;
--Inputs
--Outputs
signal o : std_logic;
BEGIN
a => a,
b => b,
c => c,
d => d,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<='0';
b<='1';
c<='0';
d<='1';
a<='0';
b<='0';
c<='0';
d<='1';
a<='1';
b<='0';
c<='1';
d<='0';
a<='0';
b<='0';
c<='1';
d<='1';
wait;
end process;
END;
1)b)nor gate
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fourinputuniversalnor is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
d : in STD_LOGIC;
o : out STD_LOGIC);
end fourinputuniversalnor;
begin
end dataflow;
TESTBENCH CODE
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY fourinputuniversalnor_tb IS
END fourinputuniversalnor_tb;
COMPONENT fourinputuniversalnor
PORT(
a : IN std_logic;
b : IN std_logic;
c : IN std_logic;
d : IN std_logic;
o : OUT std_logic
);
END COMPONENT;
--Inputs
--Outputs
signal o : std_logic;
BEGIN
a => a,
b => b,
c => c,
d => d,
o => o
);
stim_proc: process
begin
a<='0';
b<='1';
c<='0';
d<='1';
a<='0';
b<='0';
c<='0';
d<='1';
a<='1';
b<='0';
c<='1';
d<='0';
a<='0';
b<='0';
c<='1';
d<='1’;
wait;
end process;
END;
1)c and
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity basicand is
end basicand;
begin
o<= a and b;
end dataflow;
TEST BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY basicand_tb IS
END basicand_tb;
COMPONENT basicand
PORT(
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
a => a,
b => b,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<="0000";
b<="1111";
a<="1010";
b<="0101";
a<="1100";
b<="1100";
a<="0101";
b<="1100";
wait;
wait;
end process;
END;
1)c or
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity basicor is
end basicor;
begin
o<= a or b;
end dataflow;
TEST BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY basicor_tb IS
END basicor_tb;
COMPONENT basicor
PORT(
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
a => a,
b => b,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<="0000";
b<="1111";
a<="1010";
b<="0101";
b<="1100";
a<="0101";
b<="1100";
wait;
wait;
end process;
END;
1)c not
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity basicnot is
end basicnot;
begin
end dataflow;
TEST BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY basicnot_tb IS
END basicnot_tb;
COMPONENT basicnot
PORT(
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
a => a,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<="0000";
a<="0101";
a<="1010";
wait for 100 ns;
a<="0011";
wait;
end process;
END;
1)d nand
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity derived3nand is
end derived3nand;
begin
end dataflow;
TEST BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY derived3nand_tb IS
END derived3nand_tb;
ARCHITECTURE behavior OF derived3nand_tb IS
COMPONENT derived3nand
PORT(
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
a => a,
b => b,
c => c,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<="000";
b<="111";
c<="000";
a<="001";
b<="010";
c<="010";
a<="101";
b<="100";
c<="111";
a<="011";
b<="110";
c<="101";
wait;
end process;
END;
1)d nor
MODULE CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity derived3nor is
begin
end dataflow;
TEST BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY derived3nor_tb IS
END derived3nor_tb;
COMPONENT derived3nor
PORT(
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
b => b,
c => c,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<="000";
b<="111";
c<="000";
a<="001";
b<="010";
c<="010";
a<="101";
b<="100";
c<="111";
a<="011";
b<="110";
c<="101";
wait;
end process;
END;
1)d xor
Module code
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity derived3xor is
end derived3xor;
begin
end dataflow;
Testbench code
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY derived3xor_tb IS
END derived3xor_tb;
COMPONENT derived3xor
PORT(
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
a => a,
b => b,
c => c,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<="000";
b<="111";
c<="000";
a<="001";
b<="010";
c<="010";
b<="100";
c<="111";
a<="011";
b<="110";
c<="101";
wait;
end process;
END;
1)d xnor
Module code
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity derived3xnor is
end derived3xnor;
begin
end dataflow;
Testbench code
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY derived3Xnor_tb IS
END derived3Xnor_tb;
COMPONENT derived3xnor
PORT(
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
a => a,
b => b,
c => c,
o => o
);
-- Stimulus process
stim_proc: process
begin
a<="000";
b<="111";
c<="000";
a<="001";
b<="010";
c<="010";
a<="101";
b<="100";
c<="111";
a<="011";
b<="110";
c<="101";
wait;
end process;
END;