From 6ace3fa83601cdf6b5e19eea84166b02f9cb88ba Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Sun, 24 May 2020 21:06:06 -0700 Subject: rvv: add missing lmul/vsew/elen checking Signed-off-by: Chih-Min Chao --- riscv/processor.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/riscv/processor.cc b/riscv/processor.cc index 9db3f6a..b67c54a 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -391,7 +391,12 @@ reg_t processor_t::vectorUnit_t::set_vl(int rd, int rs1, reg_t reqVL, reg_t newT vma = BITS(newType, 7, 7); vediv = 1 << BITS(newType, 9, 8); - vill = !(vflmul >= 0.125 && vflmul <= 8) || vsew > ELEN || vediv != 1 || (newType >> 8) != 0; + vill = !(vflmul >= 0.125 && vflmul <= 8) + || vsew > ELEN + || vflmul < ((float)vsew / ELEN) + || vediv != 1 + || (newType >> 8) != 0; + if (vill) { vlmax = 0; vtype = UINT64_MAX << (p->get_xlen() - 1); -- cgit v1.1