diff --git a/machxo2/arch.cc b/machxo2/arch.cc index 0b6b448e..5d1cb0cb 100644 --- a/machxo2/arch.cc +++ b/machxo2/arch.cc @@ -34,7 +34,7 @@ NEXTPNR_NAMESPACE_BEGIN Arch::Arch(ArchArgs args) : chipName("generic"), args(args) { // Dummy for empty decals - decal_graphics[IdString()]; + // decal_graphics[IdString()]; } // ----------------------------------------------------------------------- @@ -80,8 +80,6 @@ bool Arch::isAvailable(ArchArgs::ArchArgsTypes chip) { return get_chip_info(chip BelId Arch::getBelByName(IdString name) const { - if (bels.count(name)) - return name; return BelId(); } @@ -89,21 +87,17 @@ IdString Arch::getBelName(BelId bel) const { return bel; } Loc Arch::getBelLocation(BelId bel) const { - auto &info = bels.at(bel); - return Loc(info.x, info.y, info.z); + return Loc(); } BelId Arch::getBelByLocation(Loc loc) const { - auto it = bel_by_loc.find(loc); - if (it != bel_by_loc.end()) - return it->second; return BelId(); } -const std::vector &Arch::getBelsByTile(int x, int y) const { return bels_by_tile.at(x).at(y); } +const std::vector &Arch::getBelsByTile(int x, int y) const { return bel_id_dummy; } -bool Arch::getBelGlobalBuf(BelId bel) const { return bels.at(bel).gb; } +bool Arch::getBelGlobalBuf(BelId bel) const { return false; } uint32_t Arch::getBelChecksum(BelId bel) const { @@ -113,47 +107,36 @@ uint32_t Arch::getBelChecksum(BelId bel) const void Arch::bindBel(BelId bel, CellInfo *cell, PlaceStrength strength) { - bels.at(bel).bound_cell = cell; - cell->bel = bel; - cell->belStrength = strength; - refreshUiBel(bel); + } void Arch::unbindBel(BelId bel) { - bels.at(bel).bound_cell->bel = BelId(); - bels.at(bel).bound_cell->belStrength = STRENGTH_NONE; - bels.at(bel).bound_cell = nullptr; - refreshUiBel(bel); + } -bool Arch::checkBelAvail(BelId bel) const { return bels.at(bel).bound_cell == nullptr; } +bool Arch::checkBelAvail(BelId bel) const { return false; } -CellInfo *Arch::getBoundBelCell(BelId bel) const { return bels.at(bel).bound_cell; } +CellInfo *Arch::getBoundBelCell(BelId bel) const { return nullptr; } -CellInfo *Arch::getConflictingBelCell(BelId bel) const { return bels.at(bel).bound_cell; } +CellInfo *Arch::getConflictingBelCell(BelId bel) const { return nullptr; } -const std::vector &Arch::getBels() const { return bel_ids; } +const std::vector &Arch::getBels() const { return bel_id_dummy; } -IdString Arch::getBelType(BelId bel) const { return bels.at(bel).type; } +IdString Arch::getBelType(BelId bel) const { return IdString(); } -const std::map &Arch::getBelAttrs(BelId bel) const { return bels.at(bel).attrs; } +const std::map &Arch::getBelAttrs(BelId bel) const { return attrs_dummy; } WireId Arch::getBelPinWire(BelId bel, IdString pin) const { - const auto &bdata = bels.at(bel); - if (!bdata.pins.count(pin)) - log_error("bel '%s' has no pin '%s'\n", bel.c_str(this), pin.c_str(this)); - return bdata.pins.at(pin).wire; + return WireId(); } -PortType Arch::getBelPinType(BelId bel, IdString pin) const { return bels.at(bel).pins.at(pin).type; } +PortType Arch::getBelPinType(BelId bel, IdString pin) const { return PortType(); } std::vector Arch::getBelPins(BelId bel) const { std::vector ret; - for (auto &it : bels.at(bel).pins) - ret.push_back(it.first); return ret; } @@ -161,16 +144,14 @@ std::vector Arch::getBelPins(BelId bel) const WireId Arch::getWireByName(IdString name) const { - if (wires.count(name)) - return name; return WireId(); } -IdString Arch::getWireName(WireId wire) const { return wire; } +IdString Arch::getWireName(WireId wire) const { return IdString(); } -IdString Arch::getWireType(WireId wire) const { return wires.at(wire).type; } +IdString Arch::getWireType(WireId wire) const { return IdString(); } -const std::map &Arch::getWireAttrs(WireId wire) const { return wires.at(wire).attrs; } +const std::map &Arch::getWireAttrs(WireId wire) const { return attrs_dummy; } uint32_t Arch::getWireChecksum(WireId wire) const { @@ -180,51 +161,36 @@ uint32_t Arch::getWireChecksum(WireId wire) const void Arch::bindWire(WireId wire, NetInfo *net, PlaceStrength strength) { - wires.at(wire).bound_net = net; - net->wires[wire].pip = PipId(); - net->wires[wire].strength = strength; - refreshUiWire(wire); + } void Arch::unbindWire(WireId wire) { - auto &net_wires = wires.at(wire).bound_net->wires; - auto pip = net_wires.at(wire).pip; - if (pip != PipId()) { - pips.at(pip).bound_net = nullptr; - refreshUiPip(pip); - } - - net_wires.erase(wire); - wires.at(wire).bound_net = nullptr; - refreshUiWire(wire); } -bool Arch::checkWireAvail(WireId wire) const { return wires.at(wire).bound_net == nullptr; } +bool Arch::checkWireAvail(WireId wire) const { return false; } -NetInfo *Arch::getBoundWireNet(WireId wire) const { return wires.at(wire).bound_net; } +NetInfo *Arch::getBoundWireNet(WireId wire) const { return nullptr; } -NetInfo *Arch::getConflictingWireNet(WireId wire) const { return wires.at(wire).bound_net; } +NetInfo *Arch::getConflictingWireNet(WireId wire) const { return nullptr; } -const std::vector &Arch::getWireBelPins(WireId wire) const { return wires.at(wire).bel_pins; } +const std::vector &Arch::getWireBelPins(WireId wire) const { return bel_pin_dummy; } -const std::vector &Arch::getWires() const { return wire_ids; } +const std::vector &Arch::getWires() const { return wire_id_dummy; } // --------------------------------------------------------------- PipId Arch::getPipByName(IdString name) const { - if (pips.count(name)) - return name; return PipId(); } -IdString Arch::getPipName(PipId pip) const { return pip; } +IdString Arch::getPipName(PipId pip) const { return IdString(); } -IdString Arch::getPipType(PipId pip) const { return pips.at(pip).type; } +IdString Arch::getPipType(PipId pip) const { return IdString(); } -const std::map &Arch::getPipAttrs(PipId pip) const { return pips.at(pip).attrs; } +const std::map &Arch::getPipAttrs(PipId pip) const { return attrs_dummy; } uint32_t Arch::getPipChecksum(PipId wire) const { @@ -234,70 +200,57 @@ uint32_t Arch::getPipChecksum(PipId wire) const void Arch::bindPip(PipId pip, NetInfo *net, PlaceStrength strength) { - WireId wire = pips.at(pip).dstWire; - pips.at(pip).bound_net = net; - wires.at(wire).bound_net = net; - net->wires[wire].pip = pip; - net->wires[wire].strength = strength; - refreshUiPip(pip); - refreshUiWire(wire); + } void Arch::unbindPip(PipId pip) { - WireId wire = pips.at(pip).dstWire; - wires.at(wire).bound_net->wires.erase(wire); - pips.at(pip).bound_net = nullptr; - wires.at(wire).bound_net = nullptr; - refreshUiPip(pip); - refreshUiWire(wire); + } -bool Arch::checkPipAvail(PipId pip) const { return pips.at(pip).bound_net == nullptr; } +bool Arch::checkPipAvail(PipId pip) const { return false; } -NetInfo *Arch::getBoundPipNet(PipId pip) const { return pips.at(pip).bound_net; } +NetInfo *Arch::getBoundPipNet(PipId pip) const { return nullptr; } -NetInfo *Arch::getConflictingPipNet(PipId pip) const { return pips.at(pip).bound_net; } +NetInfo *Arch::getConflictingPipNet(PipId pip) const { return nullptr; } -WireId Arch::getConflictingPipWire(PipId pip) const { return pips.at(pip).bound_net ? pips.at(pip).dstWire : WireId(); } +WireId Arch::getConflictingPipWire(PipId pip) const { return WireId(); } -const std::vector &Arch::getPips() const { return pip_ids; } +const std::vector &Arch::getPips() const { return pip_id_dummy; } -Loc Arch::getPipLocation(PipId pip) const { return pips.at(pip).loc; } +Loc Arch::getPipLocation(PipId pip) const { return Loc(); } -WireId Arch::getPipSrcWire(PipId pip) const { return pips.at(pip).srcWire; } +WireId Arch::getPipSrcWire(PipId pip) const { return WireId(); } -WireId Arch::getPipDstWire(PipId pip) const { return pips.at(pip).dstWire; } +WireId Arch::getPipDstWire(PipId pip) const { return WireId(); } -DelayInfo Arch::getPipDelay(PipId pip) const { return pips.at(pip).delay; } +DelayInfo Arch::getPipDelay(PipId pip) const { return DelayInfo(); } -const std::vector &Arch::getPipsDownhill(WireId wire) const { return wires.at(wire).downhill; } +const std::vector &Arch::getPipsDownhill(WireId wire) const { return pip_id_dummy; } -const std::vector &Arch::getPipsUphill(WireId wire) const { return wires.at(wire).uphill; } +const std::vector &Arch::getPipsUphill(WireId wire) const { return pip_id_dummy; } -const std::vector &Arch::getWireAliases(WireId wire) const { return wires.at(wire).aliases; } +const std::vector &Arch::getWireAliases(WireId wire) const { return pip_id_dummy; } // --------------------------------------------------------------- -GroupId Arch::getGroupByName(IdString name) const { return name; } +GroupId Arch::getGroupByName(IdString name) const { return GroupId(); } -IdString Arch::getGroupName(GroupId group) const { return group; } +IdString Arch::getGroupName(GroupId group) const { return IdString(); } std::vector Arch::getGroups() const { std::vector ret; - for (auto &it : groups) - ret.push_back(it.first); return ret; } -const std::vector &Arch::getGroupBels(GroupId group) const { return groups.at(group).bels; } +const std::vector &Arch::getGroupBels(GroupId group) const { return bel_id_dummy; } -const std::vector &Arch::getGroupWires(GroupId group) const { return groups.at(group).wires; } +const std::vector &Arch::getGroupWires(GroupId group) const { return wire_id_dummy; } -const std::vector &Arch::getGroupPips(GroupId group) const { return groups.at(group).pips; } +const std::vector &Arch::getGroupPips(GroupId group) const { return pip_id_dummy; } -const std::vector &Arch::getGroupGroups(GroupId group) const { return groups.at(group).groups; } +const std::vector &Arch::getGroupGroups(GroupId group) const { return group_id_dummy; } // --------------------------------------------------------------- @@ -317,23 +270,6 @@ ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const { ArcBounds bb; - int src_x = wires.at(src).x; - int src_y = wires.at(src).y; - int dst_x = wires.at(dst).x; - int dst_y = wires.at(dst).y; - - bb.x0 = src_x; - bb.y0 = src_y; - bb.x1 = src_x; - bb.y1 = src_y; - - auto extend = [&](int x, int y) { - bb.x0 = std::min(bb.x0, x); - bb.x1 = std::max(bb.x1, x); - bb.y0 = std::min(bb.y0, y); - bb.y1 = std::max(bb.y1, y); - }; - extend(dst_x, dst_y); return bb; } @@ -373,83 +309,43 @@ bool Arch::route() const std::vector &Arch::getDecalGraphics(DecalId decal) const { - if (!decal_graphics.count(decal)) { - std::cerr << "No decal named " << decal.str(this) << std::endl; - log_error("No decal named %s!\n", decal.c_str(this)); - } - return decal_graphics.at(decal); + return graphic_element_dummy; } -DecalXY Arch::getBelDecal(BelId bel) const { return bels.at(bel).decalxy; } +DecalXY Arch::getBelDecal(BelId bel) const { return DecalXY(); } -DecalXY Arch::getWireDecal(WireId wire) const { return wires.at(wire).decalxy; } +DecalXY Arch::getWireDecal(WireId wire) const { return DecalXY(); } -DecalXY Arch::getPipDecal(PipId pip) const { return pips.at(pip).decalxy; } +DecalXY Arch::getPipDecal(PipId pip) const { return DecalXY(); } -DecalXY Arch::getGroupDecal(GroupId group) const { return groups.at(group).decalxy; } +DecalXY Arch::getGroupDecal(GroupId group) const { return DecalXY(); } // --------------------------------------------------------------- bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayInfo &delay) const { - if (!cellTiming.count(cell->name)) - return false; - const auto &tmg = cellTiming.at(cell->name); - auto fnd = tmg.combDelays.find(CellDelayKey{fromPort, toPort}); - if (fnd != tmg.combDelays.end()) { - delay = fnd->second; - return true; - } else { - return false; - } + return false; } // Get the port class, also setting clockPort if applicable TimingPortClass Arch::getPortTimingClass(const CellInfo *cell, IdString port, int &clockInfoCount) const { - if (!cellTiming.count(cell->name)) - return TMG_IGNORE; - const auto &tmg = cellTiming.at(cell->name); - if (tmg.clockingInfo.count(port)) - clockInfoCount = int(tmg.clockingInfo.at(port).size()); - else - clockInfoCount = 0; - return get_or_default(tmg.portClasses, port, TMG_IGNORE); + return TMG_IGNORE; } TimingClockingInfo Arch::getPortClockingInfo(const CellInfo *cell, IdString port, int index) const { - NPNR_ASSERT(cellTiming.count(cell->name)); - const auto &tmg = cellTiming.at(cell->name); - NPNR_ASSERT(tmg.clockingInfo.count(port)); - return tmg.clockingInfo.at(port).at(index); + return TimingClockingInfo(); } bool Arch::isValidBelForCell(CellInfo *cell, BelId bel) const { - std::vector cells; - cells.push_back(cell); - Loc loc = getBelLocation(bel); - for (auto tbel : getBelsByTile(loc.x, loc.y)) { - if (tbel == bel) - continue; - CellInfo *bound = getBoundBelCell(tbel); - if (bound != nullptr) - cells.push_back(bound); - } - return cellsCompatible(cells.data(), int(cells.size())); + return false; } bool Arch::isBelLocationValid(BelId bel) const { - std::vector cells; - Loc loc = getBelLocation(bel); - for (auto tbel : getBelsByTile(loc.x, loc.y)) { - CellInfo *bound = getBoundBelCell(tbel); - if (bound != nullptr) - cells.push_back(bound); - } - return cellsCompatible(cells.data(), int(cells.size())); + return false; } #ifdef WITH_HEAP @@ -474,24 +370,7 @@ void Arch::assignArchInfo() bool Arch::cellsCompatible(const CellInfo **cells, int count) const { - const NetInfo *clk = nullptr; - int group = -1; - for (int i = 0; i < count; i++) { - const CellInfo *ci = cells[i]; - if (ci->is_slice && ci->slice_clk != nullptr) { - if (clk == nullptr) - clk = ci->slice_clk; - else if (clk != ci->slice_clk) - return false; - } - if (ci->user_group != -1) { - if (group == -1) - group = ci->user_group; - else if (group != ci->user_group) - return false; - } - } - return true; + return false; } NEXTPNR_NAMESPACE_END diff --git a/machxo2/arch.h b/machxo2/arch.h index b8b9ce85..063eb164 100644 --- a/machxo2/arch.h +++ b/machxo2/arch.h @@ -159,28 +159,15 @@ struct Arch : BaseCtx { std::string chipName; - std::unordered_map wires; - std::unordered_map pips; - std::unordered_map bels; - std::unordered_map groups; - - // These functions include useful errors if not found - WireInfo &wire_info(IdString wire); - PipInfo &pip_info(IdString wire); - BelInfo &bel_info(IdString wire); - - std::vector bel_ids, wire_ids, pip_ids; - + // Placeholders to be removed. std::unordered_map bel_by_loc; - std::vector>> bels_by_tile; - - std::unordered_map> decal_graphics; - - int gridDimX, gridDimY; - std::vector> tileBelDimZ; - std::vector> tilePipDimZ; - - std::unordered_map cellTiming; + std::vector bel_id_dummy; + std::vector bel_pin_dummy; + std::vector wire_id_dummy; + std::vector pip_id_dummy; + std::vector group_id_dummy; + std::vector graphic_element_dummy; + std::map attrs_dummy; // --------------------------------------------------------------- // Common Arch API. Every arch must provide the following methods. @@ -192,14 +179,14 @@ struct Arch : BaseCtx std::string getChipName() const { return chipName; } - IdString archId() const { return id("generic"); } + IdString archId() const { return id("machxo2"); } ArchArgs archArgs() const { return args; } IdString archArgsToId(ArchArgs args) const { return id("none"); } - int getGridDimX() const { return gridDimX; } - int getGridDimY() const { return gridDimY; } - int getTileBelDimZ(int x, int y) const { return tileBelDimZ[x][y]; } - int getTilePipDimZ(int x, int y) const { return tilePipDimZ[x][y]; } + int getGridDimX() const { return 0; } + int getGridDimY() const { return 0; } + int getTileBelDimZ(int x, int y) const { return 0; } + int getTilePipDimZ(int x, int y) const { return 0; } BelId getBelByName(IdString name) const; IdString getBelName(BelId bel) const;