Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.94 KB | None | 0 0
  1. --------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 10:35:16 01/29/2020
  6. -- Design Name:
  7. -- Module Name: /home/speaker/xilinx/14.7/ISE_DS/progetto_Td/prog_td_tb.vhd
  8. -- Project Name: progetto_Td
  9. -- Target Device:
  10. -- Tool versions:
  11. -- Description:
  12. --
  13. -- VHDL Test Bench Created by ISE for module: progetto_TD_vhdl
  14. --
  15. -- Dependencies:
  16. --
  17. -- Revision:
  18. -- Revision 0.01 - File Created
  19. -- Additional Comments:
  20. --
  21. -- Notes:
  22. -- This testbench has been automatically generated using types std_logic and
  23. -- std_logic_vector for the ports of the unit under test. Xilinx recommends
  24. -- that these types always be used for the top-level I/O of a design in order
  25. -- to guarantee that the testbench will bind correctly to the post-implementation
  26. -- simulation model.
  27. --------------------------------------------------------------------------------
  28. LIBRARY ieee;
  29. USE ieee.std_logic_1164.ALL;
  30.  
  31. -- Uncomment the following library declaration if using
  32. -- arithmetic functions with Signed or Unsigned values
  33. USE ieee.numeric_std.ALL;
  34.  
  35. ENTITY prog_td_tb IS
  36. END prog_td_tb;
  37.  
  38. ARCHITECTURE behavior OF prog_td_tb IS
  39.  
  40. -- Component Declaration for the Unit Under Test (UUT)
  41.  
  42. COMPONENT progetto_TD_vhdl
  43. PORT(
  44. buttonA : IN std_logic;
  45. buttonB : IN std_logic;
  46. sensorA : IN std_logic;
  47. sensorB : IN std_logic;
  48. sensorC : IN std_logic;
  49. md_detection : IN std_logic;
  50. doorA : OUT std_logic;
  51. doorB : OUT std_logic;
  52. alarm : OUT std_logic;
  53. clk : IN std_logic;
  54. rst : IN std_logic
  55. );
  56. END COMPONENT;
  57.  
  58.  
  59. --Inputs
  60. signal buttonA : std_logic := '0';
  61. signal buttonB : std_logic := '0';
  62. signal sensorA : std_logic := '0';
  63. signal sensorB : std_logic := '0';
  64. signal sensorC : std_logic := '0';
  65. signal md_detection : std_logic := '0';
  66. signal clk : std_logic := '0';
  67. signal rst : std_logic := '0';
  68. --signal timeover : std_logic :='0'; --aggiunto-----------------------------------
  69.  
  70. --Outputs
  71. signal doorA : std_logic;
  72. signal doorB : std_logic;
  73. signal alarm : std_logic;
  74.  
  75. -- Clock period definitions
  76. constant clk_period : time := 10 ns;
  77.  
  78. BEGIN
  79.  
  80. -- Instantiate the Unit Under Test (UUT)
  81. uut: progetto_TD_vhdl PORT MAP (
  82. buttonA => buttonA,
  83. buttonB => buttonB,
  84. sensorA => sensorA,
  85. sensorB => sensorB,
  86. sensorC => sensorC,
  87. md_detection => md_detection,
  88. doorA => doorA,
  89. doorB => doorB,
  90. alarm => alarm,
  91. clk => clk,
  92. rst => rst
  93. );
  94.  
  95. -- Clock process definitions
  96. clk_process :process
  97. begin
  98. clk <= '0';
  99. wait for clk_period/2;
  100. clk <= '1';
  101. wait for clk_period/2;
  102. end process;
  103.  
  104.  
  105. -- Stimulus process
  106. stim_proc: process
  107. begin
  108. -- hold reset state for 100 ns
  109. rst<='1';
  110. wait for 10 ns;
  111. rst<='0';
  112. wait for 10 ns;
  113. wait for clk_period*10;
  114.  
  115. -- insert stimulus here
  116. -- --A TO B
  117. -- --test so
  118. buttonB<='0';
  119. buttonA<='0';
  120. wait for 10 ns;
  121. buttonB<='0';
  122. buttonA<='1';
  123. wait for 10 ns;
  124. --test s1
  125. sensorA<='1';
  126. buttonA<='0';
  127. wait for 10 ns;
  128. sensorC<='1';
  129. sensorA<='0';
  130. wait for 10 ns;
  131. --test s2
  132. sensorC<='1';
  133. wait for 10 ns;
  134. sensorC<='1';
  135. md_detection<='0';
  136. wait for 10 ns;
  137. --test s3
  138. sensorC<='1';
  139. wait for 10 ns;
  140. sensorC<='0';
  141. sensorB<='1';
  142. wait for 10 ns;
  143. sensorC<='0';
  144. sensorB<='0';
  145. wait for 30 ns;
  146.  
  147. --TEST ALARM
  148.  
  149. --test s0
  150. buttonB<='0';
  151. buttonA<='0';
  152. wait for 10 ns;
  153. buttonB<='0';
  154. buttonA<='1';
  155. wait for 10 ns;
  156. --test s1
  157. buttonA<='0';
  158. wait for 10 ns;
  159. sensorA<='0';
  160. sensorC<='1';
  161. wait for 10 ns;
  162. --test s2
  163. md_detection<='1';
  164. wait for 10 ns;
  165. --test s4
  166. md_detection<='0';
  167. sensorC<='0';
  168. md_detection<='0';
  169. sensorA<='0';
  170. wait for 30 ns;
  171.  
  172. --TEST FAKE ENTRY
  173. --test s0
  174. buttonB<='0';
  175. buttonA<='0';
  176. wait for 120 ns;
  177. buttonB<='0';
  178. buttonA<='1';
  179. wait for 10 ns;
  180. --test s1
  181. buttonA<='0';
  182. sensorC<='0';
  183. sensorA<='0';
  184. wait for 30 ns;
  185.  
  186.  
  187. --test B to A
  188.  
  189. --test s0
  190. buttonB<='0';
  191. buttonA<='0';
  192. wait for 10 ns;
  193. buttonB<='1';
  194. wait for 10 ns;
  195. --test s5
  196. buttonB<='0';
  197. sensorB<='1';
  198. wait for 10 ns;
  199. --test s5
  200. sensorC<='1';
  201. sensorB<='0';
  202. wait for 10 ns;
  203. --test s6
  204. wait for 30 ns;
  205. --test s7
  206. sensorC<='1';
  207. sensorA<='0';
  208. wait for 10 ns;
  209. sensorC<='0';
  210. sensorA<='1';
  211. wait for 10 ns;
  212. sensorC<='0';
  213. sensorA<='0';
  214. wait for 30 ns;
  215.  
  216. --FAKE EXIT
  217.  
  218. --test s0
  219. buttonB<='0';
  220. buttonA<='0';
  221. wait for 10 ns;
  222. buttonB<='1';
  223. wait for 10 ns;
  224. --test s5
  225. buttonB<='0';
  226. wait for 10 ns;
  227. sensorB<='0';
  228. sensorC<='0';
  229. wait for 30 ns;
  230. wait;
  231. end process;
  232.  
  233. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement