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.

68 lines
1.8 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. use work.AssertP.all;
  5. entity QueueT is
  6. end entity QueueT;
  7. architecture sim of QueueT is
  8. shared variable sv_simple_queue : work.QueueP.t_simple_queue;
  9. shared variable sv_list_queue : work.QueueP.t_list_queue;
  10. begin
  11. SimpleQueueTestP : process is
  12. variable v_data : std_logic_vector(63 downto 0);
  13. begin
  14. -- check initial emptiness
  15. assert_true(sv_simple_queue.is_empty, "Queue should be empty!");
  16. for i in 0 to 63 loop
  17. sv_simple_queue.push(std_logic_vector(to_unsigned(i, 64)));
  18. end loop;
  19. -- check that it's full
  20. assert_true(sv_simple_queue.is_full, "Queue should be full!");
  21. -- empty the queue
  22. for i in 0 to 63 loop
  23. sv_simple_queue.pop(v_data);
  24. assert_equal(v_data, std_logic_vector(to_unsigned(i, 64)));
  25. end loop;
  26. -- check emptiness
  27. assert_true(sv_simple_queue.is_empty, "Queue should be empty!");
  28. report "INFO: t_simple_queue test finished successfully";
  29. wait;
  30. end process SimpleQueueTestP;
  31. ListQueueTestP : process is
  32. variable v_data : std_logic_vector(63 downto 0);
  33. begin
  34. -- check initial emptiness
  35. assert_true(sv_list_queue.is_empty, "Queue should be empty!");
  36. for i in 0 to 63 loop
  37. sv_list_queue.push(std_logic_vector(to_unsigned(i, 64)));
  38. end loop;
  39. -- check that it's full
  40. assert_true(sv_list_queue.is_full, "Queue should be full!");
  41. -- empty the queue
  42. for i in 0 to 63 loop
  43. sv_list_queue.pop(v_data);
  44. assert_equal(v_data, std_logic_vector(to_unsigned(i, 64)));
  45. end loop;
  46. -- check emptiness
  47. assert_true(sv_list_queue.is_empty, "Queue should be empty!");
  48. report "INFO: t_list_queue test finished successfully";
  49. wait;
  50. end process ListQueueTestP;
  51. end architecture sim;