From ff92d19fed274c6469720cc726e80dc777fa767f Mon Sep 17 00:00:00 2001 From: "D. Shah" Date: Fri, 29 Jan 2021 11:11:08 +0000 Subject: arch: Add getNameDelimiter API for string lists Signed-off-by: D. Shah --- nexus/arch.h | 1 + 1 file changed, 1 insertion(+) (limited to 'nexus/arch.h') diff --git a/nexus/arch.h b/nexus/arch.h index ee66599a..3063ce67 100644 --- a/nexus/arch.h +++ b/nexus/arch.h @@ -909,6 +909,7 @@ struct Arch : BaseCtx int getGridDimY() const { return chip_info->height; } int getTileBelDimZ(int, int) const { return 256; } int getTilePipDimZ(int, int) const { return 1; } + char getNameDelimiter() const { return '/'; } // ------------------------------------------------- -- cgit v1.2.3 From 6566a011b43289b9b550f3b7f8801156275cb321 Mon Sep 17 00:00:00 2001 From: "D. Shah" Date: Mon, 1 Feb 2021 11:46:10 +0000 Subject: nexus: Implement IdStringList for all arch object names Signed-off-by: D. Shah --- nexus/arch.h | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'nexus/arch.h') diff --git a/nexus/arch.h b/nexus/arch.h index 3063ce67..d37c5026 100644 --- a/nexus/arch.h +++ b/nexus/arch.h @@ -897,6 +897,11 @@ struct Arch : BaseCtx std::unordered_map wire_to_net; std::unordered_map pip_to_net; + // fast access to X and Y IdStrings for building object names + std::vector x_ids, y_ids; + // inverse of the above for name->object mapping + std::unordered_map id_to_x, id_to_y; + // ------------------------------------------------- std::string getChipName() const; @@ -913,17 +918,14 @@ struct Arch : BaseCtx // ------------------------------------------------- - BelId getBelByName(IdString name) const; + BelId getBelByName(IdStringList name) const; - IdString getBelName(BelId bel) const + IdStringList getBelName(BelId bel) const { - std::string name = "X"; - name += std::to_string(bel.tile % chip_info->width); - name += "/Y"; - name += std::to_string(bel.tile / chip_info->width); - name += "/"; - name += nameOf(IdString(bel_data(bel).name)); - return id(name); + NPNR_ASSERT(bel != BelId()); + std::array ids{x_ids.at(bel.tile % chip_info->width), y_ids.at(bel.tile / chip_info->width), + IdString(bel_data(bel).name)}; + return IdStringList(ids); } uint32_t getBelChecksum(BelId bel) const { return (bel.tile << 16) ^ bel.index; } @@ -1024,16 +1026,13 @@ struct Arch : BaseCtx // ------------------------------------------------- - WireId getWireByName(IdString name) const; - IdString getWireName(WireId wire) const + WireId getWireByName(IdStringList name) const; + IdStringList getWireName(WireId wire) const { - std::string name = "X"; - name += std::to_string(wire.tile % chip_info->width); - name += "/Y"; - name += std::to_string(wire.tile / chip_info->width); - name += "/"; - name += nameOf(IdString(wire_data(wire).name)); - return id(name); + NPNR_ASSERT(wire != WireId()); + std::array ids{x_ids.at(wire.tile % chip_info->width), y_ids.at(wire.tile / chip_info->width), + IdString(wire_data(wire).name)}; + return IdStringList(ids); } IdString getWireType(WireId wire) const; @@ -1137,8 +1136,8 @@ struct Arch : BaseCtx // ------------------------------------------------- - PipId getPipByName(IdString name) const; - IdString getPipName(PipId pip) const; + PipId getPipByName(IdStringList name) const; + IdStringList getPipName(PipId pip) const; void bindPip(PipId pip, NetInfo *net, PlaceStrength strength) { @@ -1290,8 +1289,8 @@ struct Arch : BaseCtx // ------------------------------------------------- - GroupId getGroupByName(IdString name) const { return GroupId(); } - IdString getGroupName(GroupId group) const { return IdString(); } + GroupId getGroupByName(IdStringList name) const { return GroupId(); } + IdStringList getGroupName(GroupId group) const { return IdStringList(); } std::vector getGroups() const { return {}; } std::vector getGroupBels(GroupId group) const { return {}; } std::vector getGroupWires(GroupId group) const { return {}; } -- cgit v1.2.3