From 2a8bab976d04745355800e9f23db6a7d208ce81c Mon Sep 17 00:00:00 2001 From: myrtle Date: Tue, 10 Feb 2026 20:54:09 +0100 Subject: [PATCH] gowin: Perfomance improvements round 1 (#1632) * gowin: Configure HeAP Signed-off-by: gatecat * gowin: Use fast constant value routing Signed-off-by: gatecat --------- Signed-off-by: gatecat --- himbaechel/uarch/gowin/gowin.cc | 26 ++++++++++++++++++++++++ himbaechel/uarch/gowin/gowin_arch_gen.py | 4 ---- himbaechel/uarch/gowin/pack.cc | 1 + 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/himbaechel/uarch/gowin/gowin.cc b/himbaechel/uarch/gowin/gowin.cc index 39a1a3e1..c9362876 100644 --- a/himbaechel/uarch/gowin/gowin.cc +++ b/himbaechel/uarch/gowin/gowin.cc @@ -16,6 +16,8 @@ #include "gowin_utils.h" #include "pack.h" +#include "placer_heap.h" + NEXTPNR_NAMESPACE_BEGIN namespace { @@ -49,6 +51,9 @@ struct GowinImpl : HimbaechelAPI bool getClusterPlacement(ClusterId cluster, BelId root_bel, std::vector> &placement) const override; + + void configurePlacerHeap(PlacerHeapCfg &cfg) override; + private: HimbaechelHelpers h; GowinUtils gwu; @@ -1270,6 +1275,27 @@ void GowinImpl::notifyBelChange(BelId bel, CellInfo *cell) } } +void GowinImpl::configurePlacerHeap(PlacerHeapCfg &cfg) +{ + // SLICE types are closely associated with each other + cfg.cellGroups.emplace_back(); + cfg.cellGroups.back().insert(id_LUT4); + cfg.cellGroups.back().insert(id_DFF); + cfg.cellGroups.back().insert(id_ALU); + cfg.cellGroups.back().insert(id_MUX2_LUT5); + cfg.cellGroups.back().insert(id_MUX2_LUT6); + cfg.cellGroups.back().insert(id_MUX2_LUT7); + cfg.cellGroups.back().insert(id_MUX2_LUT8); + cfg.cellGroups.back().insert(id_RAM16SDP4); + + // Treat control and constants like IO buffers, because they have only one possible location + cfg.ioBufTypes.insert(id_GOWIN_VCC); + cfg.ioBufTypes.insert(id_GOWIN_GND); + cfg.ioBufTypes.insert(id_PINCFG); + cfg.ioBufTypes.insert(id_GSR); +} + + } // namespace NEXTPNR_NAMESPACE_END diff --git a/himbaechel/uarch/gowin/gowin_arch_gen.py b/himbaechel/uarch/gowin/gowin_arch_gen.py index 4cb8c095..cced755b 100644 --- a/himbaechel/uarch/gowin/gowin_arch_gen.py +++ b/himbaechel/uarch/gowin/gowin_arch_gen.py @@ -509,10 +509,6 @@ def create_nodes(chip: Chip, db: chipdb): for node in nodes: chip.add_node(node) - # VCC and VSS sources in the all tiles - global_nodes.setdefault('GND', []).append(NodeWire(x, y, 'VSS')) - global_nodes.setdefault('VCC', []).append(NodeWire(x, y, 'VCC')) - # add nodes from the apicula db for node_name, node_hdr in db.nodes.items(): wire_type, node = node_hdr diff --git a/himbaechel/uarch/gowin/pack.cc b/himbaechel/uarch/gowin/pack.cc index 47b7c26e..fd82e126 100644 --- a/himbaechel/uarch/gowin/pack.cc +++ b/himbaechel/uarch/gowin/pack.cc @@ -1740,6 +1740,7 @@ struct GowinPacker continue; } NetInfo *constnet = net->second.get(); + constnet->constant_value = (constnet->name == ctx->id("$PACKER_GND")) ? id_VSS : id_VCC; for (auto user : constnet->users) { CellInfo *uc = user.cell; if (is_lut(uc) && (user.port.str(ctx).at(0) == 'I')) {