martaczaska

Untitled

Apr 1st, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 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 cale_test IS
  7. END cale_test;
  8.  
  9. ARCHITECTURE behavior OF cale_test IS
  10.  
  11. -- Component Declaration for the Unit Under Test (UUT)
  12.  
  13. COMPONENT wyswietlacz_main
  14. PORT(
  15. clk_i : IN std_logic;
  16. rst_i : IN std_logic;
  17. btn_i : IN std_logic_vector(3 downto 0);
  18. sw_i : IN std_logic_vector(7 downto 0);
  19. led7_an_o : OUT std_logic_vector(3 downto 0);
  20. led7_seg_o : OUT std_logic_vector(7 downto 0)
  21. );
  22. END COMPONENT;
  23.  
  24.  
  25. --Inputs
  26. signal clk_i : std_logic := '0';
  27. signal rst_i : std_logic := '0';
  28. signal btn_i : std_logic_vector(3 downto 0) := (others => '0');
  29. signal sw_i : std_logic_vector(7 downto 0) := (others => '0');
  30.  
  31. --Outputs
  32. signal led7_an_o : std_logic_vector(3 downto 0);
  33. signal led7_seg_o : std_logic_vector(7 downto 0);
  34.  
  35. -- Clock period definitions
  36. constant clk_i_period : time := 50ns;
  37.  
  38. BEGIN
  39.  
  40. -- Instantiate the Unit Under Test (UUT)
  41. uut: wyswietlacz_main PORT MAP (
  42. clk_i => clk_i,
  43. rst_i => rst_i,
  44. btn_i => btn_i,
  45. sw_i => sw_i,
  46. led7_an_o => led7_an_o,
  47. led7_seg_o => led7_seg_o
  48. );
  49.  
  50. -- Clock process definitions
  51. clk_i_process :process
  52. begin
  53. clk_i <= '0';
  54. wait for clk_i_period/2;
  55. clk_i <= '1';
  56. wait for clk_i_period/2;
  57. end process;
  58.  
  59.  
  60. -- Stimulus process
  61. stim_proc: process
  62. begin
  63. -- hold reset state for 100ms.
  64. wait for 100ns;
  65. sw_i <= "00001101";
  66. btn_i <= "1000";
  67. wait for 100ns;
  68. btn_i <= "0000";
  69. wait for 100ns;
  70. sw_i <= "00001010";
  71. btn_i <= "0010";
  72. wait for 100ns;
  73. btn_i <= "0000" ;
  74.  
  75. wait for clk_i_period*10;
  76.  
  77. -- insert stimulus here
  78.  
  79. wait;
  80. end process;
  81.  
  82. END;
Advertisement
Add Comment
Please, Sign In to add comment