diff options
Diffstat (limited to 'src/rv2insn.sv')
| -rw-r--r-- | src/rv2insn.sv | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/rv2insn.sv b/src/rv2insn.sv index aeb7a8d..65abfab 100644 --- a/src/rv2insn.sv +++ b/src/rv2insn.sv @@ -28,12 +28,16 @@ function automatic insn_t halt(); return -1; endfunction -function automatic alu_counter_t next_alu(alu_counter_t alu_counter); - return (alu_counter + 1) % ALU_COUNT; +function automatic alu_counter_t next_alu(alu_counter_t c); + return (c + 1) % ALU_COUNT; endfunction -function automatic decode_out_t op_imm(xlen_t pc, itype_t rv, alu_counter_t alu_counter); - alu_counter_t fu = next_alu(alu_counter); +/** verilator warns about unused bits in rv, not sure how to deal with that. + * Explode itype to the relevant bits? Seems verbose, hmm. */ + +/* verilator lint_off UNUSEDSIGNAL */ +function automatic decode_out_t op_imm(xlen_t pc, itype_t rv, alu_counter_t c); + alu_counter_t fu = next_alu(c); unique case (rv.funct3) 3'b000: return {{`rn(rv.rs1), `alu(fu)}, {NOP, NOP}, @@ -45,9 +49,10 @@ function automatic decode_out_t op_imm(xlen_t pc, itype_t rv, alu_counter_t alu_ return 0; endfunction +/* verilator lint_on */ -function automatic decode_out_t op(xlen_t pc, rtype_t rv, alu_counter_t alu_counter); - alu_counter_t fu = next_alu(alu_counter); +function automatic decode_out_t op(xlen_t pc, rtype_t rv, alu_counter_t c); + alu_counter_t fu = next_alu(c); unique case (rv.funct3) 3'b000: begin unique case (rv.funct7) @@ -69,11 +74,11 @@ function automatic decode_out_t op(xlen_t pc, rtype_t rv, alu_counter_t alu_coun endcase endfunction -function automatic decode_out_t decode(xlen_t pc, rv_t rv, alu_counter_t alu_counter); +function automatic decode_out_t decode(xlen_t pc, rv_t rv, alu_counter_t c); unique case (rv[`RV_OP_FIELD]) - OP_IMM: return op_imm (pc, rv, alu_counter); - OP: return op (pc, rv, alu_counter); - default: return {halt(), alu_counter}; + OP_IMM: return op_imm (pc, rv, c); + OP: return op (pc, rv, c); + default: return {halt(), c}; endcase endfunction @@ -83,13 +88,13 @@ typedef struct packed { } stages_out_t; function automatic stages_out_t stages(int i, xlen_t pc, - rv_t[QUE_DEPTH-1:0] rv, insn_t[QUE_DEPTH-1:0] que, alu_counter_t alu_counter); + rv_t[QUE_DEPTH-1:0] rv, insn_t[QUE_DEPTH-1:0] que, alu_counter_t c); if (i < QUE_DEPTH) begin - decode_out_t out = decode(pc + i, rv[i], alu_counter); + decode_out_t out = decode(pc + i, rv[i], c); que[i] = out.insn; return stages(i + 1, pc, rv, que, out.alu_counter); end else begin - return {que, alu_counter}; + return {que, c}; end endfunction |
