sv_reg_entry sv_int_tb[NXPR];
sv_reg_entry sv_fp_tb[NFPR];
sv_pred_csr_entry sv_pred_csrs[SV_CSR_SZ];
-sv_pred_entry sv_pred_tb[NXPR];
+sv_pred_entry sv_pred_int_tb[NXPR];
+sv_pred_entry sv_pred_fp_tb[NFPR];
bool sv_check_reg(bool intreg, uint64_t reg)
{
return reg;
}
+/* gets the predication value (if active). returns all-1s if not active
+ * also returns whether zeroing is enabled/disabled for this register.
+ *
+ * uses the same sort of lookup logic as remap:
+ *
+ * - first thing to note is, there is one CSR table for FP and one for INT
+ * (so, FP regs can be predicated separately from INT ones)
+ * - redirection occurs if the CSR entry for the register is "active".
+ * - inversion of the predication can be set (so it's possible to have
+ * the same actual register value be unchanged yet be referred to by
+ * *TWO* redirections, one with inversion, one with not).
+ *
+ * note that this function *actually* returns the value of the (integer)
+ * register file, hence why processor_t has to be passed in
+ *
+ * note also that *even scalar* ops will be predicated (i.e. if a register
+ * has been set active=true and isvec=false in sv_int_tb or sv_fp_tb).
+ * the way to ensure that scalar ops are not predicated is: set VLEN=0,
+ * set active=false in sv_int_tb/sv_fp_tb for that register, or switch off
+ * the predication for that register (sv_pred_int_tb/sv_pred_fb_tb).
+ *
+ * note also that the hard limit on SV maximum vector length is actually
+ * down to the number of bits in the predication i.e. the bitwidth of integer
+ * registers (i.e. XLEN bits).
+ */
+reg_t sv_insn_t::predicate(processor_t *p, uint64_t reg,
+ bool intreg, bool &zeroing)
+{
+ sv_pred_entry *r;
+ if (intreg)
+ {
+ r = &sv_pred_int_tb[reg];
+ }
+ else
+ {
+ r = &sv_pred_fp_tb[reg];
+ }
+ if (!r->active)
+ {
+ return ~0x0; // not active: return all-1s (unconditional "on")
+ }
+ zeroing = r->zero;
+ reg = r->regidx;
+ reg_t predicate = READ_REG(reg); // macros go through processor_t state
+ if (r->inv)
+ {
+ return ~predicate;
+ }
+ return predicate;
+}
unsigned int active: 1; // enabled=1, disabled=0
} sv_pred_entry;
-// 32 entries, only integer regs are predicates.
-extern sv_pred_entry sv_pred_tb[NXPR];
+// 32 entries
+extern sv_pred_entry sv_pred_int_tb[NXPR];
+extern sv_pred_entry sv_pred_fp_tb[NFPR];
bool sv_check_reg(bool intreg, uint64_t reg);