No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

data_memory_test.vhd 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3. USE ieee.numeric_std.ALL;
  4. ENTITY data_memory_test IS
  5. END data_memory_test;
  6. ARCHITECTURE behavior OF data_memory_test IS
  7. COMPONENT data_memory
  8. PORT(
  9. addr : IN std_logic_vector(7 downto 0);
  10. data : IN std_logic_vector(7 downto 0);
  11. rw : IN std_logic;
  12. rst : IN std_logic;
  13. clk : IN std_logic;
  14. q : OUT std_logic_vector(7 downto 0)
  15. );
  16. END COMPONENT;
  17. --Inputs
  18. signal addr : std_logic_vector(7 downto 0) := (others => '0');
  19. signal data : std_logic_vector(7 downto 0) := (others => '0');
  20. signal rw : std_logic := '0';
  21. signal rst : std_logic := '0';
  22. signal clk : std_logic := '0';
  23. --Outputs
  24. signal q : std_logic_vector(7 downto 0);
  25. -- Clock period definitions
  26. constant clk_period : time := 10 ns;
  27. BEGIN
  28. -- Instantiate the Unit Under Test (UUT)
  29. uut: data_memory PORT MAP (
  30. addr => addr,
  31. data => data,
  32. rw => rw,
  33. rst => rst,
  34. clk => clk,
  35. q => q
  36. );
  37. -- Clock process definitions
  38. clk_process :process
  39. begin
  40. clk <= '0';
  41. wait for clk_period/2;
  42. clk <= '1';
  43. wait for clk_period/2;
  44. end process;
  45. -- Stimulus process
  46. stim_proc: process
  47. begin
  48. addr <=
  49. "00000000",
  50. "00000010" after 1*CLK_period,
  51. "00000110" after 2*CLK_period,
  52. "00001000" after 3*CLK_period,
  53. "00001100" after 4*CLK_period,
  54. "00000000" after 5*CLK_period,
  55. "00000001" after 6*CLK_period,
  56. "00000010" after 8*CLK_period,
  57. "00000000" after 9*CLK_period,
  58. "00001111" after 11*CLK_period;
  59. DATA <=
  60. "01010101",
  61. "10101010" after 6*CLK_period,
  62. "00000000" after 7*CLK_period,
  63. "11111111" after 8*CLK_period,
  64. "00001111" after 10*CLK_period;
  65. rw <=
  66. '1',
  67. '0' after 5*CLK_period,
  68. '1' after 9*CLK_period,
  69. '0' after 10*CLK_period;
  70. RST <= '1' after clk_period, '0' after 12*CLK_period;
  71. wait;
  72. end process;
  73. END;