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.

70 lines
1.8 KiB

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