init DFF only when needed

This commit is contained in:
Miodrag Milanovic 2025-01-16 10:28:41 +01:00
parent 1adda174de
commit fb9471aced

View File

@ -443,13 +443,16 @@ void GateMatePacker::pack_cpe()
ci.unsetParam(id_SR_VAL); ci.unsetParam(id_SR_VAL);
ci.unsetParam(id_SR_INV); ci.unsetParam(id_SR_INV);
bool init = int_or_default(ci.params, id_INIT, 0) == 1; if (ci.params.count(id_INIT) && ci.params[id_INIT].is_fully_def()) {
if (init) bool init = int_or_default(ci.params, id_INIT, 0) == 1;
ci.params[id_FF_INIT] = Property(0b11, 2); if (init)
else ci.params[id_FF_INIT] = Property(0b11, 2);
ci.params[id_FF_INIT] = Property(0b10, 2); else
ci.unsetParam(id_INIT); ci.params[id_FF_INIT] = Property(0b10, 2);
ci.unsetParam(id_INIT);
} else {
ci.unsetParam(id_INIT);
}
ci.type = id_CPE; ci.type = id_CPE;
} }
} }