Advertisement
Guest User

test_Four_Bit_Counter.vhd

a guest
Aug 25th, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.85 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 08/24/2016 11:12:18 AM
  6. -- Design Name:
  7. -- Module Name: test_Four_Bit_Counter - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24.  
  25. -- Uncomment the following library declaration if using
  26. -- arithmetic functions with Signed or Unsigned values
  27. --use IEEE.NUMERIC_STD.ALL;
  28.  
  29. -- Uncomment the following library declaration if instantiating
  30. -- any Xilinx leaf cells in this code.
  31. --library UNISIM;
  32. --use UNISIM.VComponents.all;
  33.  
  34. entity test_Four_Bit_Counter is
  35. --  Port ( );
  36. end test_Four_Bit_Counter;
  37.  
  38. architecture Behavioral of test_Four_Bit_Counter is
  39.  
  40.     -- Component Declaration for the Unit Under Test (UUT)
  41.  
  42.     COMPONENT Four_Bit_Counter
  43.     PORT(
  44.          clk            : IN  std_logic;
  45.          reset          : IN  std_logic;
  46.          UP_DOWN        : IN  std_logic;
  47.          LOAD           : IN  std_logic;
  48.          TICK           : IN  std_logic;
  49.          AUTO_MANUAL    : IN  std_logic;
  50.          value          : IN  STD_LOGIC_VECTOR(0 to 3);
  51.          Port_Counter   : OUT STD_LOGIC_VECTOR(0 to 3)
  52.         );
  53.     END COMPONENT;
  54.  
  55.     --Inputs
  56.     signal clk          : std_logic := '0';
  57.     signal reset        : std_logic := '0';
  58.     signal UP_DOWN      : std_logic := '0';
  59.     signal LOAD         : std_logic := '0';
  60.     signal TICK         : std_logic := '0';
  61.     signal AUTO_MANUAL  : std_logic := '0';
  62.     signal value        : STD_LOGIC_VECTOR(0 to 3) := "0000";
  63.    
  64.     --Outputs
  65.     signal Port_Counter : STD_LOGIC_VECTOR(0 to 3);
  66.  
  67.     -- Clock period definitions
  68.     constant Port_Clk_period : time := 25 ns;
  69.  
  70. begin
  71.  
  72.     -- Instantiate the Unit Under Test (UUT)
  73.     uut: Four_Bit_Counter PORT MAP (
  74.           clk => clk,
  75.           reset => reset,
  76.           UP_DOWN => UP_DOWN,
  77.           LOAD => LOAD,
  78.           TICK => TICK,
  79.           AUTO_MANUAL => AUTO_MANUAL,
  80.           value => value,
  81.           Port_Counter => Port_Counter
  82.         );
  83.  
  84.    -- Clock process definitions
  85.    Port_Clk_process :process
  86.    begin
  87.         clk <= '0';
  88.         wait for Port_Clk_period/2;
  89.         clk <= '1';
  90.         wait for Port_Clk_period/2;
  91.    end process;
  92.  
  93.     --Stimulus process
  94.     stim_proc: process
  95.     begin
  96.         --hold reset state for 100ns
  97.         wait for 100ns;
  98.         reset <= '1';
  99.         wait for 100ns;
  100.         reset <= '0';
  101.         wait for 100ns;
  102.         --insert stimulus here
  103.         AUTO_MANUAL <= '1';
  104.         UP_DOWN <= '1';
  105.         wait for 600ns;
  106.        
  107.         wait;      
  108.     end process;
  109.  
  110. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement