-
Notifications
You must be signed in to change notification settings - Fork 24
/
wrapper.sv
63 lines (55 loc) · 1.52 KB
/
wrapper.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
module rvfi_wrapper (
input clock,
input reset,
`RVFI_OUTPUTS
);
(* keep *) wire trap;
(* keep *) `rvformal_rand_reg mem_ready;
(* keep *) `rvformal_rand_reg [31:0] mem_rdata;
(* keep *) wire mem_valid;
(* keep *) wire mem_instr;
(* keep *) wire [31:0] mem_addr;
(* keep *) wire [31:0] mem_wdata;
(* keep *) wire [3:0] mem_wstrb;
picorv32 #(
.COMPRESSED_ISA(1),
.ENABLE_FAST_MUL(1),
.ENABLE_DIV(1),
.BARREL_SHIFTER(1)
) uut (
.clk (clock ),
.resetn (!reset ),
.trap (trap ),
.mem_valid (mem_valid),
.mem_instr (mem_instr),
.mem_ready (mem_ready),
.mem_addr (mem_addr ),
.mem_wdata (mem_wdata),
.mem_wstrb (mem_wstrb),
.mem_rdata (mem_rdata),
`RVFI_CONN
);
`ifdef PICORV32_FAIRNESS
reg [2:0] mem_wait = 0;
always @(posedge clock) begin
mem_wait <= {mem_wait, mem_valid && !mem_ready};
assume (~mem_wait || trap);
end
`endif
`ifdef PICORV32_CSR_RESTRICT
always @* begin
if (rvfi_valid && rvfi_insn[6:0] == 7'b1110011) begin
if (rvfi_insn[14:12] == 3'b010) begin
assume (rvfi_insn[31:20] == 12'hC00 || rvfi_insn[31:20] == 12'hC01 || rvfi_insn[31:20] == 12'hC02 ||
rvfi_insn[31:20] == 12'hC80 || rvfi_insn[31:20] == 12'hC81 || rvfi_insn[31:20] == 12'hC82);
assume (rvfi_insn[19:15] == 0);
end
assume (rvfi_insn[14:12] != 3'b001);
assume (rvfi_insn[14:12] != 3'b011);
assume (rvfi_insn[14:12] != 3'b101);
assume (rvfi_insn[14:12] != 3'b110);
assume (rvfi_insn[14:12] != 3'b111);
end
end
`endif
endmodule