aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2/arch.h
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2021-01-27 01:46:32 -0500
committergatecat <gatecat@ds0.me>2021-02-12 10:36:59 +0000
commit9a9054188c52d76670dace9777981ffd28de5599 (patch)
tree362224e53a91c124c5aa2a83c8b16d23c4b8c0e2 /machxo2/arch.h
parente4a6fd35716b8d587eff971b23d20af4b1a1a2cb (diff)
downloadnextpnr-9a9054188c52d76670dace9777981ffd28de5599.tar.gz
nextpnr-9a9054188c52d76670dace9777981ffd28de5599.tar.bz2
nextpnr-9a9054188c52d76670dace9777981ffd28de5599.zip
machxo2: Implement getByName/getName for Wires and Pips.
Diffstat (limited to 'machxo2/arch.h')
-rw-r--r--machxo2/arch.h37
1 files changed, 33 insertions, 4 deletions
diff --git a/machxo2/arch.h b/machxo2/arch.h
index d620be4e..d8442ec8 100644
--- a/machxo2/arch.h
+++ b/machxo2/arch.h
@@ -464,6 +464,8 @@ struct Arch : BaseCtx
std::vector<CellInfo *> bel_to_cell;
mutable std::unordered_map<IdString, BelId> bel_by_name;
+ mutable std::unordered_map<IdString, WireId> wire_by_name;
+ mutable std::unordered_map<IdString, PipId> pip_by_name;
// Placeholders to be removed.
std::unordered_map<Loc, BelId> bel_by_loc;
@@ -512,6 +514,7 @@ struct Arch : BaseCtx
// Bels
BelId getBelByName(IdString name) const;
+
IdString getBelName(BelId bel) const
{
NPNR_ASSERT(bel != BelId());
@@ -611,7 +614,15 @@ struct Arch : BaseCtx
// Wires
WireId getWireByName(IdString name) const;
- IdString getWireName(WireId wire) const;
+
+ IdString getWireName(WireId wire) const
+ {
+ NPNR_ASSERT(wire != WireId());
+ std::stringstream name;
+ name << "X" << wire.location.x << "/Y" << wire.location.y << "/" << tileInfo(wire)->bel_data[wire.index].name.get();
+ return id(name.str());
+ }
+
IdString getWireType(WireId wire) const;
const std::map<IdString, std::string> &getWireAttrs(WireId wire) const;
uint32_t getWireChecksum(WireId wire) const;
@@ -628,7 +639,8 @@ struct Arch : BaseCtx
// Pips
PipId getPipByName(IdString name) const;
IdString getPipName(PipId pip) const;
- IdString getPipType(PipId pip) const;
+
+ IdString getPipType(PipId pip) const { return IdString(); }
const std::map<IdString, std::string> &getPipAttrs(PipId pip) const;
uint32_t getPipChecksum(PipId pip) const;
void bindPip(PipId pip, NetInfo *net, PlaceStrength strength);
@@ -639,8 +651,25 @@ struct Arch : BaseCtx
NetInfo *getConflictingPipNet(PipId pip) const;
const std::vector<PipId> &getPips() const;
Loc getPipLocation(PipId pip) const;
- WireId getPipSrcWire(PipId pip) const;
- WireId getPipDstWire(PipId pip) const;
+
+ WireId getPipSrcWire(PipId pip) const
+ {
+ WireId wire;
+ NPNR_ASSERT(pip != PipId());
+ wire.index = tileInfo(pip)->pips_data[pip.index].src_idx;
+ wire.location = pip.location + tileInfo(pip)->pips_data[pip.index].src;
+ return wire;
+ }
+
+ WireId getPipDstWire(PipId pip) const
+ {
+ WireId wire;
+ NPNR_ASSERT(pip != PipId());
+ wire.index = tileInfo(pip)->pips_data[pip.index].dst_idx;
+ wire.location = pip.location + tileInfo(pip)->pips_data[pip.index].dst;
+ return wire;
+ }
+
DelayInfo getPipDelay(PipId pip) const;
const std::vector<PipId> &getPipsDownhill(WireId wire) const;
const std::vector<PipId> &getPipsUphill(WireId wire) const;