diff --git a/techlibs/achronix/synth_achronix.cc b/techlibs/achronix/synth_achronix.cc index 1b48f426b..f8993de91 100644 --- a/techlibs/achronix/synth_achronix.cc +++ b/techlibs/achronix/synth_achronix.cc @@ -129,6 +129,7 @@ struct SynthAchronixPass : public ScriptPass { if (flatten && check_label("flatten", "(unless -noflatten)")) { run("proc"); + run("check"); run("flatten"); run("tribuf -logic"); run("deminout"); diff --git a/techlibs/analogdevices/synth_analogdevices.cc b/techlibs/analogdevices/synth_analogdevices.cc index 00d2e18d6..aa27c78b6 100644 --- a/techlibs/analogdevices/synth_analogdevices.cc +++ b/techlibs/analogdevices/synth_analogdevices.cc @@ -277,8 +277,10 @@ struct SynthAnalogDevicesPass : public ScriptPass if (check_label("prepare")) { run("proc"); - if (flatten || help_mode) + if (flatten || help_mode) { + run("check"); run("flatten", "(with '-flatten')"); + } if (active_design) active_design->scratchpad_unset("tribuf.added_something"); run("tribuf -logic"); @@ -447,8 +449,10 @@ struct SynthAnalogDevicesPass : public ScriptPass if (check_label("map_luts")) { run("opt_expr -mux_undef -noclkinv"); - if (flatten_before_abc) + if (flatten_before_abc) { + run("check"); run("flatten"); + } if (help_mode) run("abc -luts 2:2,3,6:5[,10,20] [-dff] [-D 1]", "(option for '-nowidelut', '-dff', '-retime')"); else if (abc9) { diff --git a/techlibs/anlogic/synth_anlogic.cc b/techlibs/anlogic/synth_anlogic.cc index a03374fb0..5c7c0b532 100644 --- a/techlibs/anlogic/synth_anlogic.cc +++ b/techlibs/anlogic/synth_anlogic.cc @@ -156,6 +156,7 @@ struct SynthAnlogicPass : public ScriptPass if (flatten && check_label("flatten", "(unless -noflatten)")) { run("proc"); + run("check"); run("flatten"); run("tribuf -logic"); run("deminout"); diff --git a/techlibs/common/synth.cc b/techlibs/common/synth.cc index 76f048495..00d884107 100644 --- a/techlibs/common/synth.cc +++ b/techlibs/common/synth.cc @@ -277,9 +277,10 @@ struct SynthPass : public ScriptPass { if (check_label("coarse")) { run("proc"); - run("check"); - if (flatten || help_mode) + if (flatten || help_mode) { + run("check"); run("flatten", " (if -flatten)"); + } run("opt_expr"); run("opt_clean"); run("check"); diff --git a/techlibs/coolrunner2/synth_coolrunner2.cc b/techlibs/coolrunner2/synth_coolrunner2.cc index 7ee1393be..1b30f51bc 100644 --- a/techlibs/coolrunner2/synth_coolrunner2.cc +++ b/techlibs/coolrunner2/synth_coolrunner2.cc @@ -132,6 +132,7 @@ struct SynthCoolrunner2Pass : public ScriptPass if (flatten && check_label("flatten", "(unless -noflatten)")) { run("proc"); + run("check"); run("flatten"); run("tribuf -logic"); } diff --git a/techlibs/easic/synth_easic.cc b/techlibs/easic/synth_easic.cc index 6c5df7beb..aea517cc5 100644 --- a/techlibs/easic/synth_easic.cc +++ b/techlibs/easic/synth_easic.cc @@ -142,6 +142,7 @@ struct SynthEasicPass : public ScriptPass if (flatten && check_label("flatten", "(unless -noflatten)")) { run("proc"); + run("check"); run("flatten"); } diff --git a/techlibs/efinix/synth_efinix.cc b/techlibs/efinix/synth_efinix.cc index ef245e755..14457c64b 100644 --- a/techlibs/efinix/synth_efinix.cc +++ b/techlibs/efinix/synth_efinix.cc @@ -148,6 +148,7 @@ struct SynthEfinixPass : public ScriptPass if (flatten && check_label("flatten", "(unless -noflatten)")) { run("proc"); + run("check"); run("flatten"); run("tribuf -logic"); run("deminout"); diff --git a/techlibs/fabulous/synth_fabulous.cc b/techlibs/fabulous/synth_fabulous.cc index f74dc8e26..0074a52af 100644 --- a/techlibs/fabulous/synth_fabulous.cc +++ b/techlibs/fabulous/synth_fabulous.cc @@ -286,6 +286,7 @@ struct SynthPass : public ScriptPass if (check_label("flatten", "(unless -noflatten)")) { if (flatten) { + run("check"); run("flatten"); run("tribuf -logic"); run("deminout"); diff --git a/techlibs/gatemate/synth_gatemate.cc b/techlibs/gatemate/synth_gatemate.cc index 7726e7a15..409b07964 100644 --- a/techlibs/gatemate/synth_gatemate.cc +++ b/techlibs/gatemate/synth_gatemate.cc @@ -210,6 +210,7 @@ struct SynthGateMatePass : public ScriptPass { run("proc"); if (!noflatten) { + run("check"); run("flatten"); } run("tribuf -logic"); diff --git a/techlibs/gowin/synth_gowin.cc b/techlibs/gowin/synth_gowin.cc index ac028e2a6..d5ebdafea 100644 --- a/techlibs/gowin/synth_gowin.cc +++ b/techlibs/gowin/synth_gowin.cc @@ -265,8 +265,10 @@ struct SynthGowinPass : public ScriptPass if (check_label("coarse")) { run("proc"); - if (flatten || help_mode) + if (flatten || help_mode) { + run("check"); run("flatten", "(unless -noflatten)"); + } run("tribuf -logic"); run("deminout"); run("opt_expr"); diff --git a/techlibs/greenpak4/synth_greenpak4.cc b/techlibs/greenpak4/synth_greenpak4.cc index fa52ecfc6..7f91d6332 100644 --- a/techlibs/greenpak4/synth_greenpak4.cc +++ b/techlibs/greenpak4/synth_greenpak4.cc @@ -144,6 +144,7 @@ struct SynthGreenPAK4Pass : public ScriptPass if (flatten && check_label("flatten", "(unless -noflatten)")) { run("proc"); + run("check"); run("flatten"); run("tribuf -logic"); } diff --git a/techlibs/ice40/synth_ice40.cc b/techlibs/ice40/synth_ice40.cc index 0a4144451..86189c848 100644 --- a/techlibs/ice40/synth_ice40.cc +++ b/techlibs/ice40/synth_ice40.cc @@ -309,6 +309,7 @@ struct SynthIce40Pass : public ScriptPass if (check_label("flatten", "(unless -noflatten)")) { if (flatten) { + run("check"); run("flatten"); run("tribuf -logic"); run("deminout"); diff --git a/techlibs/intel/synth_intel.cc b/techlibs/intel/synth_intel.cc index e02885cd0..0b0eb6ae9 100644 --- a/techlibs/intel/synth_intel.cc +++ b/techlibs/intel/synth_intel.cc @@ -198,9 +198,11 @@ struct SynthIntelPass : public ScriptPass { if (check_label("coarse")) { run("proc"); - if (flatten || help_mode) + if (flatten || help_mode) { + run("check"); run("flatten", "(skip if -noflatten)"); - run("tribuf -logic"); + } + run("tribuf -logic"); run("deminout"); run("opt_expr"); run("opt_clean"); diff --git a/techlibs/intel_alm/synth_intel_alm.cc b/techlibs/intel_alm/synth_intel_alm.cc index 28852d7df..95dbb6e35 100644 --- a/techlibs/intel_alm/synth_intel_alm.cc +++ b/techlibs/intel_alm/synth_intel_alm.cc @@ -184,8 +184,10 @@ struct SynthIntelALMPass : public ScriptPass { if (check_label("coarse")) { run("proc"); - if (flatten || help_mode) + if (flatten || help_mode) { + run("check"); run("flatten", "(skip if -noflatten)"); + } run("tribuf -logic"); run("deminout"); run("opt_expr"); diff --git a/techlibs/lattice/synth_lattice.cc b/techlibs/lattice/synth_lattice.cc index 744beb650..382dae3d8 100644 --- a/techlibs/lattice/synth_lattice.cc +++ b/techlibs/lattice/synth_lattice.cc @@ -402,8 +402,10 @@ struct SynthLatticePass : public ScriptPass if (check_label("coarse")) { run("proc"); - if (flatten || help_mode) + if (flatten || help_mode) { + run("check"); run("flatten"); + } run("tribuf -logic"); run("deminout"); run("opt_expr"); diff --git a/techlibs/microchip/synth_microchip.cc b/techlibs/microchip/synth_microchip.cc index e1d3c393a..218ed310f 100644 --- a/techlibs/microchip/synth_microchip.cc +++ b/techlibs/microchip/synth_microchip.cc @@ -267,8 +267,10 @@ struct SynthMicrochipPass : public ScriptPass { if (check_label("prepare")) { run("proc"); - if (flatten || help_mode) + if (flatten || help_mode) { + run("check"); run("flatten", "(with '-flatten')"); + } if (active_design) active_design->scratchpad_unset("tribuf.added_something"); run("tribuf -logic"); diff --git a/techlibs/nanoxplore/synth_nanoxplore.cc b/techlibs/nanoxplore/synth_nanoxplore.cc index 3445ea1be..0b87c98c7 100644 --- a/techlibs/nanoxplore/synth_nanoxplore.cc +++ b/techlibs/nanoxplore/synth_nanoxplore.cc @@ -250,8 +250,10 @@ struct SynthNanoXplorePass : public ScriptPass if (check_label("coarse")) { run("proc"); - if (flatten || help_mode) + if (flatten || help_mode) { + run("check"); run("flatten", "(skip if -noflatten)"); + } run("tribuf -logic"); run("deminout"); run("opt_expr"); diff --git a/techlibs/quicklogic/synth_quicklogic.cc b/techlibs/quicklogic/synth_quicklogic.cc index 1026dc233..e65be1c58 100644 --- a/techlibs/quicklogic/synth_quicklogic.cc +++ b/techlibs/quicklogic/synth_quicklogic.cc @@ -212,8 +212,10 @@ struct SynthQuickLogicPass : public ScriptPass { if (check_label("prepare")) { run("proc"); - if (flatten) + if (flatten) { + run("check"); run("flatten", "(unless -noflatten)"); + } if (help_mode || family == "pp3") { run("tribuf -logic", " (for pp3)"); } diff --git a/techlibs/sf2/synth_sf2.cc b/techlibs/sf2/synth_sf2.cc index ad335536b..7a7f87466 100644 --- a/techlibs/sf2/synth_sf2.cc +++ b/techlibs/sf2/synth_sf2.cc @@ -172,6 +172,7 @@ struct SynthSf2Pass : public ScriptPass if (flatten && check_label("flatten", "(unless -noflatten)")) { run("proc"); + run("check"); run("flatten"); run("tribuf -logic"); run("deminout"); diff --git a/techlibs/xilinx/synth_xilinx.cc b/techlibs/xilinx/synth_xilinx.cc index c487206db..b08fbe499 100644 --- a/techlibs/xilinx/synth_xilinx.cc +++ b/techlibs/xilinx/synth_xilinx.cc @@ -355,8 +355,10 @@ struct SynthXilinxPass : public ScriptPass if (check_label("prepare")) { run("proc"); - if (flatten || help_mode) + if (flatten || help_mode) { + run("check"); run("flatten", "(with '-flatten')"); + } if (active_design) active_design->scratchpad_unset("tribuf.added_something"); run("tribuf -logic"); @@ -637,8 +639,10 @@ struct SynthXilinxPass : public ScriptPass if (check_label("map_luts")) { run("opt_expr -mux_undef -noclkinv"); - if (flatten_before_abc) + if (flatten_before_abc) { + run("check"); run("flatten"); + } if (help_mode) run("abc -luts 2:2,3,6:5[,10,20] [-dff] [-D 1]", "(option for '-nowidelut', '-dff', '-retime')"); else if (abc9) {