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.

83 lines
2.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_simple_queue : work.QueueP.t_simple_queue;
  8. shared variable sv_list_queue : work.QueueP.t_list_queue;
  9. begin
  10. SimpleQueueTestP : process is
  11. variable v_data : std_logic_vector(63 downto 0);
  12. begin
  13. -- check initial emptiness
  14. assert sv_simple_queue.is_empty
  15. report "ERROR: queue should be empty!"
  16. severity failure;
  17. for i in 0 to 63 loop
  18. sv_simple_queue.push(std_logic_vector(to_unsigned(i, 64)));
  19. end loop;
  20. -- check that it's full
  21. assert sv_simple_queue.is_full
  22. report "ERROR: queue should be full!"
  23. severity failure;
  24. -- empty the queue
  25. for i in 0 to 63 loop
  26. sv_simple_queue.pop(v_data);
  27. assert v_data = std_logic_vector(to_unsigned(i, 64))
  28. report "ERROR: read data should be " & integer'image(i) &
  29. " instead of " & integer'image(to_integer(unsigned(v_data)))
  30. severity failure;
  31. end loop;
  32. -- check emptiness
  33. assert sv_simple_queue.is_empty
  34. report "ERROR: queue should be empty!"
  35. severity failure;
  36. report "INFO: t_simple_queue test finished successfully";
  37. wait;
  38. end process SimpleQueueTestP;
  39. ListQueueTestP : process is
  40. variable v_data : std_logic_vector(63 downto 0);
  41. begin
  42. -- check initial emptiness
  43. assert sv_list_queue.is_empty
  44. report "ERROR: queue should be empty!"
  45. severity failure;
  46. for i in 0 to 63 loop
  47. sv_list_queue.push(std_logic_vector(to_unsigned(i, 64)));
  48. end loop;
  49. -- check that it's full
  50. assert sv_list_queue.is_full
  51. report "ERROR: queue should be full!"
  52. severity failure;
  53. -- empty the queue
  54. for i in 0 to 63 loop
  55. sv_list_queue.pop(v_data);
  56. assert v_data = std_logic_vector(to_unsigned(i, 64))
  57. report "ERROR: read data should be " & integer'image(i) &
  58. " instead of " & integer'image(to_integer(unsigned(v_data)))
  59. severity failure;
  60. end loop;
  61. -- check emptiness
  62. assert sv_list_queue.is_empty
  63. report "ERROR: queue should be empty!"
  64. severity failure;
  65. report "INFO: t_list_queue test finished successfully";
  66. wait;
  67. end process ListQueueTestP;
  68. end architecture sim;