Advertisement
anderson02021

testbench_q1_lista03

Jun 15th, 2021
694
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.39 KB | None | 0 0
  1. -- Code your testbench here
  2. library IEEE;
  3. use IEEE.std_logic_1164.all;
  4.  
  5. entity testbench is
  6. --
  7. end testbench;
  8.  
  9. architecture comp of testbench is
  10.  
  11. component simple
  12.  
  13. port (
  14.     clock, reset, w :   in std_logic;
  15.     z:                  out std_logic
  16. );
  17. end component;
  18.  
  19. signal clk_signal, z_signal, w_signal, reset_signal :std_logic;
  20.  
  21. constant PERIODO : time := 10 ns;
  22.  
  23. begin
  24.  
  25. U0: simple Port map(
  26.     clock => clk_signal,
  27.     reset => reset_signal,
  28.     z => z_signal,
  29.     w => w_signal
  30. );
  31.    
  32.     --Gerando o clock
  33.    
  34.     ClockGen: process
  35.     begin
  36.         for i in 0 to 10 loop
  37.         clk_signal <= '0';
  38.         wait for PERIODO;
  39.         clk_signal <= '1';
  40.         wait for PERIODO;
  41.       end loop;
  42.       wait;  
  43.     end process ClockGen;
  44.    
  45.     --Sinal da entrada w
  46.    
  47.     entradaB: process
  48.     begin
  49.       w_signal <= '0';
  50.       wait for 2*PERIODO;
  51.       w_signal <= '1';
  52.       wait for 7*PERIODO;
  53.       w_signal <= '0';
  54.       wait for 2*PERIODO;
  55.       w_signal <= '1';
  56.       wait for 8*PERIODO;
  57.       wait;
  58.     end process entradaB;
  59.    
  60.     --Sinal do reset
  61.    
  62.     resetSignal: process
  63.     begin
  64.         reset_signal <= '0';
  65.       wait for 2*PERIODO;
  66.       reset_signal <= '1';
  67.       wait for 10*PERIODO;
  68.       reset_signal <= '0';
  69.       wait for 2*PERIODO;
  70.       reset_signal <= '1';
  71.       wait for 2*PERIODO;
  72.       wait;
  73.     end process resetSignal;
  74.    
  75. end comp;
  76.  
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement