"vlen %d stop %d pred %lx rdv %lx v %ld rvc2 %ld sp %lx\n",
xstr(INSN), INSNCODE, voffs, *src_offs, *dest_offs,
vlen, insn.stop_vloop(),
- dest_pred & (1<<voffs), READ_REG(insn._rvc_rs2().reg),
- insn._rvc_rs2().reg, insn.rvc_lwsp_imm(), READ_REG(sp.reg));
+ dest_pred & (1<<voffs), READ_REG(insn._rvc_rs2()),
+ insn._rvc_rs2().reg, insn.rvc_lwsp_imm(), READ_REG(sp));
#endif
#ifdef INSN_C_LWSP
fprintf(stderr, "pre %s %x vloop %d %d %d" \
"vlen %d stop %d pred %lx rdv %lx rd %ld rvc2 %ld sp %lx\n",
xstr(INSN), INSNCODE, voffs, *src_offs, *dest_offs,
vlen, insn.stop_vloop(),
- dest_pred & (1<<voffs), READ_REG(insn._rd().reg),
- insn._rd().reg, insn.rvc_lwsp_imm(), READ_REG(sp.reg));
+ dest_pred & (1<<voffs), READ_REG(insn._rd()),
+ insn._rd().reg, insn.rvc_lwsp_imm(), READ_REG(sp));
#endif
#ifdef INSN_C_BEQZ
fprintf(stderr, "pre %s %x vloop %d %ld %d" \
"vlen %d stop %d pred %lx rdv %lx rvc_rs1 %ld\n",
xstr(INSN), INSNCODE, voffs, _target_reg, *dest_offs,
vlen, insn.stop_vloop(),
- dest_pred & (1<<voffs), READ_REG(insn._rvc_rs1s().reg),
+ dest_pred & (1<<voffs), READ_REG(insn._rvc_rs1s()),
insn._rvc_rs1s().reg);
#endif
#include INCLUDEFILE
#if defined(USING_REG_RD)
fprintf(stderr, "reg %s %x vloop %d vlen %d stop %d pred %lx rd%lx\n",
xstr(INSN), INSNCODE, voffs, vlen, insn.stop_vloop(),
- dest_pred & (1<<voffs), READ_REG(insn._rd().reg));
+ dest_pred & (1<<voffs), READ_REG(insn._rd()));
#endif
#if defined(USING_REG_FRD)
fprintf(stderr, "reg %s %x vloop %d vlen %d stop %d pred %lx rd%g\n",
}
vloop_continue = true;
- // aaand now, as it's a "vector", FINALLY we can add on the loop-offset
- // which was passed in to the sv_insn_t constructor (by reference)
- // and, at last, we have "parallelism" a la contiguous registers.
- reg += *voffs; // wheww :)
-
- spec.reg = reg;
+ // aaand now, as it's a "vector", FINALLY we can pass the loop-offset
+ spec.reg = reg + *voffs;
+ spec.offset = voffs;
return spec;
}
}
zeroing = r->zero;
reg = r->regidx;
- reg_t predicate = READ_REG(reg); // macros go through processor_t state
+ reg_spec_t rs = {reg, NULL};
+ reg_t predicate = p->s.READ_REG(rs); // macros go through processor_t state
if (r->inv)
{
return ~predicate;
reg_spec_t sv_insn_t::predicated(reg_spec_t const& spec, uint64_t pred)
{
reg_spec_t res = spec;
+ //if (spec.offset == NULL)
+ //{
+ // return res;
+ //}
if (pred & (1<<(*spec.offset)))
{
return res;
// for use in predicated branches. sets bit N if val=true; clears bit N if false
uint64_t sv_insn_t::rd_bitset(reg_t reg, uint64_t bit, bool set)
{
- uint64_t val = READ_REG(reg);
+ //reg_spec_t rs = {reg, NULL};
+ //uint64_t val = p->s.READ_REG(rs);
+ uint64_t val = STATE.XPR[reg];
if (set) {
val |= (1<<bit);
} else {
return;
}
if (target_reg != NULL) {
+ reg_spec_t rs = {*target_reg, NULL};
fprintf(stderr, "setpc pre rd %ld v %lx pred %lx\n",
- *target_reg, READ_REG(*target_reg), prs1);
+ *target_reg, p->s.READ_REG(rs), prs1);
}
if ((1<<offs) & prs1)
{
}
fprintf(stderr, "setpc %lx offs %ld predicate %lx rs1 %ld rs2 %ld\n",
save_branch_rd, offs, prs1,
- READ_REG(rs1().reg), READ_REG(rs2().reg));
+ p->s.READ_REG(rs1()), p->s.READ_REG(rs2()));
}
uint8_t sv_insn_t::reg_elwidth(reg_t reg, bool intreg)
void (sv_proc_t::WRITE_REG)(reg_spec_t const& spec, sv_reg_t const& value)
{
//WRITE_REG( reg, value ); // XXX TODO: replace properly
- STATE.XPR.write(spec.reg, value);
+ reg_t reg = spec.reg;
+ //if (spec.offset) {
+ // reg += *spec.offset;
+ //}
+ STATE.XPR.write(reg, value);
}
//void (sv_proc_t::WRITE_REG)(reg_t reg, uint64_t value)
}
*/
-/*
-sv_reg_t (sv_proc_t::READ_REG)(uint64_t i)
+reg_t (sv_proc_t::READ_REG)(reg_spec_t const& spec)
{
- return READ_REG ( i );
+ reg_t reg = spec.reg;
+ uint8_t elwidth = _insn->reg_elwidth(reg, true);
+ //if (spec.offset) {
+ // reg += *spec.offset;
+ //}
+ return _insn->p->get_state()->XPR[reg]; // XXX TODO: offset
}
-*/
sv_reg_t sv_proc_t::get_intreg(reg_spec_t const&spec)
{
- uint8_t elwidth = _insn->reg_elwidth(spec.reg, true);
- uint64_t data = _insn->p->get_state()->XPR[spec.reg]; // XXX TODO: offset
+ uint64_t data = READ_REG(spec);
uint8_t bitwidth = _insn->src_bitwidth;
return sv_reg_t(data, xlen, bitwidth);
}
#undef WRITE_RVC_RS2S
#undef WRITE_RVC_FRS2S
#undef WRITE_RD
+#undef READ_REG
#undef RVC_SP
#undef SHAMT
#undef sext_xlen
void (WRITE_FRD)(freg_t value);
void (WRITE_FRD)(float64_t value);
void (WRITE_FRD)(float32_t value);
- //reg_t (READ_REG)(uint64_t i);
+ reg_t (READ_REG)(reg_spec_t const& i);
processor_t *p;
sv_insn_t *_insn;