3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-03 13:07:58 +00:00

Avoid unnecessary copying when applying a SigMap to a SigSpec

Currently we duplicate the `SigSpec` first and then iterate over the
duplicate, updating its bits. Instead just generate new bits and add
them to an empty `SigSpec`.
This commit is contained in:
Robert O'Callahan 2025-09-02 02:10:15 +00:00
parent e49f9765a2
commit f4617104b6

View file

@ -259,10 +259,14 @@ struct SigMapView
return bit;
}
RTLIL::SigSpec operator()(RTLIL::SigSpec sig) const
RTLIL::SigSpec operator()(const RTLIL::SigSpec &sig) const
{
apply(sig);
return sig;
RTLIL::SigSpec result;
for (RTLIL::SigBit bit : sig) {
apply(bit);
result.append(bit);
}
return result;
}
RTLIL::SigSpec operator()(RTLIL::Wire *wire) const