Last active
December 6, 2018 14:11
-
-
Save rishi93/fee388a908f56ae323f1596a1dc2cd6c to your computer and use it in GitHub Desktop.
A simple testbench for the counter in VHDL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library IEEE; | |
use IEEE.STD_LOGIC_1164.ALL; | |
use IEEE.STD_LOGIC_ARITH.ALL; | |
use IEEE.STD_LOGIC_UNSIGNED.ALL; | |
entity special_counter_tb is | |
end entity; | |
architecture tb of special_counter_tb is | |
component special_counter is | |
port( | |
clk : in std_logic; | |
rst : in std_logic; | |
output : out std_logic_vector(0 to 5) | |
); | |
end component; | |
-- inputs | |
signal clk : std_logic; | |
signal rst : std_logic; | |
-- outputs | |
signal output : std_logic_vector(0 to 5); | |
constant clk_period : time := 10 ns; | |
begin | |
uut : special_counter port map( | |
clk => clk, | |
rst => rst, | |
output => output | |
); | |
clk_process : process | |
begin | |
clk <= '0'; | |
wait for clk_period/2; | |
clk <= '1'; | |
wait for clk_period/2; | |
end process; | |
stimulus_process : process | |
begin | |
rst <= '0'; | |
wait for clk_period * 10; | |
rst <= not rst; | |
wait; | |
end process; | |
end architecture; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment