-
Notifications
You must be signed in to change notification settings - Fork 0
/
tb_ID.sv
76 lines (72 loc) · 2.89 KB
/
tb_ID.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
/*
┌──────────────────────────────────────┐
│ ┌─────────────────────┼─────
│ │ [31:0] │
│ ┌─────┐ │DIn ┌─────────┐ │
│ │ │rd └────► │r1 │
│ │ ├─────────► Reg ├──────┼────►
│ │ D │rs1[4:0] │ File │ │
│ │ ├─────────► │r2 │
│ │ E │rs2[4:0] │ ├──────┼────►
Data │ │ ├─────────► │ │
─────┼────► C │ │ Wr│ │
[31:0]│ │ │ └──────▲──┘ │
│ │ O │ │ │
│ │ │Instruction │ │
│ │ D ├──────────┐ │ │
│ │ │ [31:0] │ │ │
│ │ E │ │ │ │
│ │ │ ┌──▼───┐ │ │
│ │ R │Opcode│ │ │ │ [31:0]
│ │ ├┬─────► Ext ├──┼─────────┼────►Immediate
│ │ ││[6:0]│ │ │ │ Value
│ └┬──┬─┘│ └──────┘ │ │
│ │ │ │ │ │
└──────┼──┼──┼───────────────┼─────────┘
▼ ▼ ▼ ▼ WriteEn
F3 F7 Opcode
*/
module tb_ID(data_tb, f3_tb, f7_tb, opcode_tb, WrEn_tb, Imm_tb, r1_tb, r2_tb, DIn_tb, clk_tb);
output logic [31:0] data_tb;
input logic [2:0] f3_tb;
input logic [6:0] f7_tb;
input logic [6:0] opcode_tb;
output bit WrEn_tb;
output bit clk_tb;
input logic [31:0] Imm_tb;
input logic [31:0] r1_tb;
input logic [31:0] r2_tb;
output logic [31:0] DIn_tb;
logic [31:0] inst_tb;
logic [4:0] rs1_tb;
logic [4:0] rs2_tb;
logic [4:0] rd_tb;
ID uut (.data(data_tb),
.f3(f3_tb),
.f7(f7_tb),
.opcode(opcode_tb),
.WrEn(WrEn_tb),
.Imm(Imm_tb),
.r1(r1_tb),
.r2(r2_tb),
.DIn(DIn_tb),
.clk(clk_tb));
always
begin
clk_tb = 0;
#1;
clk_tb = 1;
#1;
end
initial
begin
$dumpfile("dump.vcd");
$dumpvars(0, tb_ID);
//#1 data_tb = 32'h00848933;
#1 data_tb = 32'h13590913;
#1 WrEn_tb = 1;
#1 DIn_tb = 32'h0182a223;
#1 $finish;
end
endmodule
// https://www.edaplayground.com/x/Xwvw