-
Notifications
You must be signed in to change notification settings - Fork 0
/
testbench.sv
58 lines (41 loc) · 875 Bytes
/
testbench.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
`include "alucodes.sv"
module testbench;
logic clk, reset, ready;
logic [7:0] sw;
logic [7:0] LED;
picomips p1 (.*);
initial
begin
clk= '0;
forever #1ns clk = ~clk;
end
initial
begin
//sw [8] = 1'b0;
ready = 1'b0;
reset = 1'b0;
#50ns reset = 1'b1;
#50ns ready = 1'b0;
sw [7:0] = 8'b00000100;
#50ns ready = 1'b1;
#50ns ready = 1'b0;
sw[7:0] = 8'b00001000;
#50ns ready = 1'b1;
// wait 0, calculate and display x2
#100ns ready = 1'b0;
// wait 1 and display y2
#100ns ready = 1'b1;
#50ns ready = 1'b0;
#50ns ready = 1'b0;
sw [7:0] = 8'b00000101;
#50ns ready = 1'b1;
#50ns ready = 1'b0;
sw[7:0] = 8'b00001010;
#50ns ready = 1'b1;
// wait 0, calculate and display x2
#100ns ready = 1'b0;
// wait 1 and display y2
#100ns ready = 1'b1;
#50ns ready = 1'b0;
end
endmodule