ice40: Fix BEL validity check for PLL vs SB_IO

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2018-11-18 19:21:41 +01:00
parent 9483a95a4a
commit c219d8fe4d

View File

@ -114,31 +114,30 @@ bool Arch::isValidBelForCell(CellInfo *cell, BelId bel) const
// Find shared PLL by looking for driving bel siblings from D_IN_0 // Find shared PLL by looking for driving bel siblings from D_IN_0
// that are a PLL clock output. // that are a PLL clock output.
auto wire = getBelPinWire(bel, id_D_IN_0); auto wire = getBelPinWire(bel, id_D_IN_0);
IdString pll_bel_pin;
BelId pll_bel;
for (auto pin : getWireBelPins(wire)) { for (auto pin : getWireBelPins(wire)) {
if (pin.pin == id_PLLOUT_A || pin.pin == id_PLLOUT_B) { if (pin.pin == id_PLLOUT_A || pin.pin == id_PLLOUT_B) {
pll_bel = pin.bel; // Is there a PLL there ?
pll_bel_pin = pin.pin; auto pll_cell = getBoundBelCell(pin.bel);
break; if (pll_cell == nullptr)
} break;
}
// Is there a PLL that shares this IO buffer? // Is that port actually used ?
if (pll_bel.index != -1) { if ((pin.pin == id_PLLOUT_B) && !is_sb_pll40_dual(this, pll_cell))
auto pll_cell = getBoundBelCell(pll_bel); break;
// Is a PLL placed in this PLL bel?
if (pll_cell != nullptr) { // Is that SB_IO used at an input ?
// Is the shared port driving a net? if ((cell->ports[id_D_IN_0].net == nullptr) && (cell->ports[id_D_IN_1].net == nullptr))
auto pi = pll_cell->ports[pll_bel_pin]; break;
if (pi.net != nullptr) {
// Are we perhaps a PAD INPUT Bel that can be placed here? // Are we perhaps a PAD INPUT Bel that can be placed here?
if (pll_cell->attrs[id("BEL_PAD_INPUT")] == getBelName(bel).str(this)) { if (pll_cell->attrs[id("BEL_PAD_INPUT")] == getBelName(bel).str(this))
return true; return true;
}
return false; // Conflict
} return false;
} }
} }
Loc ioLoc = getBelLocation(bel); Loc ioLoc = getBelLocation(bel);
Loc compLoc = ioLoc; Loc compLoc = ioLoc;
compLoc.z = 1 - compLoc.z; compLoc.z = 1 - compLoc.z;