1 // See LICENSE for license details.
3 reg_t
FN(processor_t
* p
, insn_t s_insn
, reg_t pc
)
6 reg_t npc
= sext_xlen(pc
+ insn_length(INSNCODE
));
7 // messy way to do it: insn_t is used elsewhere in a union,
8 // so a workaround is to grab the bits from the insn_t
9 // and create an sv-variant. also an opportunity to pass
10 // in the loop index (voffs) which will be added on to
11 // any registers that are marked as "vectorised"
12 insn_bits_t bits
= s_insn
.bits();
15 // need to know if register is used as float or int.
16 // REGS_PATTERN is generated by id_regs.py (per opcode)
17 unsigned int floatintmap
= REGS_PATTERN
;
18 sv_insn_t
insn(bits
, floatintmap
);
20 // identify which regs have had their CSR entries set as vectorised.
21 // really could do with a macro for-loop here... oh well...
22 // integer ops, RD, RS1, RS2, RS3 (use sv_int_tb)
25 check_reg(true, s_insn
.rd()) |
28 check_reg(true, s_insn
.rs1()) |
31 check_reg(true, s_insn
.rs2()) |
34 check_reg(true, s_insn
.rs3()) |
36 // fp ops, RD, RS1, RS2, RS3 (use sv_fp_tb)
38 check_reg(false, s_insn
.frd()) |
41 check_reg(false, s_insn
.frs1()) |
44 check_reg(false, s_insn
.rs2()) |
47 check_reg(false, s_insn
.rs3()) |
49 false; // save a few cycles by |ing the checks together.
51 // if vectorop is set, one of the regs is not a scalar,
52 // so we must read the VL CSR and do a loop
55 // TODO: vlen = p->CSR(SIMPLEV_VL); // something like that...
57 for (int voffs
=0; voffs
< vlen
; voffs
++)
60 insn
.reset_caches(); // ready to increment offsets in next iteration
66 trace_opcode(p
, INSNCODE
, insn
);