From: Yunsup Lee Date: Wed, 16 Oct 2013 22:10:12 +0000 (-0700) Subject: fix maxvl calc logic X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1276dd07f712ff31068e0a09a52df74b36a70f81;p=riscv-isa-sim.git fix maxvl calc logic --- 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);