Library of reusable VHDL components
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.

55 lines
1.3 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. entity QueueT is
  5. end entity QueueT;
  6. architecture sim of QueueT is
  7. shared variable sv_queue : work.QueueP.t_simple_queue;
  8. begin
  9. QueueTestP : process is
  10. variable v_data : std_logic_vector(63 downto 0);
  11. variable v_count : natural := 0;
  12. begin
  13. -- check initial emptiness
  14. assert sv_queue.is_empty
  15. report "ERROR: queue should be empty!"
  16. severity failure;
  17. for i in 0 to 63 loop
  18. sv_queue.push(std_logic_vector(to_unsigned(v_count, 64)));
  19. v_count := v_count + 1;
  20. end loop;
  21. -- check that it's full
  22. assert sv_queue.is_full
  23. report "ERROR: queue should be full!"
  24. severity failure;
  25. -- empty the queue
  26. v_count := 0;
  27. for i in 0 to 63 loop
  28. sv_queue.pop(v_data);
  29. assert v_data = std_logic_vector(to_unsigned(v_count, 64))
  30. report "ERROR: read data should be " & integer'image(v_count) &
  31. " instead of " & integer'image(to_integer(unsigned(v_data)))
  32. severity failure;
  33. v_count := v_count + 1;
  34. end loop;
  35. -- check emptiness
  36. assert sv_queue.is_empty
  37. report "ERROR: queue should be empty!"
  38. severity failure;
  39. report "INFO: Test finished successfully";
  40. wait;
  41. end process QueueTestP;
  42. end architecture sim;