Fix DFF pack

This commit is contained in:
Miodrag Milanovic 2024-12-25 15:48:09 +01:00
parent 4badd8bbbf
commit 5f85167f8c
4 changed files with 29 additions and 5 deletions

View File

@ -115,6 +115,7 @@ X(D)
X(R)
X(S)
X(FF_INIT)
X(2D_IN)
X(CC_BUFG)
X(BUFG)

View File

@ -49,6 +49,25 @@ delay_t GateMateImpl::estimateDelay(WireId src, WireId dst) const
return 100 * (std::abs(dx - sx) / 4 + std::abs(dy - sy) / 4 + 2);
}
bool GateMateImpl::isBelLocationValid(BelId bel, bool explain_invalid) const
{
CellInfo *cell = ctx->getBoundBelCell(bel);
if (cell == nullptr) {
return true;
}
if (ctx->getBelType(bel) == id_CPE) {
Loc loc = ctx->getBelLocation(bel);
int x = loc.x - 2;
int y = loc.y - 2;
if (x<2 || x>167)
return false;
if (y<2 || y>127)
return false;
return true;
}
return true;
}
void GateMateImpl::postRoute()
{
ctx->assignArchInfo();

View File

@ -42,6 +42,7 @@ struct GateMateImpl : HimbaechelAPI
void postRoute() override;
bool isBelLocationValid(BelId bel, bool explain_invalid = false) const override;
delay_t estimateDelay(WireId src, WireId dst) const override;
void drawBel(std::vector<GraphicElement> &g, GraphicElement::style_t style, IdString bel_type, Loc loc) override;

View File

@ -321,14 +321,17 @@ void GateMatePacker::pack_cpe()
if (!ci.type.in(id_CC_DFF))
continue;
ci.renamePort(id_D, id_IN1);
ci.renamePort(id_Q, id_OUT1);
ci.renamePort(id_Q, id_OUT2);
ci.disconnectPort(id_EN);
ci.disconnectPort(id_SR);
ci.params[id_O1] = Property(0b00, 2);
ci.params[id_INIT_L20] = Property(0b1010, 4);
ci.params[id_O2] = Property(0b00, 2);
ci.params[id_2D_IN] = Property(1, 1);
ci.params[id_INIT_L00] = Property(0b1010, 4);
ci.params[id_INIT_L10] = Property(0b1010, 4);
ci.params[id_INIT_L01] = Property(0b1111, 4);
ci.params[id_INIT_L02] = Property(0b1111, 4);
ci.params[id_INIT_L03] = Property(0b1111, 4);
ci.params[id_INIT_L10] = Property(0b1000, 4);
ci.params[id_INIT_L20] = Property(0b1100, 4);
ci.params[id_EN] = Property(0b11, 2);
ci.params[id_R] = Property(0b11, 2);
ci.params[id_S] = Property(0b11, 2);