@@ -29,18 +29,20 @@ void vectorUnit_t::vectorUnit_t::reset()
29
29
30
30
reg_t vectorUnit_t::vectorUnit_t::set_vl (int rd, int rs1, reg_t reqVL, reg_t newType)
31
31
{
32
- int new_vlmul = 0 ;
33
32
if (vtype->read () != newType) {
33
+ int new_vlmul = int8_t (extract64 (newType, 0 , 3 ) << 5 ) >> 5 ;
34
+ auto old_vlmax = vlmax;
35
+
34
36
vsew = 1 << (extract64 (newType, 3 , 3 ) + 3 );
35
- new_vlmul = int8_t (extract64 (newType, 0 , 3 ) << 5 ) >> 5 ;
36
37
vflmul = new_vlmul >= 0 ? 1 << new_vlmul : 1.0 / (1 << -new_vlmul);
37
38
vlmax = (VLEN/vsew) * vflmul;
38
39
vta = extract64 (newType, 6 , 1 );
39
40
vma = extract64 (newType, 7 , 1 );
40
41
41
42
vill = !(vflmul >= 0.125 && vflmul <= 8 )
42
43
|| vsew > std::min (vflmul, 1 .0f ) * ELEN
43
- || (newType >> 8 ) != 0 ;
44
+ || (newType >> 8 ) != 0
45
+ || (rd == 0 && rs1 == 0 && old_vlmax != vlmax);
44
46
45
47
if (vill) {
46
48
vlmax = 0 ;
@@ -54,7 +56,7 @@ reg_t vectorUnit_t::vectorUnit_t::set_vl(int rd, int rs1, reg_t reqVL, reg_t new
54
56
if (vlmax == 0 ) {
55
57
vl->write_raw (0 );
56
58
} else if (rd == 0 && rs1 == 0 ) {
57
- vl-> write_raw ( std::min (vl-> read (), vlmax));
59
+ ; // retain current VL
58
60
} else if (rd != 0 && rs1 == 0 ) {
59
61
vl->write_raw (vlmax);
60
62
} else if (rs1 != 0 ) {
0 commit comments