This testbench creates signals and connects them to an AndGate component. It changes inputs and shows the output using reports.
library ieee;
use ieee.std_logic_1164.all;
entity tb_AndGate is
end tb_AndGate;
architecture behavior of tb_AndGate is
signal tb_A, tb_B, tb_Y : std_logic := '0';
-- Component instantiation
uut: entity work.AndGate
port map (
A => tb_A,
B => tb_B,
Y => tb_Y
);
begin
process
begin
tb_A <= '0'; tb_B <= '0'; wait for 10 ns;
report "A=0 B=0 Y=" & std_logic'image(tb_Y);
tb_A <= '0'; tb_B <= '1'; wait for 10 ns;
report "A=0 B=1 Y=" & std_logic'image(tb_Y);
tb_A <= '1'; tb_B <= '0'; wait for 10 ns;
report "A=1 B=0 Y=" & std_logic'image(tb_Y);
tb_A <= '1'; tb_B <= '1'; wait for 10 ns;
report "A=1 B=1 Y=" & std_logic'image(tb_Y);
wait;
end process;
end behavior;