Advertisement
akmalgtg

Untitled

Nov 29th, 2021
995
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3.  
  4. ENTITY top_test IS
  5. END top_test;
  6.  
  7. ARCHITECTURE behavior OF top_test IS
  8.  
  9.     -- Component Declaration for the Unit Under Test (UUT)
  10.  
  11.     COMPONENT top
  12.     PORT(
  13.          pb1 : IN  std_logic;
  14.          pb2 : IN  std_logic;
  15.          switch : IN  std_logic_vector(3 downto 0);
  16.          led : OUT  std_logic_vector(4 downto 0);
  17.          mode : OUT  std_logic_vector(2 downto 0)
  18.         );
  19.     END COMPONENT;
  20.    
  21.  
  22.    --Inputs
  23.    signal pb1 : std_logic := '0';
  24.    signal pb2 : std_logic := '0';
  25.    signal switch : std_logic_vector(3 downto 0) := (others => '0');
  26.  
  27.     --Outputs
  28.    signal led : std_logic_vector(4 downto 0);
  29.    signal mode : std_logic_vector(2 downto 0);
  30.  
  31. BEGIN
  32.  
  33.     -- Instantiate the Unit Under Test (UUT)
  34.    uut: top PORT MAP (
  35.           pb1 => pb1,
  36.           pb2 => pb2,
  37.           switch => switch,
  38.           led => led,
  39.           mode => mode
  40.         );
  41.  
  42.    -- Stimulus process
  43.    stim_proc: process
  44.    begin       
  45.       -- hold reset state for 50 ns.
  46.       wait for 50 ns;  
  47.  
  48.       -- insert stimulus here
  49.        
  50.         -- F
  51.         switch <= "0100";
  52.         wait for 10ns;
  53.         pb1 <= '1';
  54.         wait for 5ns;
  55.         pb1 <= '0';
  56.         wait for 5ns;
  57.        
  58.         switch <= "0110";
  59.         wait for 10ns;
  60.         pb1 <= '1';
  61.         wait for 5ns;
  62.         pb1 <= '0';
  63.         wait for 15ns;
  64.        
  65.         pb1 <= '1';
  66.         wait for 5ns;
  67.         pb1 <= '0';
  68.         wait for 5ns;
  69.        
  70.         -- P
  71.         switch <= "0101";
  72.         wait for 10ns;
  73.         pb1 <= '1';
  74.         wait for 5ns;
  75.         pb1 <= '0';
  76.         wait for 5ns;
  77.        
  78.         switch <= "0000";
  79.         wait for 10ns;
  80.         pb1 <= '1';
  81.         wait for 5ns;
  82.         pb1 <= '0';
  83.         wait for 15ns;
  84.        
  85.         pb1 <= '1';
  86.         wait for 5ns;
  87.         pb1 <= '0';
  88.         wait for 5ns;
  89.        
  90.         -- G
  91.         switch <= "0100";
  92.         wait for 10ns;
  93.         pb1 <= '1';
  94.         wait for 5ns;
  95.         pb1 <= '0';
  96.         wait for 5ns;
  97.        
  98.         switch <= "0111";
  99.         wait for 10ns;
  100.         pb1 <= '1';
  101.         wait for 5ns;
  102.         pb1 <= '0';
  103.         wait for 15ns;
  104.        
  105.         pb1 <= '1';
  106.         wait for 5ns;
  107.         pb1 <= '0';
  108.         wait for 5ns;
  109.        
  110.         -- A
  111.         switch <= "0100";
  112.         wait for 10ns;
  113.         pb1 <= '1';
  114.         wait for 5ns;
  115.         pb1 <= '0';
  116.         wait for 5ns;
  117.        
  118.         switch <= "0001";
  119.         wait for 10ns;
  120.         pb1 <= '1';
  121.         wait for 5ns;
  122.         pb1 <= '0';
  123.         wait for 15ns;
  124.        
  125.         pb1 <= '1';
  126.         wait for 5ns;
  127.         pb1 <= '0';
  128.         wait for 5ns;
  129.        
  130.    end process;
  131.  
  132. END;
  133.  
Advertisement
RAW Paste Data Copied
Advertisement