Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.24 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 10 ns;
  146. --TEST FAKE ENTRANCE
  147.  
  148. --test s0
  149. buttonB<='0';
  150. buttonA<='0';
  151. wait for 10 ns;
  152. buttonB<='0';
  153. buttonA<='1';
  154. wait for 10 ns;
  155. --test s1
  156. buttonA<='0';
  157. wait for 10 ns;
  158. --timeover<='1';
  159. sensorA<='0';
  160. sensorC<='0';
  161. wait for 20 ns;
  162. --timeover<='0';
  163. wait for 10 ns;
  164. --TEST ALARM
  165. --test s0
  166. buttonB<='0';
  167. buttonA<='0';
  168. wait for 10 ns;
  169. buttonB<='0';
  170. buttonA<='1';
  171. wait for 10 ns;
  172. --test s1
  173. sensorA<='1';
  174. buttonA<='0';
  175. wait for 10 ns;
  176. sensorC<='1';
  177. sensorA<='0';
  178. wait for 10 ns;
  179. --test s2
  180. sensorC<='1';
  181. wait for 10 ns;
  182. sensorC<='1';
  183. md_detection<='1';
  184. wait for 10 ns;
  185. --test s4
  186. sensorC<='1';
  187. md_detection<='1';
  188. wait for 10 ns;
  189. sensorC<='0';
  190. md_detection<='0';
  191. sensorA<='1';
  192. wait for 10 ns;
  193. sensorC<='0';
  194. md_detection<='0';
  195. sensorA<='0';
  196. wait for 10 ns;
  197.  
  198. --test B to A
  199.  
  200. --test s0
  201. buttonB<='0';
  202. buttonA<='0';
  203. wait for 10 ns;
  204. buttonB<='1';
  205. wait for 10 ns;
  206. --test s5
  207. buttonB<='0';
  208. sensorB<='1';
  209. wait for 10 ns;
  210. --test s6
  211. sensorC<='1';
  212. wait for 10 ns;
  213. --timeover<='1';
  214. wait for 10 ns;
  215. --test s7
  216. sensorC<='1';
  217. sensorA<='0';
  218. --timeover<='0';
  219. wait for 10 ns;
  220. sensorC<='0';
  221. sensorA<='1';
  222. wait for 10 ns;
  223. sensorC<='0';
  224. sensorA<='0';
  225. wait for 10 ns;
  226.  
  227. --FAKE EXIT
  228.  
  229. --test s0
  230. buttonB<='0';
  231. buttonA<='0';
  232. wait for 10 ns;
  233. buttonB<='1';
  234. wait for 10 ns;
  235. --test s5
  236. buttonB<='0';
  237. wait for 10 ns;
  238. sensorB<='0';
  239. --timeover<='1';
  240. sensorC<='0';
  241. wait for 10 ns;
  242. --timeover<='0';
  243. wait for 10 ns;
  244. wait;
  245. end process;
  246.  
  247. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement