-
Notifications
You must be signed in to change notification settings - Fork 0
/
tb_Instruction_Register.sv
85 lines (70 loc) · 1.24 KB
/
tb_Instruction_Register.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
module tb_Instruction_Register ();
parameter IR_SIZE = 4;
wire [IR_SIZE -1: 0] data_out;
reg [IR_SIZE -1: 0] data_in;
reg scan_in;
wire scan_out;
reg ShiftIR, ClockIR, UpdateIR, reset_bar;
Instruction_Register M0 (
.data_in(data_in),
.data_out(data_out),
.scan_in(scan_in),
.scan_out(scan_out),
.ShiftIR(ShiftIR),
.ClockIR(ClockIR),
.UpdateIR(UpdateIR),
.reset_bar(reset_bar)
);
initial begin
$fsdbDumpfile("test_cell.fsdb");
$fsdbDumpvars;
end
initial #500 $finish;
initial begin
data_in = 4'HA;
end
initial fork
#5 reset_bar = 0;
#10 reset_bar = 1;
join
initial begin scan_in = 1; end
initial fork
ClockIR = 0;
ShiftIR = 0;
#45 ShiftIR = 1; // Demonstrate scan in
#40
begin
repeat (IR_SIZE) begin
#10 ClockIR = 1;
#10 ClockIR = 0;
end
#5 ShiftIR = 0;
end
join
initial begin
#100
repeat (1) begin
#10
ClockIR = 1;
#10 ClockIR = 0;
end
end
initial fork
UpdateIR = 0;
#150 UpdateIR = 1;
#160 UpdateIR = 0;
#200 ShiftIR = 0;
#200 ClockIR = 1; // Demonstrate parallel load
#210 ClockIR = 0;
join
initial fork
#250 ShiftIR = 1; // Demonstrate scan out
#260
begin
repeat (IR_SIZE) begin
#10 ClockIR = 1;
#10 ClockIR = 0;
end
end
join
endmodule