Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. `timescale 1ns / 1ps
- 2.
- 3. module EleCont_Test;
- 4.
- 5. // Inputs
- 6. reg clk;
- 7. reg reset;
- 8. reg [11:0] nRFB;
- 9. reg [9:1] nIB1;
- 10. reg [9:1] nIB2;
- 11.
- 12. // Outputs
- 13. wire [2:0] currentFloor1;
- 14. wire [2:0] currentFloor2;
- 15. wire [1:0] currentDirection1;
- 16. wire [1:0] currentDirection2;
- 17. wire [11:0] currentRealFloorButton;
- 18. wire [9:1] currentInternalButton1;
- 19. wire [9:1] currentInternalButton2;
- 20. wire doorState1;
- 21. wire doorState2;
- 22.
- 23. // Instantiate the Unit Under Test (UUT)
- 24. ElevatorController#(40,40,0) uut
- 25. (
- 26. .clk(clk),
- 27. .reset(reset),
- 28. .newRealFloorButton(nRFB),
- 29. .newInternalButton1(nIB1),
- 30. .newInternalButton2(nIB2),
- 31. .currentFloor1(currentFloor1),
- 32. .currentFloor2(currentFloor2),
- 33. .currentDirection1(currentDirection1),
- 34. .currentDirection2(currentDirection2),
- 35. .currentRealFloorButton(currentRealFloorButton),
- 36. .currentInternalButton1(currentInternalButton1),
- 37. .currentInternalButton2(currentInternalButton2),
- 38. .doorState1(doorState1),
- 39. .doorState2(doorState2),
- 40. );
- 41.
- 42.
- 43. initial begin
- 44. clk = 0;
- 45. reset = 1;
- 46. nRFB = 0;
- 47. nIB1 = 0;
- 48. nIB2 = 0;
- 49. #10000; //after 10 us
- 50. reset = 0;
- 51.
- 52. #10000; //after 20 us
- 53. nRFB = 12'b0_00_01_01_00_00_1;//1
- 54. #100;
- 55. nRFB = 0;
- 56.
- 57. #20000;//after 40 us
- 58. nIB1 = 9'b00_000_1010;//2
- 59. nIB2 = 9'b00_000_1001;//2
- 60. #100;
- 61. nIB1 = 0;//2
- 62. nIB2 = 0;//2
- 63.
- 64. #20000;//after 60 us
- 65. nIB1 = 9'b10_000_0010;//3
- 66. nIB2 = 9'b00_001_0010;//3
- 67. nRFB = 12'b1_00_00_01_00_10_0;//3
- 68. #100;
- 69. nIB1 = 0;//3
- 70. nIB2 = 0;//3
- 71. nRFB = 0;//3
- 72.
- 73. #10000;//after 70 us
- 74. nRFB = 12'b0_10_00_00_01_00_0;//4
- 75. #100;
- 76. nRFB = 0;
- 77.
- 78. #30000;//after 100 us
- 79. nIB1 = 9'b00_000_0101;//5
- 80. nIB2 = 9'b10_000_1001;//5
- 81. nRFB = 12'b0_00_00_00_00_10_0;//5
- 82. #100;
- 83. nIB1 = 0;
- 84. nIB2 = 0;
- 85. nRFB = 0;
- 86.
- 87. #20000;//after 120 us
- 88. nIB1 = 9'b00_000_0100;//6
- 89. nRFB = 12'b0_00_00_10_00_01_0;//6
- 90. #100;
- 91. nIB1 = 0;
- 92. nRFB = 0;
- 93.
- 94. #40000;//after 160 us
- 95. nIB1 = 9'b00_000_0100;//7
- 96. nIB2 = 9'b00_000_0100;
- 97. nRFB = 12'b0_00_11_00_01_00_0;
- 98. #100;
- 99. nIB1 = 0;
- 100. nIB2 = 0;
- 101. nRFB = 0;
- 102.
- 103. #40000;//after 200 us
- 104. nIB1 = 9'b10_000_1010;//8
- 105. nIB2 = 9'b00_001_1000;
- 106. nRFB = 12'b0_00_00_00_10_00_0;
- 107. #100;
- 108. nIB1 = 0;
- 109. nIB2 = 0;
- 110. nRFB = 0;
- 111.
- 112. #10000;//after 210 us
- 113. nIB1 = 9'b00_000_0100;//9
- 114. nRFB = 12'b1_00_00_10_00_11_0;
- 115. #100;
- 116. nIB1 = 0;
- 117. nRFB = 0;
- 118.
- 119. #20000; //after 230 us
- 120. nIB1 = 9'b00_001_0100;//10
- 121. nIB2 = 9'b00_001_0000;
- 122. #100;
- 123. nIB1 = 0;
- 124. nIB2 = 0;
- 125.
- 126. #100000;//after 330 us
- 127. nIB2 = 9'b10_000_0000;//11
- 128. nRFB = 12'b0_00_01_00_01_10_0;
- 129. #100;
- 130. nIB2 = 0;
- 131. nRFB = 0;
- 132.
- 133. #10000;//after 340 us
- 134. nRFB = 12'b0_00_00_01_00_10_0;//12
- 135. #100;
- 136. nRFB = 0;
- 137.
- 138. #10000;//after 350 us
- 139. nIB1 = 9'b00_000_0001;//13
- 140. nIB2 = 9'b00_000_1001;
- 141. #100;
- 142. nIB1 = 0;
- 143. nIB2 = 0;
- 144.
- 145. #10000;//after 360 us
- 146. nIB2 = 9'b00_000_1001;//14
- 147. #100;
- 148. nIB2 = 0;
- 149.
- 150. #20000;//after 390 us
- 151. nRFB = 12'b0_00_00_00_01_10_0;//15
- 152. #100;
- 153. nRFB = 0;
- 154.
- 155. #20000;//after 410 us
- 156. nIB1 = 9'b00_001_0000;//16
- 157. nRFB = 12'b0_00_00_01_00_00_0;
- 158. #100;
- 159. nIB1 = 0;
- 160. nRFB = 0;
- 161.
- 162. #200000;
- 163. $finish;
- 164. end
- 165.
- 166. always begin
- 167. #25 clk = ~clk;
- 168. end
- 169.
- 170. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement