From 7081cca01654030f9a3b731cebf36e68590e3ed1 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 11 Jul 2018 14:03:23 +0200 Subject: Add GUI Decals API Signed-off-by: Clifford Wolf --- generic/arch.cc | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'generic/arch.cc') diff --git a/generic/arch.cc b/generic/arch.cc index 8f897604..b3854401 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -107,27 +107,32 @@ void Arch::addBelInout(IdString bel, IdString name, IdString wire) wires.at(wire).downhill_bel_pins.push_back(BelPin{bel, name}); } -void Arch::addFrameGraphic(const GraphicElement &graphic) +void Arch::addDecalGraphic(DecalId decal, const GraphicElement &graphic) { - frame_graphics.push_back(graphic); + decal_graphics[decal].push_back(graphic); +} + +void Arch::setFrameDecal(DecalXY decalxy) +{ + frame_decalxy = decalxy; frameGraphicsReload = true; } -void Arch::addWireGraphic(WireId wire, const GraphicElement &graphic) +void Arch::setWireDecal(WireId wire, DecalXY decalxy) { - wires.at(wire).graphics.push_back(graphic); + wires.at(wire).decalxy = decalxy; wireGraphicsReload.insert(wire); } -void Arch::addPipGraphic(PipId pip, const GraphicElement &graphic) +void Arch::setPipDecal(PipId pip, DecalXY decalxy) { - pips.at(pip).graphics.push_back(graphic); + pips.at(pip).decalxy = decalxy; pipGraphicsReload.insert(pip); } -void Arch::addBelGraphic(BelId bel, const GraphicElement &graphic) +void Arch::setBelDecal(BelId bel, DecalXY decalxy) { - bels.at(bel).graphics.push_back(graphic); + bels.at(bel).decalxy = decalxy; belGraphicsReload.insert(bel); } @@ -310,13 +315,15 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // --------------------------------------------------------------- -const std::vector &Arch::getFrameGraphics() const { return frame_graphics; } +const std::vector &Arch::getDecalGraphics(DecalId decal) const { return decal_graphics.at(decal); } + +DecalXY Arch::getFrameDecal() const { return frame_decalxy; } -const std::vector &Arch::getBelGraphics(BelId bel) const { return bels.at(bel).graphics; } +DecalXY Arch::getBelDecal(BelId bel) const { return bels.at(bel).decalxy; } -const std::vector &Arch::getWireGraphics(WireId wire) const { return wires.at(wire).graphics; } +DecalXY Arch::getWireDecal(WireId wire) const { return wires.at(wire).decalxy; } -const std::vector &Arch::getPipGraphics(PipId pip) const { return pips.at(pip).graphics; } +DecalXY Arch::getPipDecal(PipId pip) const { return pips.at(pip).decalxy; } // --------------------------------------------------------------- -- cgit v1.2.3 From 7df67c91b38433e8a1002f8e9f53926aafaa4d1b Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 11 Jul 2018 18:04:09 +0200 Subject: Add ctx->route() API Signed-off-by: Clifford Wolf --- generic/arch.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'generic/arch.cc') diff --git a/generic/arch.cc b/generic/arch.cc index b3854401..b82d8ce6 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -19,6 +19,7 @@ #include #include "nextpnr.h" +#include "router1.h" NEXTPNR_NAMESPACE_BEGIN @@ -315,6 +316,14 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // --------------------------------------------------------------- +bool Arch::route() +{ + return router1(getCtx()); +} + +// --------------------------------------------------------------- + + const std::vector &Arch::getDecalGraphics(DecalId decal) const { return decal_graphics.at(decal); } DecalXY Arch::getFrameDecal() const { return frame_decalxy; } -- cgit v1.2.3 From 7daa8524c8ab8c9ff5400d5074b80573b0d39a14 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 11 Jul 2018 18:15:08 +0200 Subject: Add ctx->place() API Signed-off-by: Clifford Wolf --- generic/arch.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'generic/arch.cc') diff --git a/generic/arch.cc b/generic/arch.cc index b82d8ce6..2282b2b8 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -19,6 +19,7 @@ #include #include "nextpnr.h" +#include "placer1.h" #include "router1.h" NEXTPNR_NAMESPACE_BEGIN @@ -316,6 +317,11 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // --------------------------------------------------------------- +bool Arch::place() +{ + return placer1(getCtx()); +} + bool Arch::route() { return router1(getCtx()); -- cgit v1.2.3 From 9baefa27423900e71d5fa2131a349e5dde2547a7 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 11 Jul 2018 18:16:59 +0200 Subject: Fix usage of refreshUi API in generic arch Signed-off-by: Clifford Wolf --- generic/arch.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'generic/arch.cc') diff --git a/generic/arch.cc b/generic/arch.cc index 2282b2b8..60874e1e 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -112,30 +112,31 @@ void Arch::addBelInout(IdString bel, IdString name, IdString wire) void Arch::addDecalGraphic(DecalId decal, const GraphicElement &graphic) { decal_graphics[decal].push_back(graphic); + refreshUi(); } void Arch::setFrameDecal(DecalXY decalxy) { frame_decalxy = decalxy; - frameGraphicsReload = true; + refreshUiFrame(); } void Arch::setWireDecal(WireId wire, DecalXY decalxy) { wires.at(wire).decalxy = decalxy; - wireGraphicsReload.insert(wire); + refreshUiWire(wire); } void Arch::setPipDecal(PipId pip, DecalXY decalxy) { pips.at(pip).decalxy = decalxy; - pipGraphicsReload.insert(pip); + refreshUiPip(pip); } void Arch::setBelDecal(BelId bel, DecalXY decalxy) { bels.at(bel).decalxy = decalxy; - belGraphicsReload.insert(bel); + refreshUiBel(bel); } // --------------------------------------------------------------- -- cgit v1.2.3 From a436035424368b3d424822c7b72f99044c93dafd Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 12 Jul 2018 17:22:29 +0200 Subject: Add Groups API Signed-off-by: Clifford Wolf --- generic/arch.cc | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'generic/arch.cc') 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 &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 Arch::getGroups() const { + std::vector ret; + for (auto &it : groups) + ret.push_back(it.first); + return ret; +} + +const std::vector &Arch::getGroupBels(GroupId group) const { return groups.at(group).bels; } + +const std::vector &Arch::getGroupWires(GroupId group) const { return groups.at(group).wires; } + +const std::vector &Arch::getGroupPips(GroupId group) const { return groups.at(group).pips; } + +const std::vector &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 &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 -- cgit v1.2.3 From b8a42ff53b1fbb6e03d169d14e58180a750f4cad Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 12 Jul 2018 22:04:13 +0200 Subject: Updates from clang-format Signed-off-by: Clifford Wolf --- generic/arch.cc | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'generic/arch.cc') diff --git a/generic/arch.cc b/generic/arch.cc index 1e1434d3..ec2443f2 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -109,25 +109,13 @@ 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::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::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::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::addGroupGroup(IdString group, IdString grp) { groups[group].groups.push_back(grp); } void Arch::addDecalGraphic(DecalId decal, const GraphicElement &graphic) { @@ -330,7 +318,8 @@ GroupId Arch::getGroupByName(IdString name) const { return name; } IdString Arch::getGroupName(GroupId group) const { return group; } -std::vector Arch::getGroups() const { +std::vector Arch::getGroups() const +{ std::vector ret; for (auto &it : groups) ret.push_back(it.first); @@ -365,15 +354,9 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // --------------------------------------------------------------- -bool Arch::place() -{ - return placer1(getCtx()); -} +bool Arch::place() { return placer1(getCtx()); } -bool Arch::route() -{ - return router1(getCtx()); -} +bool Arch::route() { return router1(getCtx()); } // --------------------------------------------------------------- -- cgit v1.2.3 From 45462ef3a714c0d98fe570d96e6761e2b298c7d0 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 13 Jul 2018 14:29:03 +0200 Subject: Fix Ui/Decal handling of active/inactive arch objects Signed-off-by: Clifford Wolf --- generic/arch.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'generic/arch.cc') diff --git a/generic/arch.cc b/generic/arch.cc index ec2443f2..390830aa 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -181,6 +181,7 @@ void Arch::bindBel(BelId bel, IdString cell, PlaceStrength strength) bels.at(bel).bound_cell = cell; cells.at(cell)->bel = bel; cells.at(cell)->belStrength = strength; + refreshUiBel(bel); } void Arch::unbindBel(BelId bel) @@ -188,6 +189,7 @@ void Arch::unbindBel(BelId bel) cells.at(bels.at(bel).bound_cell)->bel = BelId(); cells.at(bels.at(bel).bound_cell)->belStrength = STRENGTH_NONE; bels.at(bel).bound_cell = IdString(); + refreshUiBel(bel); } bool Arch::checkBelAvail(BelId bel) const { return bels.at(bel).bound_cell == IdString(); } @@ -236,6 +238,7 @@ void Arch::bindWire(WireId wire, IdString net, PlaceStrength strength) wires.at(wire).bound_net = net; nets.at(net)->wires[wire].pip = PipId(); nets.at(net)->wires[wire].strength = strength; + refreshUiWire(wire); } void Arch::unbindWire(WireId wire) @@ -243,11 +246,14 @@ void Arch::unbindWire(WireId wire) auto &net_wires = nets[wires.at(wire).bound_net]->wires; auto pip = net_wires.at(wire).pip; - if (pip != PipId()) + if (pip != PipId()) { pips.at(pip).bound_net = IdString(); + refreshUiPip(pip); + } net_wires.erase(wire); wires.at(wire).bound_net = IdString(); + refreshUiWire(wire); } bool Arch::checkWireAvail(WireId wire) const { return wires.at(wire).bound_net == IdString(); } @@ -282,6 +288,8 @@ void Arch::bindPip(PipId pip, IdString net, PlaceStrength strength) wires.at(wire).bound_net = net; nets.at(net)->wires[wire].pip = pip; nets.at(net)->wires[wire].strength = strength; + refreshUiPip(pip); + refreshUiWire(wire); } void Arch::unbindPip(PipId pip) @@ -290,6 +298,8 @@ void Arch::unbindPip(PipId pip) nets.at(wires.at(wire).bound_net)->wires.erase(wire); pips.at(pip).bound_net = IdString(); wires.at(wire).bound_net = IdString(); + refreshUiPip(pip); + refreshUiWire(wire); } bool Arch::checkPipAvail(PipId pip) const { return pips.at(pip).bound_net == IdString(); } -- cgit v1.2.3