VHDL code for OR gate with Test bench

VHDL code for OR gate with Test bench

 



library IEEE;
use IEEE.std_logic_1164.all;
entity orgate is
Port( A : in std_logic;
B : in std_logic;
Y : out std_logic
);
end orgate;

architecture Behavioral of orgate is
begin
Y<= A  or B ;
end Behavioral;

Test Bench

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity or_tb is
--  Port ( );
end or_tb;

architecture Behavioral of or_tb is
--Component name and entity's name must be same
--ports must be same 
 component orgate is
  Port (A,B:in std_logic;
  C: out std_logic );
end component;
--inputs
signal a: std_logic:= '0';
signal b: std_logic:= '0';
--outputs
signal c : std_logic;

begin
uut: orgate PORT MAP(a=>A,b=>B,c=>C);
--Stimulus Process
stim_proc:process
begin
wait for 10ns;
a<='1';
b<='0';
wait for 10ns;
a<='0';
b<='1';
wait for 10ns;
a<='0';
b<='0';
wait for 10ns;
a<='1';
b<='1';
wait for 10ns;
end process;
end Behavioral;

Comments

Post a Comment

Ad

Popular posts from this blog

VHDL Code for AND gate With Test Bench

VHDL code for Half adder with Test Bench

VHDL code for Full Adder With Test bench