diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-08-18 19:22:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-18 19:22:46 +0200 |
commit | 1e8e873c9fe4b0fdd69055b0251f9e71db3849c5 (patch) | |
tree | 9d5f37bc5c5f6c9442bbb92948dd1da675890211 /generic | |
parent | 060be78c09fd4416c6778a5828fb573b2a42cb2e (diff) | |
parent | a346793c19f7b14772d6620fa67d8b21cf79ae45 (diff) | |
download | nextpnr-1e8e873c9fe4b0fdd69055b0251f9e71db3849c5.tar.gz nextpnr-1e8e873c9fe4b0fdd69055b0251f9e71db3849c5.tar.bz2 nextpnr-1e8e873c9fe4b0fdd69055b0251f9e71db3849c5.zip |
Merge pull request #53 from YosysHQ/archattr
Add Attributes on arch objects and improve iCE40 gfx (IO tiles, BRAM tiles)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/arch.cc | 21 | ||||
-rw-r--r-- | generic/arch.h | 10 |
2 files changed, 31 insertions, 0 deletions
diff --git a/generic/arch.cc b/generic/arch.cc index d306a9ec..7f464206 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -184,6 +184,21 @@ void Arch::setGroupDecal(GroupId group, DecalXY decalxy) refreshUiGroup(group); } +void Arch::setWireAttr(IdString wire, IdString key, const std::string &value) +{ + wires.at(wire).attrs[key] = value; +} + +void Arch::setPipAttr(IdString pip, IdString key, const std::string &value) +{ + pips.at(pip).attrs[key] = value; +} + +void Arch::setBelAttr(IdString bel, IdString key, const std::string &value) +{ + bels.at(bel).attrs[key] = value; +} + // --------------------------------------------------------------- Arch::Arch(ArchArgs args) : chipName("generic"), args(args) {} @@ -251,6 +266,8 @@ const std::vector<BelId> &Arch::getBels() const { return bel_ids; } IdString Arch::getBelType(BelId bel) const { return bels.at(bel).type; } +const std::map<IdString, std::string> &Arch::getBelAttrs(BelId bel) const { return bels.at(bel).attrs; } + WireId Arch::getBelPinWire(BelId bel, IdString pin) const { return bels.at(bel).pins.at(pin).wire; } PortType Arch::getBelPinType(BelId bel, IdString pin) const { return bels.at(bel).pins.at(pin).type; } @@ -276,6 +293,8 @@ IdString Arch::getWireName(WireId wire) const { return wire; } IdString Arch::getWireType(WireId wire) const { return wires.at(wire).type; } +const std::map<IdString, std::string> &Arch::getWireAttrs(WireId wire) const { return wires.at(wire).attrs; } + uint32_t Arch::getWireChecksum(WireId wire) const { // FIXME @@ -328,6 +347,8 @@ IdString Arch::getPipName(PipId pip) const { return pip; } IdString Arch::getPipType(PipId pip) const { return pips.at(pip).type; } +const std::map<IdString, std::string> &Arch::getPipAttrs(PipId pip) const { return pips.at(pip).attrs; } + uint32_t Arch::getPipChecksum(PipId wire) const { // FIXME diff --git a/generic/arch.h b/generic/arch.h index 7549a75b..22966e2a 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -32,6 +32,7 @@ struct WireInfo; struct PipInfo { IdString name, type; + std::map<IdString, std::string> attrs; NetInfo *bound_net; WireId srcWire, dstWire; DelayInfo delay; @@ -42,6 +43,7 @@ struct PipInfo struct WireInfo { IdString name, type; + std::map<IdString, std::string> attrs; NetInfo *bound_net; std::vector<PipId> downhill, uphill, aliases; BelPin uphill_bel_pin; @@ -61,6 +63,7 @@ struct PinInfo struct BelInfo { IdString name, type; + std::map<IdString, std::string> attrs; CellInfo *bound_cell; std::unordered_map<IdString, PinInfo> pins; DecalXY decalxy; @@ -120,6 +123,10 @@ struct Arch : BaseCtx void setBelDecal(BelId bel, DecalXY decalxy); void setGroupDecal(GroupId group, DecalXY decalxy); + void setWireAttr(IdString wire, IdString key, const std::string &value); + void setPipAttr(IdString pip, IdString key, const std::string &value); + void setBelAttr(IdString bel, IdString key, const std::string &value); + // --------------------------------------------------------------- // Common Arch API. Every arch must provide the following methods. @@ -151,6 +158,7 @@ struct Arch : BaseCtx CellInfo *getConflictingBelCell(BelId bel) const; const std::vector<BelId> &getBels() const; IdString getBelType(BelId bel) const; + const std::map<IdString, std::string> &getBelAttrs(BelId bel) const; WireId getBelPinWire(BelId bel, IdString pin) const; PortType getBelPinType(BelId bel, IdString pin) const; std::vector<IdString> getBelPins(BelId bel) const; @@ -158,6 +166,7 @@ struct Arch : BaseCtx WireId getWireByName(IdString name) const; IdString getWireName(WireId wire) const; IdString getWireType(WireId wire) const; + const std::map<IdString, std::string> &getWireAttrs(WireId wire) const; uint32_t getWireChecksum(WireId wire) const; void bindWire(WireId wire, NetInfo *net, PlaceStrength strength); void unbindWire(WireId wire); @@ -171,6 +180,7 @@ struct Arch : BaseCtx PipId getPipByName(IdString name) const; IdString getPipName(PipId pip) const; IdString getPipType(PipId pip) const; + const std::map<IdString, std::string> &getPipAttrs(PipId pip) const; uint32_t getPipChecksum(PipId pip) const; void bindPip(PipId pip, NetInfo *net, PlaceStrength strength); void unbindPip(PipId pip); |