martaczaska

Untitled

Apr 1st, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3. USE ieee.std_logic_unsigned.all;
  4. USE ieee.numeric_std.ALL;
  5.  
  6. ENTITY display_test IS
  7. END display_test;
  8.  
  9. ARCHITECTURE behavior OF display_test IS
  10.  
  11. -- Component Declaration for the Unit Under Test (UUT)
  12.  
  13. COMPONENT display
  14. PORT(
  15. clk_i : IN std_logic;
  16. rst_i : IN std_logic;
  17. digit_i : IN std_logic_vector(31 downto 0);
  18. led7_an_o : OUT std_logic_vector(3 downto 0);
  19. led7_seg_o : OUT std_logic_vector(7 downto 0)
  20. );
  21. END COMPONENT;
  22.  
  23.  
  24. --Inputs
  25. signal clk_i : std_logic := '0';
  26. signal rst_i : std_logic := '0';
  27. signal digit_i : std_logic_vector(31 downto 0) := (others => '0');
  28.  
  29. --Outputs
  30. signal led7_an_o : std_logic_vector(3 downto 0);
  31. signal led7_seg_o : std_logic_vector(7 downto 0);
  32.  
  33. -- Clock period definitions
  34. constant clk_i_period : time := 100ns;
  35.  
  36. BEGIN
  37.  
  38. -- Instantiate the Unit Under Test (UUT)
  39. uut: display PORT MAP (
  40. clk_i => clk_i,
  41. rst_i => rst_i,
  42. digit_i => digit_i,
  43. led7_an_o => led7_an_o,
  44. led7_seg_o => led7_seg_o
  45. );
  46.  
  47. -- Clock process definitions
  48. clk_i_process :process
  49. begin
  50. clk_i <= '0';
  51. wait for clk_i_period/2;
  52. clk_i <= '1';
  53. wait for clk_i_period/2;
  54. end process;
  55.  
  56.  
  57. -- Stimulus process
  58. stim_proc: process
  59. begin
  60. wait for 100ns;
  61. -- hold reset state for 100ms.
  62. digit_i <= "11110000110101010011000111001110";
  63.  
  64.  
  65. wait for clk_i_period*10;
  66. digit_i <= "11110110001110011100011010101000";
  67. wait for clk_i_period*10;
  68. digit_i <= "10011100011110110001111010101000";
  69. -- insert stimulus here
  70.  
  71. wait;
  72. end process;
  73.  
  74. END;
Advertisement
Add Comment
Please, Sign In to add comment