plctlab / plct-gem5

upstream: https://github.com/RALC88/gem5
BSD 3-Clause "New" or "Revised" License
31 stars 14 forks source link

Widening vector instructions vd and vs constraint related bug #30

Open KKKHHHLLL opened 1 year ago

KKKHHHLLL commented 1 year ago

In the execution function of Vwaddu_vxMicro, the vd and vs overlap constraint check is conducted as follows: const uint32_t num_microops = 1 << std::max<int64_t>(0, vtype_vlmul(machInst.vtype8) + 1);

if ((machInst.vs2 <= machInst.vd) && (machInst.vd < (machInst.vs2 + num_microops - 1))) {
    // A destination vector register group can overlap a source vector
    // register group if The destination EEW is greater than the source
    // EEW, the source EMUL is at least 1, and the overlap is in the
    // highest- numbered part of the destination register group.
    std::string error =
        csprintf("Unsupported overlap in Vs2 and Vd for Widening op");
    return std::make_shared<IllegalInstFault>(error, machInst);
}

But the num_microops calculated here actually is the EMUL of destination vector register group, and it's added up with source vector index vs2 to check overlap. The add by 1 operation in calculating num_microops should be cancled.

ksco commented 1 year ago

@jerinjoy Hi, can you take a look at this?