DFF input can be constant

This commit is contained in:
Miodrag Milanovic 2025-01-15 17:02:51 +01:00
parent a2e5ded5a6
commit 1adda174de
2 changed files with 11 additions and 3 deletions

View File

@ -128,7 +128,6 @@ void updateSR_INV(Context *ctx, CellInfo *cell, IdString port, IdString param)
void updateMUX_INV(Context *ctx, CellInfo *cell, IdString port, IdString param, int bit)
{
if (cell->params.count(param) == 0) return;
unsigned init_val = int_or_default(cell->params, param);
WireId pin_wire = ctx->getBelPinWire(cell->bel, port);
for (PipId pip : ctx->getPipsUphill(pin_wire)) {

View File

@ -358,12 +358,21 @@ void GateMatePacker::pack_cpe()
CellInfo &ci = *cell.second;
if (!ci.type.in(id_CC_DFF))
continue;
ci.renamePort(id_D, id_IN1);
ci.renamePort(id_Q, id_OUT2);
ci.params[id_O2] = Property(0b00, 2);
ci.params[id_2D_IN] = Property(1, 1);
NetInfo *d_net = ci.getPort(id_D);
if (d_net->name == ctx->id("$PACKER_GND")) {
ci.params[id_INIT_L00] = Property(0b0000, 4);
ci.disconnectPort(id_D);
} else if (d_net->name == ctx->id("$PACKER_VCC")) {
ci.params[id_INIT_L00] = Property(0b1111, 4);
ci.disconnectPort(id_D);
} else {
ci.params[id_INIT_L00] = Property(0b1010, 4);
}
ci.params[id_INIT_L10] = Property(0b1010, 4);
ci.renamePort(id_D, id_IN1);
NetInfo *en_net = ci.getPort(id_EN);
bool invert = int_or_default(ci.params, id_EN_INV, 0) == 1;