Skip to content

Commit

Permalink
Merge pull request #3909 from YosysHQ/widelut
Browse files Browse the repository at this point in the history
Default nowidelut for xo2/3/3d
  • Loading branch information
mmicko authored Aug 29, 2023
2 parents 572ad34 + a42c630 commit 51ddfb1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
12 changes: 12 additions & 0 deletions techlibs/lattice/synth_lattice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ struct SynthLatticePass : public ScriptPass
log("\n");
log(" -nowidelut\n");
log(" do not use PFU muxes to implement LUTs larger than LUT4s\n");
log(" (by default enabled on MachXO2/XO3/XO3D)\n");
log("\n");
log(" -widelut\n");
log(" force use of PFU muxes to implement LUTs larger than LUT4s\n");
log("\n");
log(" -asyncprld\n");
log(" use async PRLD mode to implement ALDFF (EXPERIMENTAL)\n");
Expand Down Expand Up @@ -163,6 +167,7 @@ struct SynthLatticePass : public ScriptPass
void execute(std::vector<std::string> args, RTLIL::Design *design) override
{
string run_from, run_to;
bool force_widelut = false;
clear_flags();

size_t argidx;
Expand Down Expand Up @@ -230,6 +235,12 @@ struct SynthLatticePass : public ScriptPass
}
if (args[argidx] == "-nowidelut" || /*deprecated alias*/ args[argidx] == "-nomux") {
nowidelut = true;
force_widelut = true;
continue;
}
if (args[argidx] == "-widelut") {
nowidelut = false;
force_widelut = true;
continue;
}
if (args[argidx] == "-abc2") {
Expand Down Expand Up @@ -273,6 +284,7 @@ struct SynthLatticePass : public ScriptPass
arith_map = "_ccu2d";
brams_map = "_8kc";
have_dsp = false;
if (!force_widelut) nowidelut = true;
/* } else if (family == "xo" ||
family == "pm") {
} else if (family == "xp" ||
Expand Down
2 changes: 1 addition & 1 deletion tests/arch/machxo2/fsm.ys
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ hierarchy -top fsm
proc
flatten

equiv_opt -run :prove -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 -nowidelut
equiv_opt -run :prove -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2
miter -equiv -make_assert -flatten gold gate miter
sat -verify -prove-asserts -show-public -set-at 1 in_reset 1 -seq 20 -prove-skip 1 miter

Expand Down
2 changes: 1 addition & 1 deletion tests/arch/machxo2/lutram.ys
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ read_verilog ../common/lutram.v
hierarchy -top lutram_1w1r
proc
memory -nomap
equiv_opt -run :prove -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 -nowidelut
equiv_opt -run :prove -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2
memory
opt -full

Expand Down
8 changes: 4 additions & 4 deletions tests/arch/machxo2/mux.ys
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ design -save read

hierarchy -top mux2
proc
equiv_opt -assert -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 -nowidelut # equivalency check
equiv_opt -assert -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 # equivalency check
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
cd mux2 # Constrain all select calls below inside the top module
select -assert-count 1 t:LUT4
Expand All @@ -12,7 +12,7 @@ select -assert-none t:LUT4 t:TRELLIS_IO %% t:* %D
design -load read
hierarchy -top mux4
proc
equiv_opt -assert -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 -nowidelut # equivalency check
equiv_opt -assert -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 # equivalency check
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
cd mux4 # Constrain all select calls below inside the top module
select -assert-count 2 t:LUT4
Expand All @@ -22,7 +22,7 @@ select -assert-none t:LUT4 t:TRELLIS_IO %% t:* %D
design -load read
hierarchy -top mux8
proc
equiv_opt -assert -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 -nowidelut # equivalency check
equiv_opt -assert -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 # equivalency check
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
cd mux8 # Constrain all select calls below inside the top module
select -assert-count 5 t:LUT4
Expand All @@ -32,7 +32,7 @@ select -assert-none t:LUT4 t:TRELLIS_IO %% t:* %D
design -load read
hierarchy -top mux16
proc
equiv_opt -assert -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 -nowidelut # equivalency check
equiv_opt -assert -map +/lattice/cells_sim_xo2.v synth_lattice -family xo2 # equivalency check
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
cd mux16 # Constrain all select calls below inside the top module
select -assert-max 12 t:LUT4
Expand Down

0 comments on commit 51ddfb1

Please sign in to comment.