aboutsummaryrefslogtreecommitdiffstats
path: root/generic/arch.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-07-12 17:22:29 +0200
committerClifford Wolf <clifford@clifford.at>2018-07-12 17:22:29 +0200
commita436035424368b3d424822c7b72f99044c93dafd (patch)
tree9bbf888bc6db482b42677656f4ee3fd4357355e8 /generic/arch.cc
parent1245eb6343f272b6aeb096b0d41407c5ea6bc5cd (diff)
downloadnextpnr-a436035424368b3d424822c7b72f99044c93dafd.tar.gz
nextpnr-a436035424368b3d424822c7b72f99044c93dafd.tar.bz2
nextpnr-a436035424368b3d424822c7b72f99044c93dafd.zip
Add Groups API
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'generic/arch.cc')
-rw-r--r--generic/arch.cc50
1 files changed, 49 insertions, 1 deletions
diff --git a/generic/arch.cc b/generic/arch.cc
index 60874e1e..1e1434d3 100644
--- a/generic/arch.cc
+++ b/generic/arch.cc
@@ -109,6 +109,26 @@ void Arch::addBelInout(IdString bel, IdString name, IdString wire)
wires.at(wire).downhill_bel_pins.push_back(BelPin{bel, name});
}
+void Arch::addGroupBel(IdString group, IdString bel)
+{
+ groups[group].bels.push_back(bel);
+}
+
+void Arch::addGroupWire(IdString group, IdString wire)
+{
+ groups[group].wires.push_back(wire);
+}
+
+void Arch::addGroupPip(IdString group, IdString pip)
+{
+ groups[group].pips.push_back(pip);
+}
+
+void Arch::addGroupGroup(IdString group, IdString grp)
+{
+ groups[group].groups.push_back(grp);
+}
+
void Arch::addDecalGraphic(DecalId decal, const GraphicElement &graphic)
{
decal_graphics[decal].push_back(graphic);
@@ -139,6 +159,12 @@ void Arch::setBelDecal(BelId bel, DecalXY decalxy)
refreshUiBel(bel);
}
+void Arch::setGroupDecal(GroupId group, DecalXY decalxy)
+{
+ groups[group].decalxy = decalxy;
+ refreshUiGroup(group);
+}
+
// ---------------------------------------------------------------
Arch::Arch(ArchArgs) {}
@@ -300,6 +326,27 @@ const std::vector<PipId> &Arch::getWireAliases(WireId wire) const { return wires
// ---------------------------------------------------------------
+GroupId Arch::getGroupByName(IdString name) const { return name; }
+
+IdString Arch::getGroupName(GroupId group) const { return group; }
+
+std::vector<GroupId> Arch::getGroups() const {
+ std::vector<GroupId> ret;
+ for (auto &it : groups)
+ ret.push_back(it.first);
+ return ret;
+}
+
+const std::vector<BelId> &Arch::getGroupBels(GroupId group) const { return groups.at(group).bels; }
+
+const std::vector<WireId> &Arch::getGroupWires(GroupId group) const { return groups.at(group).wires; }
+
+const std::vector<PipId> &Arch::getGroupPips(GroupId group) const { return groups.at(group).pips; }
+
+const std::vector<GroupId> &Arch::getGroupGroups(GroupId group) const { return groups.at(group).groups; }
+
+// ---------------------------------------------------------------
+
void Arch::estimatePosition(BelId bel, int &x, int &y, bool &gb) const
{
x = bels.at(bel).grid_x;
@@ -330,7 +377,6 @@ bool Arch::route()
// ---------------------------------------------------------------
-
const std::vector<GraphicElement> &Arch::getDecalGraphics(DecalId decal) const { return decal_graphics.at(decal); }
DecalXY Arch::getFrameDecal() const { return frame_decalxy; }
@@ -341,6 +387,8 @@ DecalXY Arch::getWireDecal(WireId wire) const { return wires.at(wire).decalxy; }
DecalXY Arch::getPipDecal(PipId pip) const { return pips.at(pip).decalxy; }
+DecalXY Arch::getGroupDecal(GroupId group) const { return groups.at(group).decalxy; }
+
// ---------------------------------------------------------------
bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, delay_t &delay) const