res.append((os.path.join(insns_dir, fname), insn))
return res
-cintpatterns = [ 'WRITE_RVC_RS1S', 'WRITE_RVC_RS2S',
- 'RVC_RS1', 'RVC_RS2', 'RVC_RS1S', 'RVC_RS2S', ]
-cfloatpatterns = [ 'WRITE_RVC_FRS2S', 'RVC_FRS2 ', 'RVC_FRS2S ']
+cintpatterns = [ 'WRITE_RVC_RS1S', 'WRITE_RVC_RS2S', 'RVC_SP',
+ 'RVC_RS1', 'RVC_RS2', 'RVC_RS1S', 'RVC_RS2S',
+ ]
+cfloatpatterns = [ 'WRITE_RVC_FRS2S', 'RVC_FRS2', 'RVC_FRS2S']
intpatterns = ['WRITE_RD' , 'RS1', 'RS2', 'RS3']
floatpatterns = ['WRITE_FRD', 'FRS1', 'FRS2', 'FRS3']
patterns = intpatterns + floatpatterns
allfloats = floatpatterns + cfloatpatterns
floatmask = (1<<len(allfloats)-1)
-allints = intpatterns + cintpatterns[2:]
+allints = intpatterns + cintpatterns[3:]
skip = '#define USING_NOREGS\n' \
'#define REGS_PATTERN 0x0\n'
-# this matches the order of the 4 predication arguments to
+# this matches the order of the 5 predication arguments to
drlookup = { 'rd': 0, 'frd': 0, 'rs1': 1, 'rs2': 2, 'rs3': 3,
'rvc_rs1': 1, 'rvc_rs1s': 1,
'rvc_rs2': 2, 'rvc_rs2s': 2,
'rvc_frs2': 2, 'rvc_frs2s': 2,
+ 'rvc_sp': 4,
}
def find_registers(fname, insn, twin_predication, immed_offset, is_branch):
# RS1 also matches against RVC_FRS1 (etc.)
# check letter before match: if "_", skip it.
continue
- if 'RVC_' in pattern and f[x+len(pattern)] == 'S':
+ if 'RVC_' in pattern and f[x+len(pattern)-1] == 'S':
# RVC_RS2S also matches against RVC_RS2 (etc.)
# check letter at end of match: if "S", skip it.
continue
return skip
res.append('#define REGS_PATTERN 0x%x' % isintfloat)
- predargs = ['dest_pred'] * 4
+ predargs = ['dest_pred'] * 5
if immed_offset: # C.LWSP
if immed_offset == 'LD':
predargs.append('&src_pred')
res.append('#define SRC_PREDINT %d' % (0 if fsrc else 1))
res.append('#define SRC_REG %s' % found)
- if len(predargs) == 4:
+ if len(predargs) == 5:
predargs.append('NULL')
res.append('#define PRED_ARGS %s' % ','.join(predargs))
// not going to make any difference...
#define DEST_PREDINT 1
#define SRC_PREDINT 1
-#define PRED_ARGS dest_pred,dest_pred,dest_pred,dest_pred,&dest_pred
-#define OFFS_ARGS dest_offs,dest_offs,dest_offs,dest_offs,dest_offs
+#define PRED_ARGS dest_pred,dest_pred,dest_pred,dest_pred,dest_pred,&dest_pred
+#define OFFS_ARGS dest_offs,dest_offs,dest_offs,dest_offs,dest_offs,dest_offs
#else
#define sv_enabled true
#endif
public:
sv_insn_t(processor_t *pr, bool _sv_enabled, insn_bits_t bits, unsigned int f,
uint64_t &p_rd, uint64_t &p_rs1, uint64_t &p_rs2, uint64_t &p_rs3,
- uint64_t *p_im,
- int *o_rd, int *o_rs1, int *o_rs2, int *o_rs3, int *o_imm) :
+ uint64_t &p_sp, uint64_t *p_im,
+ int *o_rd, int *o_rs1, int *o_rs2, int *o_rs3, int *o_sp,
+ int *o_imm) :
insn_t(bits), p(pr), sv_enabled(_sv_enabled), vloop_continue(false),
at_least_one_reg_vectorised(false), fimap(f),
offs_rd(o_rd), offs_rs1(o_rs1), offs_rs2(o_rs2), offs_rs3(o_rs3),
+ offs_sp(o_sp),
offs_imm(o_imm),
- prd(p_rd), prs1(p_rs1), prs2(p_rs2), prs3(p_rs3),
+ prd(p_rd), prs1(p_rs1), prs2(p_rs2), prs3(p_rs3), psp(p_sp),
save_branch_addr(0) {}
uint64_t rvc_imm() { return (insn_t::rvc_imm()); }
uint64_t rvc_rs1s() { return predicated(_rvc_rs1s(), *offs_rs1, prs1); }
uint64_t rvc_rs2 () { return predicated(_rvc_rs2 (), *offs_rs2, prs2); }
uint64_t rvc_rs2s() { return predicated(_rvc_rs2s(), *offs_rs2, prs2); }
+ uint64_t rvc_sp () { return predicated(_rvc_sp (), *offs_sp , psp ); }
uint64_t _rd () { return _remap(insn_t::rd (), fimap & REG_RD , offs_rd); }
uint64_t _rs1() { return _remap(insn_t::rs1(), fimap & REG_RS1, offs_rs1); }
offs_rs2); }
uint64_t _rvc_rs2s() { return _remap(insn_t::rvc_rs2s(), fimap & REG_RVC_RS2S,
offs_rs2); }
+ uint64_t _rvc_sp () { return _remap(2, true, // sp always 2, always int
+ offs_sp); }
void setpc(int xlen, int vlen, reg_t &npc, reg_t addr, uint64_t offs,
reg_t *target_reg);
int *offs_rs1;
int *offs_rs2;
int *offs_rs3;
+ int *offs_sp;
int *offs_imm;
uint64_t &prd;
uint64_t &prs1;
uint64_t &prs2;
uint64_t &prs3;
+ uint64_t &psp;
+
uint64_t save_branch_addr;
uint64_t save_branch_rd;