-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecoder_tb.v
More file actions
78 lines (69 loc) · 1.82 KB
/
Decoder_tb.v
File metadata and controls
78 lines (69 loc) · 1.82 KB
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
// Testbench for msrv32_decoder 21BCE0289
module Testbench_Decoder;
reg trap_taken_in;
reg funct7_5_in;
reg [6:0] opcode_in;
reg [2:0] funct3_in;
reg [1:0] iadder_out_1_to_0_in;
wire [2:0] wb_mux_sel_out;
wire [2:0] imm_type_out;
wire [2:0] csr_op_out;
wire mem_wr_req_out;
wire [3:0] alu_opcode_out;
wire [1:0] load_size_out;
wire load_unsigned_out;
wire alu_src_out;
wire iadder_src_out;
wire csr_wr_en_out;
wire rf_wr_en_out;
wire illegal_instr_out;
wire misaligned_load_out;
wire misaligned_store_out;
msrv32_decoder Decoder(
.trap_taken_in(trap_taken_in),
.funct7_5_in(funct7_5_in),
.opcode_in(opcode_in),
.funct3_in(funct3_in),
.iadder_out_1_to_0_in(iadder_out_1_to_0_in),
.wb_mux_sel_out(wb_mux_sel_out),
.imm_type_out(imm_type_out),
.csr_op_out(csr_op_out),
.mem_wr_req_out(mem_wr_req_out),
.alu_opcode_out(alu_opcode_out),
.load_size_out(load_size_out),
.load_unsigned_out(load_unsigned_out),
.alu_src_out(alu_src_out),
.iadder_src_out(iadder_src_out),
.csr_wr_en_out(csr_wr_en_out),
.rf_wr_en_out(rf_wr_en_out),
.illegal_instr_out(illegal_instr_out),
.misaligned_load_out(misaligned_load_out),
.misaligned_store_out(misaligned_store_out)
);
initial begin
trap_taken_in = 0;
funct7_5_in = 1;
opcode_in = 7'b011_0011;
funct3_in = 3'b110;
iadder_out_1_to_0_in = 2'b01;
#10;
iadder_out_1_to_0_in = 2'b00;
#10;
iadder_out_1_to_0_in = 2'b01;
funct7_5_in = 0;
opcode_in = 7'b000_0011;
funct3_in = 3'b001;
#10;
funct3_in = 3'b010;
#10;
opcode_in = 7'b110_0111;
funct3_in = 3'b000;
#10;
opcode_in = 7'b111_1111;
#10;
$stop;
end
always@(*) begin
$display($time, "ns: trap_taken_in: %b, funct7_5_in: %b, opcode_in: %b, funct3_in: %b, iadder_out_1_to_0_in: %b", trap_taken_in, funct7_5_in, opcode_in, funct3_in, iadder_out_1_to_0_in);
end
endmodule