Tyler_Elric

test_hmsclock

Sep 20th, 2017
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.54 KB | None | 0 0
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3.  
  4. ENTITY test_clock IS
  5. END test_clock;
  6.  
  7. ARCHITECTURE behavior OF test_clock IS
  8.  
  9.     COMPONENT hmsclock
  10.     PORT(
  11.          Clk : IN  std_logic;
  12.          En : IN  std_logic;
  13.          Rst : IN  std_logic;
  14.          Cout : OUT  std_logic;
  15.          Hours : OUT  std_logic_vector(4 downto 0);
  16.          Minutes : OUT  std_logic_vector(5 downto 0);
  17.          Seconds : OUT  std_logic_vector(5 downto 0)
  18.         );
  19.     END COMPONENT;
  20.    
  21.  
  22.    --Inputs
  23.    signal Clk : std_logic := '0';
  24.    signal En : std_logic := '1';
  25.    signal Rst : std_logic := '0';
  26.  
  27.     --Outputs
  28.    signal Cout : std_logic := '0';
  29.    signal H : std_logic_vector(4 downto 0) := "00000";
  30.    signal M : std_logic_vector(5 downto 0) := "000000";
  31.    signal S : std_logic_vector(5 downto 0) := "000000";
  32.  
  33.    -- Clock period definitions
  34.    constant Clk_period : time := 10 ns;
  35.  
  36. BEGIN
  37.  
  38.     -- Instantiate the Unit Under Test (UUT)
  39.    uut: hmsclock PORT MAP (
  40.           Clk => Clk,
  41.           En => En,
  42.           Rst => Rst,
  43.           Cout => Cout,
  44.           Hours => H,
  45.           Minutes => M,
  46.           Seconds => S
  47.         );
  48.  
  49.    -- Clock process definitions
  50.    Clk_process :process
  51.    begin
  52.         Clk <= '0';
  53.         wait for Clk_period/2;
  54.         Clk <= '1';
  55.         wait for Clk_period/2;
  56.    end process;
  57.  
  58.  
  59.    -- Stimulus process
  60.    stim_proc: process
  61.    begin       
  62.       -- hold reset state for 100 ns.
  63.       wait for 100 ns;     
  64.  
  65.       wait for Clk_period*10000;
  66.  
  67.       -- insert stimulus here
  68.  
  69.       wait;
  70.    end process;
  71.  
  72. END;
Advertisement
Add Comment
Please, Sign In to add comment