aboutsummaryrefslogtreecommitdiff
path: root/hwacha
diff options
context:
space:
mode:
authorYunsup Lee <yunsup@cs.berkeley.edu>2013-10-16 15:10:12 -0700
committerYunsup Lee <yunsup@cs.berkeley.edu>2013-10-16 15:10:12 -0700
commit1276dd07f712ff31068e0a09a52df74b36a70f81 (patch)
tree492a5bcc15c2d5503e37f2572c19023d35034601 /hwacha
parentda579c14c98f72bdc210ac7dc070ae85d6ce6d1e (diff)
downloadriscv-isa-sim-1276dd07f712ff31068e0a09a52df74b36a70f81.zip
riscv-isa-sim-1276dd07f712ff31068e0a09a52df74b36a70f81.tar.gz
riscv-isa-sim-1276dd07f712ff31068e0a09a52df74b36a70f81.tar.bz2
fix maxvl calc logic
Diffstat (limited to 'hwacha')
-rw-r--r--hwacha/insns/vsetcfg.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/hwacha/insns/vsetcfg.h b/hwacha/insns/vsetcfg.h
index 8ca408c..a5fd959 100644
--- a/hwacha/insns/vsetcfg.h
+++ b/hwacha/insns/vsetcfg.h
@@ -4,6 +4,10 @@ uint32_t nfpr = ((XS1 >> 6) & 0x3f) + ((insn.i_imm() >> 6) & 0x3f);
// raise trap when nxpr/nfpr is larger than possible
WRITE_NXPR(nxpr);
WRITE_NFPR(nfpr);
-uint32_t maxvl = 8 * (256 / (nxpr-1 + nfpr));
+uint32_t maxvl;
+if (nxpr + nfpr < 2)
+ maxvl = 8 * 256;
+else
+ maxvl = 8 * (256 / (nxpr-1 + nfpr));
WRITE_MAXVL(maxvl);
WRITE_VL(0);