Advertisement
milanmetal

[VHDL] REGISTER 4-bit SIPO / TESTBENCH

Apr 28th, 2017
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.91 KB | None | 0 0
  1. --------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:   17:52:57 04/28/2017
  6. -- Design Name:  
  7. -- Module Name:   C:/VHDL/_VEZBE_5/REGISTER_4BIT_SIPO/REGISTER_4BIT_PIPO_tb.vhd
  8. -- Project Name:  REGISTER_4BIT_SIPO
  9. -- Target Device:  
  10. -- Tool versions:  
  11. -- Description:  
  12. --
  13. -- VHDL Test Bench Created by ISE for module: REGISTER_4BIT_SIPO
  14. --
  15. -- Dependencies:
  16. --
  17. -- Revision:
  18. -- Revision 0.01 - File Created
  19. -- Additional Comments:
  20. --
  21. -- Notes:
  22. -- This testbench has been automatically generated using types std_logic and
  23. -- std_logic_vector for the ports of the unit under test.  Xilinx recommends
  24. -- that these types always be used for the top-level I/O of a design in order
  25. -- to guarantee that the testbench will bind correctly to the post-implementation
  26. -- simulation model.
  27. --------------------------------------------------------------------------------
  28. LIBRARY ieee;
  29. USE ieee.std_logic_1164.ALL;
  30.  
  31. -- Uncomment the following library declaration if using
  32. -- arithmetic functions with Signed or Unsigned values
  33. --USE ieee.numeric_std.ALL;
  34.  
  35. ENTITY REGISTER_4BIT_PIPO_tb IS
  36. END REGISTER_4BIT_PIPO_tb;
  37.  
  38. ARCHITECTURE behavior OF REGISTER_4BIT_PIPO_tb IS
  39.  
  40.     -- Component Declaration for the Unit Under Test (UUT)
  41.  
  42.     COMPONENT REGISTER_4BIT_SIPO
  43.     PORT(
  44.          CLK : IN  std_logic;
  45.          D : IN  std_logic;
  46.          CE : IN  std_logic;
  47.          WE : IN  std_logic;
  48.          RE : IN  std_logic;
  49.          CLEAR : IN  std_logic;
  50.          PRESET : IN  std_logic;
  51.          Q : OUT  std_logic_vector(3 downto 0)
  52.         );
  53.     END COMPONENT;
  54.    
  55.  
  56.    --Inputs
  57.    signal CLK : std_logic := '0';
  58.    signal D : std_logic := '0';
  59.    signal CE : std_logic := '0';
  60.    signal WE : std_logic := '0';
  61.    signal RE : std_logic := '0';
  62.    signal CLEAR : std_logic := '0';
  63.    signal PRESET : std_logic := '0';
  64.  
  65.     --Outputs
  66.    signal Q : std_logic_vector(3 downto 0);
  67.  
  68.    -- Clock period definitions
  69.    constant CLK_period : time := 10 ns;
  70.  
  71. BEGIN
  72.  
  73.     -- Instantiate the Unit Under Test (UUT)
  74.    uut: REGISTER_4BIT_SIPO PORT MAP (
  75.           CLK => CLK,
  76.           D => D,
  77.           CE => CE,
  78.           WE => WE,
  79.           RE => RE,
  80.           CLEAR => CLEAR,
  81.           PRESET => PRESET,
  82.           Q => Q
  83.         );
  84.  
  85.    -- Clock process definitions
  86.    CLK_process :process
  87.    begin
  88.         CLK <= '0';
  89.         wait for CLK_period/2;
  90.         CLK <= '1';
  91.         wait for CLK_period/2;
  92.    end process;
  93.  
  94.  
  95.    -- Stimulus process
  96.    stim_proc: process
  97.    begin       
  98.      
  99.         CE <= '1', '0' after 500 ns;
  100.        
  101.         WE <= '0', '1' after 100ns;
  102.         D <= '1', '0' after 110ns, '1' after 150ns, '0' after 200ns, '1' after 220ns, '0' after 250ns;
  103.         RE <= '0', '1' after 190ns;
  104.        
  105.         PRESET <= '0', '1' after 300ns, '0' after 420ns;
  106.         CLEAR <= '0', '1' after 400ns;
  107.          
  108.       wait;
  109.    end process;
  110.  
  111. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement