Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_unsigned.all;
  4.  
  5. entity registar_tb is
  6. end registar_tb;
  7.  
  8. architecture Test_tb of registar_tb is
  9. signal sARITH : std_logic;
  10. signal sLOAD : std_logic;
  11. signal sDATA: std_logic_vector(7 downto 0);
  12. signal sSHL : std_logic;
  13. signal sSHR : std_logic;
  14. signal sCLK : std_logic;
  15. signal sRST: std_logic;
  16. signal sSHREG : std_logic_vector(7 downto 0);
  17.  
  18.  
  19. component registar
  20. port(
  21. iARITH: in std_logic;
  22. iLOAD: in std_logic;
  23. iDATA: in std_logic_vector(7 downto 0);
  24. iSHL: in std_logic;
  25. iSHR: in std_logic;
  26. iCLK: in std_logic;
  27. iRST: in std_logic;
  28. oSHREG: out std_logic_vector(7 downto 0)
  29. );
  30. end component;
  31.  
  32. constant iCLK_PERIOD: time:=10ns;
  33.  
  34.  
  35. begin -- instanciranje i mapiranje glavnih portova i signala
  36. uut : registar port map (
  37. iARITH => sARITH,
  38. iLOAD => sLOAD,
  39. iDATA => sDATA,
  40. iSHL=>sSHL,
  41. iSHR=>sSHR,
  42. iCLK=>sCLK,
  43. iRST=>sRST,
  44. oSHREG=>sSHREG
  45. );
  46.  
  47. iCLK_process: process
  48. begin
  49. sCLK<='0';
  50. wait for iCLK_period/2;
  51. sCLK<='1';
  52. wait for iCLK_period/2;
  53.  
  54.  
  55. end process;
  56.  
  57.  
  58. stimulus : process
  59. begin
  60.  
  61. --sEN<='1';
  62. sRST <= '1';
  63. wait for 5.25 * iCLK_period;
  64.  
  65. sDATA<="11010011";
  66. sRST<='0';
  67. sLOAD<='0';
  68. sARITH<='1';
  69. sSHL<='1';
  70. sSHR<='0';
  71. wait for 100 ns;
  72.  
  73. sDATA<="11010011";
  74. sRST<='0';
  75. sLOAD<='0';
  76. sARITH<='0';
  77. sSHL<='1';
  78. sSHR<='0';
  79. wait for 100 ns;
  80.  
  81. sDATA<="11010011";
  82. sRST<='0';
  83. sLOAD<='0';
  84. sARITH<='1';
  85. sSHL<='0';
  86. sSHR<='1';
  87. wait for 100 ns;
  88.  
  89. sDATA<="11010011";
  90. sRST<='0';
  91. sLOAD<='0';
  92. sARITH<='0';
  93. sSHL<='0';
  94. sSHR<='1';
  95. wait for 100 ns;
  96.  
  97. sDATA<="11010011";
  98. sRST<='0';
  99. sLOAD<='0';
  100. sARITH<='1';
  101. sSHL<='1';
  102. sSHR<='1';
  103. wait for 100 ns;
  104.  
  105. sDATA<="11010011";
  106. sRST<='0';
  107. sLOAD<='0';
  108. sARITH<='1';
  109. sSHL<='0';
  110. sSHR<='0';
  111. wait for 100 ns;
  112.  
  113.  
  114.  
  115. sRST<='0';
  116. sLOAD<='1';
  117.  
  118.  
  119. wait;
  120. end process stimulus;
  121. end architecture;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement