From c5416f1680583293c18fadf014dd3e7c8595de37 Mon Sep 17 00:00:00 2001 From: Pepijn de Vos Date: Mon, 19 Aug 2024 19:54:26 +0200 Subject: [PATCH 1/2] fixes for apicula support --- litex/build/gowin/apicula.py | 15 +++++++++++++-- litex/soc/cores/clock/gowin_gw1n.py | 6 +----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/litex/build/gowin/apicula.py b/litex/build/gowin/apicula.py index fa802b6c4..9a9f393c5 100644 --- a/litex/build/gowin/apicula.py +++ b/litex/build/gowin/apicula.py @@ -25,16 +25,27 @@ class GowinApiculaToolchain(YosysNextPNRToolchain): return (self._build_name + ".cst", "CST") def finalize(self): + devicename = self.platform.devicename + # Non-exhaustive list of family aliases that Gowin IDE supports but don't have a unique database + if devicename == "GW1NR-9C": + devicename = "GW1N-9C" + elif devicename == "GW1NR-9": + devicename = "GW1N-9" + elif devicename == "GW1NSR-4C" or devicename == "GW1NSR-4": + devicename = "GW1NS-4" + elif devicename == "GW1NR-4C" or devicename == "GW1NR-4": + devicename = "GW1N-4" + pnr_opts = "--write {top}_routed.json --top {top} --device {device}" + \ " --vopt family={devicename} --vopt cst={top}.cst" self._pnr_opts += pnr_opts.format( top = self._build_name, device = self.platform.device, - devicename = self.platform.devicename + devicename = devicename ) self._packer_opts += "-d {devicename} -o {top}.fs {top}_routed.json".format( - devicename = self.platform.devicename, + devicename = devicename, top = self._build_name ) diff --git a/litex/soc/cores/clock/gowin_gw1n.py b/litex/soc/cores/clock/gowin_gw1n.py index 2907b5d19..53e7e3d2c 100644 --- a/litex/soc/cores/clock/gowin_gw1n.py +++ b/litex/soc/cores/clock/gowin_gw1n.py @@ -255,11 +255,7 @@ class GW1NPLL(LiteXModule): instance_name = 'PLLVR' self.params.update(i_VREN=1) else: - instance_name = 'PLL' - self.params.update( - i_RESET_I = 0, # IDIV reset. - i_RESET_S = 0, # SDIV and DIV3 reset. - ) + instance_name = 'rPLL' for clk_name in ["CLKOUT", "CLKOUTP", "CLKOUTD", "CLKOUTD3"]: self.params[f"o_{clk_name}"] = config.get(clk_name, Open()) # Clock output. if clk_name in ["CLKOUTD", "CLKOUTD3"]: # Recopy CLKOUTx to CLKOUTDx From 4400fbb9668f28a38ccaa676bf60193720e31d71 Mon Sep 17 00:00:00 2001 From: Pepijn de Vos Date: Thu, 22 Aug 2024 16:02:41 +0200 Subject: [PATCH 2/2] Apicula: add GWINR-18 aliases --- litex/build/gowin/apicula.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/litex/build/gowin/apicula.py b/litex/build/gowin/apicula.py index 9a9f393c5..7b631ba52 100644 --- a/litex/build/gowin/apicula.py +++ b/litex/build/gowin/apicula.py @@ -35,6 +35,10 @@ class GowinApiculaToolchain(YosysNextPNRToolchain): devicename = "GW1NS-4" elif devicename == "GW1NR-4C" or devicename == "GW1NR-4": devicename = "GW1N-4" + elif devicename == "GW2AR-18C": + devicename = "GW2A-18C" + elif devicename == "GW2AR-18": + devicename = "GW2A-18" pnr_opts = "--write {top}_routed.json --top {top} --device {device}" + \ " --vopt family={devicename} --vopt cst={top}.cst"