aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2021-01-28 03:24:52 -0500
committergatecat <gatecat@ds0.me>2021-02-12 10:36:59 +0000
commit722d1f254284638515accc8c1d4562807f6452cc (patch)
tree9df8a5dcd789c8fbd6d9f82fbe19de316a9842d7
parent861c12e6eba1ae1c0d6b1ea0ed27c060b2ceb671 (diff)
downloadnextpnr-722d1f254284638515accc8c1d4562807f6452cc.tar.gz
nextpnr-722d1f254284638515accc8c1d4562807f6452cc.tar.bz2
nextpnr-722d1f254284638515accc8c1d4562807f6452cc.zip
machxo2: Finish implementing Wire API functions. nextpnr segfaults on example with constraints.
-rw-r--r--machxo2/arch.cc8
-rw-r--r--machxo2/arch.h47
2 files changed, 43 insertions, 12 deletions
diff --git a/machxo2/arch.cc b/machxo2/arch.cc
index eb050598..3410ec16 100644
--- a/machxo2/arch.cc
+++ b/machxo2/arch.cc
@@ -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
diff --git a/machxo2/arch.h b/machxo2/arch.h
index 560099aa..d87b5dbb 100644
--- a/machxo2/arch.h
+++ b/machxo2/arch.h
@@ -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;