Advertisement
LucaSkywalker

tb_top_level.vhdl

Apr 13th, 2020
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.24 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3.  
  4. entity tb_top_level is
  5.  
  6. end entity tb_top_level;
  7.  
  8. architecture behavioral of tb_top_level is
  9.  
  10.     component top_level is
  11.         port (
  12.             clk  : in std_logic;
  13.             srst : in std_logic;
  14.  
  15.             port_a : in std_logic_vector(7 downto 0));
  16.     end component top_level;
  17.  
  18.     -- inputs
  19.     signal clk    : std_logic                    := '0';
  20.     signal srst   : std_logic                    := '0';
  21.     signal port_a : std_logic_vector(7 downto 0) := (others => '0');
  22.  
  23.     -- clock period
  24.     constant clk_period : time := 10 ns;
  25.  
  26. begin  -- architecture behavioral
  27.  
  28.     -- unit under test
  29.     uut : top_level
  30.         port map (
  31.             clk  => clk,
  32.             srst => srst,
  33.  
  34.             port_a => port_a);
  35.  
  36.     -- clock
  37.     clk_process : process is
  38.     begin
  39.         clk <= '0';
  40.         wait for clk_period / 2;
  41.         clk <= '1';
  42.         wait for clk_period / 2;
  43.     end process clk_process;
  44.  
  45.     -- stimulus
  46.     stim_process : process is
  47.     begin
  48.         -- hold reset state for 100 ns
  49.        srst <= '1';
  50.        wait for 100 ns;
  51.        srst <= '0';
  52.          port_a <= "10101010";
  53.        wait;
  54.    end process stim_process;
  55. end architecture behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement