From 1276dd07f712ff31068e0a09a52df74b36a70f81 Mon Sep 17 00:00:00 2001 From: Yunsup Lee Date: Wed, 16 Oct 2013 15:10:12 -0700 Subject: [PATCH] fix maxvl calc logic --- hwacha/insns/vsetcfg.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 2.30.2