aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2/arch.h
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2021-01-28 03:16:57 -0500
committergatecat <gatecat@ds0.me>2021-02-12 10:36:59 +0000
commit861c12e6eba1ae1c0d6b1ea0ed27c060b2ceb671 (patch)
tree5659a5fd8d1b029cc789c4717e5ec0dc3b41aa9a /machxo2/arch.h
parent0adde4aede134f5ed37d1fc0f081a7eaf325c7ee (diff)
downloadnextpnr-861c12e6eba1ae1c0d6b1ea0ed27c060b2ceb671.tar.gz
nextpnr-861c12e6eba1ae1c0d6b1ea0ed27c060b2ceb671.tar.bz2
nextpnr-861c12e6eba1ae1c0d6b1ea0ed27c060b2ceb671.zip
machxo2: Finish implementing Pip API functions.
Diffstat (limited to 'machxo2/arch.h')
-rw-r--r--machxo2/arch.h76
1 files changed, 67 insertions, 9 deletions
diff --git a/machxo2/arch.h b/machxo2/arch.h
index b87d622c..560099aa 100644
--- a/machxo2/arch.h
+++ b/machxo2/arch.h
@@ -748,11 +748,50 @@ struct Arch : BaseCtx
return pip_to_net.find(pip) == pip_to_net.end() || pip_to_net.at(pip) == nullptr;
}
- NetInfo *getBoundPipNet(PipId pip) const;
- WireId getConflictingPipWire(PipId pip) const;
- NetInfo *getConflictingPipNet(PipId pip) const;
- const std::vector<PipId> &getPips() const;
- Loc getPipLocation(PipId pip) const;
+ NetInfo *getBoundPipNet(PipId pip) const
+ {
+ NPNR_ASSERT(pip != PipId());
+ if (pip_to_net.find(pip) == pip_to_net.end())
+ return nullptr;
+ else
+ return pip_to_net.at(pip);
+ }
+
+ WireId getConflictingPipWire(PipId pip) const { return WireId(); }
+
+ NetInfo *getConflictingPipNet(PipId pip) const
+ {
+ NPNR_ASSERT(pip != PipId());
+ if (pip_to_net.find(pip) == pip_to_net.end())
+ return nullptr;
+ else
+ return pip_to_net.at(pip);
+ }
+
+ AllPipRange getPips() const
+ {
+ AllPipRange 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 Bels 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;
+ }
+
+ Loc getPipLocation(PipId pip) const
+ {
+ Loc loc;
+ loc.x = pip.location.x;
+ loc.y = pip.location.y;
+
+ // FIXME: Some Pip's config bits span across tiles. Will Z
+ // be affected by this?
+ loc.z = 0;
+ return loc;
+ }
WireId getPipSrcWire(PipId pip) const
{
@@ -772,10 +811,29 @@ struct Arch : BaseCtx
return wire;
}
- DelayInfo getPipDelay(PipId pip) const;
- const std::vector<PipId> &getPipsDownhill(WireId wire) const;
- const std::vector<PipId> &getPipsUphill(WireId wire) const;
- const std::vector<PipId> &getWireAliases(WireId wire) const;
+ DelayInfo getPipDelay(PipId pip) const { return DelayInfo(); }
+
+ PipRange getPipsDownhill(WireId wire) const
+ {
+ PipRange range;
+ NPNR_ASSERT(wire != WireId());
+ range.b.cursor = tileInfo(wire)->wire_data[wire.index].pips_downhill.get();
+ range.b.wire_loc = wire.location;
+ range.e.cursor = range.b.cursor + tileInfo(wire)->wire_data[wire.index].num_downhill;
+ range.e.wire_loc = wire.location;
+ return range;
+ }
+
+ PipRange getPipsUphill(WireId wire) const
+ {
+ PipRange range;
+ NPNR_ASSERT(wire != WireId());
+ range.b.cursor = tileInfo(wire)->wire_data[wire.index].pips_uphill.get();
+ range.b.wire_loc = wire.location;
+ range.e.cursor = range.b.cursor + tileInfo(wire)->wire_data[wire.index].num_uphill;
+ range.e.wire_loc = wire.location;
+ return range;
+ }
// Group
GroupId getGroupByName(IdString name) const;