3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-05 05:49:15 +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; return bit;
} }
RTLIL::SigSpec operator()(RTLIL::SigSpec sig) const RTLIL::SigSpec operator()(const RTLIL::SigSpec &sig) const
{ {
apply(sig); RTLIL::SigSpec result;
return sig; for (RTLIL::SigBit bit : sig) {
apply(bit);
result.append(bit);
}
return result;
} }
RTLIL::SigSpec operator()(RTLIL::Wire *wire) const RTLIL::SigSpec operator()(RTLIL::Wire *wire) const