Advertisement
felipe4004

tb_memoria_de_retenção

May 18th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.74 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 05/17/2019 10:12:44 PM
  6. -- Design Name:
  7. -- Module Name: tb_mem_ret - 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 tb_mem_ret is
  35. --  Port ( );
  36. end tb_mem_ret;
  37.  
  38. architecture Behavioral of tb_mem_ret is
  39.  
  40.     component mem_ret is
  41.     Port ( clk  : in STD_LOGIC;
  42.            rst   : in STD_LOGIC;
  43.            sw   : in STD_LOGIC_VECTOR (3 downto 0);
  44.            lib  : in STD_LOGIC;
  45.            sol  : out STD_LOGIC;
  46.            ad   : out STD_LOGIC_VECTOR (1 downto 0));
  47.    end component;
  48.  
  49.       signal sw   : STD_LOGIC_VECTOR (3 downto 0):= (others => '0');
  50.       signal clk  : STD_LOGIC := '0';
  51.       signal rst  : STD_LOGIC := '0';
  52.       signal lib  : STD_LOGIC := '0';
  53.       signal sol  : STD_LOGIC := '0';
  54.       signal ad   : STD_LOGIC_VECTOR (1 downto 0) := "00";  
  55.       constant clk_period : time := 10ns;
  56.  
  57. begin
  58. tb_pm: mem_ret port map( clk  => clk,
  59.                          rst  => rst,
  60.                          sw   => sw,
  61.                          lib  => lib,
  62.                          sol  => sol,
  63.                          ad   => ad );
  64.                          
  65.     clk_stimulus: process
  66.     begin
  67.         wait for clk_period/2;
  68.             clk <= '0';
  69.         wait for clk_period/2;
  70.             clk <= '1';
  71.     end process;
  72.                          
  73. stimulus: process
  74.     begin
  75.         wait for 5*clk_period;
  76.                 sw <= "1111";
  77.             wait for 2*clk_period;
  78.                 sw <= "0000";
  79.             wait for 5* clk_period;
  80.                 lib <= '1';
  81.             wait for 2*clk_period;
  82.                 lib <= '0';
  83.             wait for 8* clk_period;
  84.                 lib <= '1';
  85.             wait for 2*clk_period;
  86.                 lib <= '0';
  87.             wait for 2*clk_period;
  88.                 lib <= '1';
  89.             wait for 2*clk_period;
  90.                 lib <= '0';
  91.             wait for 2*clk_period;
  92.                 lib <= '1';
  93.             wait for 2*clk_period;
  94.                 lib <= '0';
  95.                 sw <= "1001";
  96.     end process;
  97.                          
  98.  
  99. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement