diff options
Diffstat (limited to 'ecp5/arch.h')
-rw-r--r-- | ecp5/arch.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/ecp5/arch.h b/ecp5/arch.h index 303d9afe..9997cd5c 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -441,9 +441,7 @@ struct Arch : BaseCtx const PackageInfoPOD *package_info; const SpeedGradePOD *speed_grade; - 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; + mutable std::unordered_map<IdStringList, PipId> pip_by_name; std::vector<CellInfo *> bel_to_cell; std::unordered_map<WireId, NetInfo *> wire_to_net; @@ -452,6 +450,8 @@ struct Arch : BaseCtx // fast access to X and Y IdStrings for building object names std::vector<IdString> x_ids, y_ids; + // inverse of the above for name->object mapping + std::unordered_map<IdString, int> id_to_x, id_to_y; ArchArgs args; Arch(ArchArgs args); @@ -598,16 +598,14 @@ struct Arch : BaseCtx // ------------------------------------------------- - WireId getWireByName(IdString name) const; + WireId getWireByName(IdStringList name) const; - IdString getWireName(WireId wire) const + IdStringList getWireName(WireId wire) const { NPNR_ASSERT(wire != WireId()); - - std::stringstream name; - name << "X" << wire.location.x << "/Y" << wire.location.y << "/" - << locInfo(wire)->wire_data[wire.index].name.get(); - return id(name.str()); + std::array<IdString, 3> ids{x_ids.at(wire.location.x), y_ids.at(wire.location.y), + id(locInfo(wire)->wire_data[wire.index].name.get())}; + return IdStringList(ids); } IdString getWireType(WireId wire) const @@ -716,8 +714,8 @@ struct Arch : BaseCtx // ------------------------------------------------- - PipId getPipByName(IdString name) const; - IdString getPipName(PipId pip) const; + PipId getPipByName(IdStringList name) const; + IdStringList getPipName(PipId pip) const; IdString getPipType(PipId pip) const { return IdString(); } @@ -895,8 +893,8 @@ struct Arch : BaseCtx // ------------------------------------------------- - GroupId getGroupByName(IdString name) const; - IdString getGroupName(GroupId group) const; + GroupId getGroupByName(IdStringList name) const; + IdStringList getGroupName(GroupId group) const; std::vector<GroupId> getGroups() const; std::vector<BelId> getGroupBels(GroupId group) const; std::vector<WireId> getGroupWires(GroupId group) const; |