machxo2: Finish implementing Wire API functions. nextpnr segfaults on example with constraints.

This commit is contained in:
William D. Jones 2021-01-28 03:24:52 -05:00 committed by gatecat
parent 861c12e6eb
commit 722d1f2542
2 changed files with 43 additions and 12 deletions

View File

@ -300,14 +300,6 @@ WireId Arch::getWireByName(IdString name) const
return ret;
}
NetInfo *Arch::getBoundWireNet(WireId wire) const { return nullptr; }
NetInfo *Arch::getConflictingWireNet(WireId wire) const { return nullptr; }
const std::vector<BelPin> &Arch::getWireBelPins(WireId wire) const { return bel_pin_dummy; }
const std::vector<WireId> &Arch::getWires() const { return wire_id_dummy; }
// ---------------------------------------------------------------
PipId Arch::getPipByName(IdString name) const

View File

@ -682,12 +682,51 @@ struct Arch : BaseCtx
return wire_to_net.find(wire) == wire_to_net.end() || wire_to_net.at(wire) == nullptr;
}
NetInfo *getBoundWireNet(WireId wire) const;
NetInfo *getBoundWireNet(WireId wire) const
{
NPNR_ASSERT(wire != WireId());
if (wire_to_net.find(wire) == wire_to_net.end())
return nullptr;
else
return wire_to_net.at(wire);
}
WireId getConflictingWireWire(WireId wire) const { return wire; }
NetInfo *getConflictingWireNet(WireId wire) const;
NetInfo *getConflictingWireNet(WireId wire) const
{
NPNR_ASSERT(wire != WireId());
if (wire_to_net.find(wire) == wire_to_net.end())
return nullptr;
else
return wire_to_net.at(wire);
}
DelayInfo getWireDelay(WireId wire) const { return DelayInfo(); }
const std::vector<WireId> &getWires() const;
const std::vector<BelPin> &getWireBelPins(WireId wire) const;
WireRange getWires() const
{
WireRange range;
range.b.cursor_tile = 0;
range.b.cursor_index = -1;
range.b.chip = chip_info;
++range.b; //-1 and then ++ deals with the case of no wries in the first tile
range.e.cursor_tile = chip_info->width * chip_info->height;
range.e.cursor_index = 0;
range.e.chip = chip_info;
return range;
}
BelPinRange getWireBelPins(WireId wire) const
{
BelPinRange range;
NPNR_ASSERT(wire != WireId());
range.b.ptr = tileInfo(wire)->wire_data[wire.index].bel_pins.get();
range.b.wire_loc = wire.location;
range.e.ptr = range.b.ptr + tileInfo(wire)->wire_data[wire.index].num_bel_pins;
range.e.wire_loc = wire.location;
return range;
}
// Pips
PipId getPipByName(IdString name) const;