return get_usv();
}
-sv_shape_t* state_t::get_shape(reg_t reg)
+sv_shape_t* state_t::get_shape(reg_t reg, bool pred)
{
if (prv == PRV_M || prv == PRV_S || reg == 0) {
return NULL;
}
for (int i = 0; i < 3; i++) {
- if (remap[i].regidx == reg) {
+ if (remap[i].regidx == reg && remap[i].pred == pred) {
return &shape[i];
}
}
state.remap[0].regidx = get_field(val, SV_REMAP_REGIDX0);
state.remap[1].regidx = get_field(val, SV_REMAP_REGIDX1);
state.remap[2].regidx = get_field(val, SV_REMAP_REGIDX2);
+ state.remap[0].pred = get_field(val, SV_REMAP_PRED0);
+ state.remap[1].pred = get_field(val, SV_REMAP_PRED1);
+ state.remap[2].pred = get_field(val, SV_REMAP_PRED2);
state.remap[0].shape = get_field(val, SV_REMAP_SHAPE0);
state.remap[1].shape = get_field(val, SV_REMAP_SHAPE1);
state.remap[2].shape = get_field(val, SV_REMAP_SHAPE2);
sv_remap_t remap[3];
sv_shape_t shape[3];
- sv_shape_t *get_shape(reg_t reg);
+ sv_shape_t *get_shape(reg_t reg, bool pred=false);
void sv_csr_reg_unpack();
void sv_csr_pred_unpack();
void get_csr_start_end(int &start, int &end);
}
// 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 sv_insn_t::rd_bitset(reg_t reg, int bit, bool set)
{
- //reg_spec_t rs = {reg, NULL};
- //uint64_t val = p->s.READ_REG(rs);
+ reg_spec_t rs = {reg, &bit};
uint64_t val = STATE.XPR[reg];
if (set) {
- val |= (1<<bit);
+ val |= (1UL<<bit);
} else {
- val &= ~(1<<bit);
+ val &= ~(1UL<<bit);
}
STATE.XPR.write(reg, val);
return val;
fprintf(stderr, "regcsr shuffle %d %d\n", idx, idx+1);
}
sv_csrs[topstack].u = csrval;
- fprintf(stderr, "regcsr set %d %lx\n", topstack, csrval);
+ fprintf(stderr, "regcsr set %d %x\n", topstack, csrval);
return popped;
} else {
sv_csrs[topstack].u = csrval;
- fprintf(stderr, "regcsr set %d %lx\n", topstack, csrval);
+ fprintf(stderr, "regcsr set %d %x\n", topstack, csrval);
return 0;
}
}
typedef struct {
uint64_t regidx: 7; // actual i.e. real register (0-127)
unsigned int shape: 2; // which shape register to use
+ bool pred;
} sv_remap_t;
typedef struct {
} sv_shape_t;
#define SV_REMAP_REGIDX0 (0x7f)
+#define SV_REMAP_PRED0 (0x80)
#define SV_REMAP_REGIDX1 (0x7f<<8)
+#define SV_REMAP_PRED1 (0x800)
#define SV_REMAP_REGIDX2 (0x7f<<16)
+#define SV_REMAP_PRED2 (0x8000)
#define SV_REMAP_SHAPE0 (0x3<<24)
#define SV_REMAP_SHAPE1 (0x3<<26)
#define SV_REMAP_SHAPE2 (0x3<<28)
reg_t *target_reg);
// used for predicated branches. sets bit N if val=true; clears bit N if false
- uint64_t rd_bitset(reg_t reg, uint64_t bit, bool val);
+ uint64_t rd_bitset(reg_t reg, int bit, bool val);
bool sv_check_reg(bool intreg, uint64_t reg);
sv_reg_entry* get_regentry(uint64_t reg, bool isint);
uint8_t b[sizeof(freg_t)*8];
};
-unsigned int sv_proc_t::remap(reg_spec_t const& spec)
+unsigned int sv_proc_t::remap(reg_spec_t const& spec, bool pred)
{
unsigned int offs = *spec.offset;
- sv_shape_t *shape = p->get_state()->get_shape(spec.reg);
+ sv_shape_t *shape = p->get_state()->get_shape(spec.reg, pred);
if (shape == NULL) {
return offs;
}
sv_reg_t to_uint32(sv_freg_t const& reg);
sv_reg_t to_uint32(sv_float32_t const& reg);
- unsigned int remap(reg_spec_t const& regspec);
+ unsigned int remap(reg_spec_t const& regspec, bool pred=false);
bool rv_int_op_prepare(sv_reg_t const & lhs, sv_reg_t const & rhs,
uint64_t &vlhs, uint64_t &vrhs,