LucaSkywalker

tb_schematic.vhdl

May 18th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.45 KB | None | 0 0
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3. USE ieee.numeric_std.ALL;
  4. LIBRARY UNISIM;
  5. USE UNISIM.Vcomponents.ALL;
  6. ENTITY schematic_schematic_sch_tb IS
  7. END schematic_schematic_sch_tb;
  8. ARCHITECTURE behavioral OF schematic_schematic_sch_tb IS
  9.  
  10.    COMPONENT schematic
  11.    PORT(  Clear     :   IN  STD_LOGIC;
  12.           Clock     :   IN  STD_LOGIC;
  13.           HIGH      :   IN  STD_LOGIC;
  14.           D         :   IN  STD_LOGIC;
  15.           Q2        :   OUT STD_LOGIC;
  16.           Q1        :   OUT STD_LOGIC;
  17.           Q0        :   OUT STD_LOGIC;
  18.           E         :   OUT STD_LOGIC);
  19.    END COMPONENT;
  20.  
  21.    SIGNAL Q0        :   STD_LOGIC;
  22.    SIGNAL HIGH      :   STD_LOGIC;
  23.    SIGNAL D         :   STD_LOGIC;
  24.    SIGNAL E         :   STD_LOGIC;
  25.    SIGNAL Q1        :   STD_LOGIC;
  26.    SIGNAL Q2        :   STD_LOGIC;
  27.    SIGNAL Clear     :   STD_LOGIC;
  28.    SIGNAL Clock     :   STD_LOGIC;
  29.    
  30.    constant clk_period : time := 10 ns;
  31.  
  32. BEGIN
  33.  
  34.    UUT: schematic PORT MAP(
  35.         Q0 => Q0,
  36.         HIGH => HIGH,
  37.         D => D,
  38.         E => E,
  39.         Q1 => Q1,
  40.         Q2 => Q2,
  41.         Clear => Clear,
  42.         Clock => Clock
  43.    );
  44.         D <= '0';
  45.         HIGH <= '1';
  46.         Clear <= '1';
  47.        
  48.     clk_process : process is
  49.     begin
  50.         Clock <= '0';
  51.         wait for clk_period / 2;
  52.         Clock <= '1';
  53.         wait for clk_period / 2;
  54.     end process clk_process;
  55.  
  56.    tb : PROCESS
  57.    BEGIN
  58.         Clear <= '0';
  59.  
  60.         for i in 0 to 7 loop
  61.             for j in 0 to i loop
  62.                 D <= '0';
  63.                 wait for 5 ns;
  64.             end loop;
  65.             D <= '1';
  66.             wait for 5 ns;
  67.         end loop;
  68.  
  69.         Clear <= '1';
  70.         wait for 1000 ns;
  71.    END PROCESS;
  72. END;
Advertisement
Add Comment
Please, Sign In to add comment