From 8f6d63c0823cd8b64fd30f7892735f00e12f7467 Mon Sep 17 00:00:00 2001 From: Maxim Kudinov Date: Thu, 16 Oct 2025 10:32:39 +0300 Subject: [PATCH] synth_gowin: make setundef an off by default option --- techlibs/gowin/synth_gowin.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/techlibs/gowin/synth_gowin.cc b/techlibs/gowin/synth_gowin.cc index 03766ed36..f1669d8f8 100644 --- a/techlibs/gowin/synth_gowin.cc +++ b/techlibs/gowin/synth_gowin.cc @@ -94,13 +94,16 @@ struct SynthGowinPass : public ScriptPass log(" The following families are supported:\n"); log(" 'gw1n', 'gw2a', 'gw5a'.\n"); log("\n"); + log(" -setundef\n"); + log(" run 'setundef' with '-undriven -params -zero' options\n"); + log("\n"); log("The following commands are executed by this synthesis command:\n"); help_script(); log("\n"); } string top_opt, vout_file, json_file, family; - bool retime, nobram, nolutram, flatten, nodffe, strict_gw5a_dffs, nowidelut, abc9, noiopads, noalu, no_rw_check; + bool retime, nobram, nolutram, flatten, nodffe, strict_gw5a_dffs, nowidelut, abc9, noiopads, noalu, no_rw_check, setundef; void clear_flags() override { @@ -119,6 +122,7 @@ struct SynthGowinPass : public ScriptPass noiopads = false; noalu = false; no_rw_check = false; + setundef = false; } void execute(std::vector args, RTLIL::Design *design) override @@ -201,6 +205,10 @@ struct SynthGowinPass : public ScriptPass no_rw_check = true; continue; } + if (args[argidx] == "-setundef") { + setundef = true; + continue; + } break; } extra_args(args, argidx, design); @@ -321,7 +329,8 @@ struct SynthGowinPass : public ScriptPass { run("techmap -map +/gowin/cells_map.v"); run("opt_lut_ins -tech gowin"); - run("setundef -undriven -params -zero"); + if (setundef || help_mode) + run("setundef -undriven -params -zero", "(only if -setundef used)"); run("hilomap -singleton -hicell VCC V -locell GND G"); if (!vout_file.empty() || help_mode) // vendor output requires 1-bit wires run("splitnets -ports", "(only if -vout used)");