martaczaska

Untitled

Apr 14th, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. --TEST BENCH
  2.  
  3.  
  4. LIBRARY ieee;
  5. USE ieee.std_logic_1164.ALL;
  6.  
  7. -- Uncomment the following library declaration if using
  8. -- arithmetic functions with Signed or Unsigned values
  9. --USE ieee.numeric_std.ALL;
  10.  
  11. ENTITY tescik IS
  12. END tescik;
  13.  
  14. ARCHITECTURE behavior OF tescik IS
  15.  
  16. -- Component Declaration for the Unit Under Test (UUT)
  17.  
  18. COMPONENT DISPLAY
  19. PORT(
  20. CLK_i : IN std_logic;
  21. RST_i : IN std_logic;
  22. SW : IN std_logic_vector(7 downto 0);
  23. BTN : IN std_logic_vector(3 downto 0);
  24. AN : OUT std_logic_vector(3 downto 0);
  25. SEG : OUT std_logic_vector(7 downto 0)
  26. );
  27. END COMPONENT;
  28.  
  29.  
  30. --Inputs
  31. signal CLK_i : std_logic := '0';
  32. signal RST_i : std_logic := '0';
  33. signal SW : std_logic_vector(7 downto 0) := (others => '0');
  34. signal BTN : std_logic_vector(3 downto 0) := (others => '0');
  35.  
  36. --Outputs
  37. signal AN : std_logic_vector(3 downto 0);
  38. signal SEG : std_logic_vector(7 downto 0);
  39.  
  40. -- Clock period definitions
  41. constant CLK_i_period : time := 50 ms;
  42.  
  43. BEGIN
  44.  
  45. -- Instantiate the Unit Under Test (UUT)
  46. uut: DISPLAY PORT MAP (
  47. CLK_i => CLK_i,
  48. RST_i => RST_i,
  49. SW => SW,
  50. BTN => BTN,
  51. AN => AN,
  52. SEG => SEG
  53. );
  54.  
  55. -- Clock process definitions
  56. CLK_i_process :process
  57. begin
  58. CLK_i <= '0';
  59. wait for CLK_i_period/2;
  60. CLK_i <= '1';
  61. wait for CLK_i_period/2;
  62. end process;
  63.  
  64.  
  65. -- Stimulus process
  66. stim_proc: process
  67. begin
  68. -- hold reset state for 100 ns.
  69. wait for 100 ms;
  70.  
  71. SW <= "00000001";
  72. BTN <= "1110";
  73.  
  74. wait for 100 ms;
  75.  
  76. SW <= "00000001";
  77. BTN <= "1101";
  78.  
  79. wait for 100 ms;
  80.  
  81. SW <= "00000010";
  82. BTN <= "1011";
  83.  
  84. wait for 100 ms;
  85.  
  86. SW <= "00000010";
  87. BTN <= "0111";
  88.  
  89. wait for clk_i_period*10;
  90.  
  91. wait;
  92. end process;
  93.  
  94. resecix : process
  95. begin
  96.  
  97. wait for 300 ms;
  98.  
  99. RST_i <= '1';
  100.  
  101. wait for 100 ms;
  102.  
  103. RST_i <= '0';
  104.  
  105. wait;
  106. end process;
  107.  
  108.  
  109. END;
Advertisement
Add Comment
Please, Sign In to add comment