Support fence as nop

Previously, the "fence" instruction was throwing an illegal instruction
exception. Now fence is handled as "nop", i.e. effectively ignored.

Ignoring fence is OK in the current system setup with no caches, and
will need to be reconsidered once caches are added.
This commit is contained in:
Philipp Wagner 2019-02-25 10:53:01 +00:00
parent ef8acb38a9
commit 923fb624b0
2 changed files with 16 additions and 1 deletions

View file

@ -452,6 +452,21 @@ module ibex_decoder #(
// //
////////////////////////////////////////////////
OPCODE_MISC_MEM: begin
// For now, treat the fence (funct3 == 000) instruction as a nop.
// This may not be correct in a system with caches and should be
// revisited.
// fence.i (funct3 == 001) was moved to a separate Zifencei extension
// in the RISC-V ISA spec proposed for ratification, so we treat it as
// an illegal instruction.
if (instr_rdata_i[14:12] == 3'b000) begin
alu_operator_o = ALU_ADD; // nop
regfile_we = 1'b0;
end else begin
illegal_insn_o = 1'b1;
end
end
OPCODE_SYSTEM: begin
if (instr_rdata_i[14:12] == 3'b000) begin
// non CSR related SYSTEM instructions

View file

@ -33,7 +33,7 @@ package ibex_defines;
////////////////////////////////////////////////
parameter OPCODE_SYSTEM = 7'h73;
parameter OPCODE_FENCE = 7'h0f;
parameter OPCODE_MISC_MEM = 7'h0f;
parameter OPCODE_OP = 7'h33;
parameter OPCODE_OPIMM = 7'h13;
parameter OPCODE_STORE = 7'h23;