Harmonize BRAM/LUTRAM descriptions across all of Yosys.

This commit:
  * renames all remaining instances of "DRAM" (which is ambiguous)
    to "LUTRAM" (which is not), finishing the work started in
    the commit 698ab9be;
  * renames memory rule files to brams.txt/lutrams.txt;
  * adds/renames script labels map_bram/map_lutram;
  * extracts where necessary script labels map_ffram and map_gates;
  * adds where necessary options -nobram/-nolutram.

The end result is that BRAM/LUTRAM/FFRAM aspects of every target
are now consistent with each other.

Per architecture:
  * anlogic: rename drams.txt→lutrams.txt, add -nolutram, add
    :map_lutram, :map_ffram, :map_gates
  * ecp5: rename bram.txt→brams.txt, lutram.txt→lutrams.txt
  * efinix: rename bram.txt→brams.txt, add -nobram, add :map_ffram,
    :map_gates
  * gowin: rename bram.txt→brams.txt, dram.txt→lutrams.txt,
    rename -nodram→-nolutram (-nodram still recognized), rename
    :bram→:map_bram, :dram→:map_lutram, add :map_ffram, :map_gates
This commit is contained in:
whitequark 2020-01-01 12:30:00 +00:00
parent 22fe931c86
commit 550310e264
18 changed files with 67 additions and 40 deletions

View File

@ -7,6 +7,6 @@ $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/cells_map.v))
$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/arith_map.v)) $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/arith_map.v))
$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/cells_sim.v)) $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/cells_sim.v))
$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/eagle_bb.v)) $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/eagle_bb.v))
$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/drams.txt)) $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/lutrams.txt))
$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/drams_map.v)) $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/lutrams_map.v))
$(eval $(call add_share_file,share/anlogic,techlibs/anlogic/dram_init_16x4.vh)) $(eval $(call add_share_file,share/anlogic,techlibs/anlogic/lutram_init_16x4.vh))

View File

@ -10,7 +10,7 @@ module \$__ANLOGIC_DRAM16X4 (CLK1, A1ADDR, A1DATA, B1ADDR, B1DATA, B1EN);
input B1EN; input B1EN;
EG_LOGIC_DRAM16X4 #( EG_LOGIC_DRAM16X4 #(
`include "dram_init_16x4.vh" `include "lutram_init_16x4.vh"
) _TECHMAP_REPLACE_ ( ) _TECHMAP_REPLACE_ (
.di(B1DATA), .di(B1DATA),
.waddr(B1ADDR), .waddr(B1ADDR),

View File

@ -60,6 +60,9 @@ struct SynthAnlogicPass : public ScriptPass
log(" -retime\n"); log(" -retime\n");
log(" run 'abc' with -dff option\n"); log(" run 'abc' with -dff option\n");
log("\n"); log("\n");
log(" -nolutram\n");
log(" do not use EG_LOGIC_DRAM16X4 cells in output netlist\n");
log("\n");
log("\n"); log("\n");
log("The following commands are executed by this synthesis command:\n"); log("The following commands are executed by this synthesis command:\n");
help_script(); help_script();
@ -67,7 +70,7 @@ struct SynthAnlogicPass : public ScriptPass
} }
string top_opt, edif_file, json_file; string top_opt, edif_file, json_file;
bool flatten, retime; bool flatten, retime, nolutram;
void clear_flags() YS_OVERRIDE void clear_flags() YS_OVERRIDE
{ {
@ -76,6 +79,7 @@ struct SynthAnlogicPass : public ScriptPass
json_file = ""; json_file = "";
flatten = true; flatten = true;
retime = false; retime = false;
nolutram = false;
} }
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
@ -110,6 +114,10 @@ struct SynthAnlogicPass : public ScriptPass
flatten = false; flatten = false;
continue; continue;
} }
if (args[argidx] == "-nolutram") {
nolutram = true;
continue;
}
if (args[argidx] == "-retime") { if (args[argidx] == "-retime") {
retime = true; retime = true;
continue; continue;
@ -150,18 +158,22 @@ struct SynthAnlogicPass : public ScriptPass
run("synth -run coarse"); run("synth -run coarse");
} }
if (check_label("dram")) if (!nolutram && check_label("map_lutram", "(skip if -nolutram)"))
{ {
run("memory_bram -rules +/anlogic/drams.txt"); run("memory_bram -rules +/anlogic/lutrams.txt");
run("techmap -map +/anlogic/drams_map.v"); run("techmap -map +/anlogic/lutrams_map.v");
run("setundef -zero -params t:EG_LOGIC_DRAM16X4"); run("setundef -zero -params t:EG_LOGIC_DRAM16X4");
} }
if (check_label("fine")) if (check_label("map_ffram"))
{ {
run("opt -fast -mux_undef -undriven -fine"); run("opt -fast -mux_undef -undriven -fine");
run("memory_map"); run("memory_map");
run("opt -undriven -fine"); run("opt -undriven -fine");
}
if (check_label("map_gates"))
{
run("techmap -map +/techmap.v -map +/anlogic/arith_map.v"); run("techmap -map +/techmap.v -map +/anlogic/arith_map.v");
if (retime || help_mode) if (retime || help_mode)
run("abc -dff", "(only if -retime)"); run("abc -dff", "(only if -retime)");

View File

@ -8,9 +8,9 @@ $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/cells_map.v))
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/cells_sim.v)) $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/cells_sim.v))
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/cells_bb.v)) $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/cells_bb.v))
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/lutrams_map.v)) $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/lutrams_map.v))
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/lutram.txt)) $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/lutrams.txt))
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/brams_map.v)) $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/brams_map.v))
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/bram.txt)) $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/brams.txt))
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/arith_map.v)) $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/arith_map.v))
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/latches_map.v)) $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/latches_map.v))
$(eval $(call add_share_file,share/ecp5,techlibs/ecp5/dsp_map.v)) $(eval $(call add_share_file,share/ecp5,techlibs/ecp5/dsp_map.v))

View File

@ -266,13 +266,13 @@ struct SynthEcp5Pass : public ScriptPass
if (!nobram && check_label("map_bram", "(skip if -nobram)")) if (!nobram && check_label("map_bram", "(skip if -nobram)"))
{ {
run("memory_bram -rules +/ecp5/bram.txt"); run("memory_bram -rules +/ecp5/brams.txt");
run("techmap -map +/ecp5/brams_map.v"); run("techmap -map +/ecp5/brams_map.v");
} }
if (!nolutram && check_label("map_lutram", "(skip if -nolutram)")) if (!nolutram && check_label("map_lutram", "(skip if -nolutram)"))
{ {
run("memory_bram -rules +/ecp5/lutram.txt"); run("memory_bram -rules +/ecp5/lutrams.txt");
run("techmap -map +/ecp5/lutrams_map.v"); run("techmap -map +/ecp5/lutrams_map.v");
} }

View File

@ -7,4 +7,4 @@ $(eval $(call add_share_file,share/efinix,techlibs/efinix/cells_map.v))
$(eval $(call add_share_file,share/efinix,techlibs/efinix/arith_map.v)) $(eval $(call add_share_file,share/efinix,techlibs/efinix/arith_map.v))
$(eval $(call add_share_file,share/efinix,techlibs/efinix/cells_sim.v)) $(eval $(call add_share_file,share/efinix,techlibs/efinix/cells_sim.v))
$(eval $(call add_share_file,share/efinix,techlibs/efinix/brams_map.v)) $(eval $(call add_share_file,share/efinix,techlibs/efinix/brams_map.v))
$(eval $(call add_share_file,share/efinix,techlibs/efinix/bram.txt)) $(eval $(call add_share_file,share/efinix,techlibs/efinix/brams.txt))

View File

@ -60,6 +60,9 @@ struct SynthEfinixPass : public ScriptPass
log(" -retime\n"); log(" -retime\n");
log(" run 'abc' with -dff option\n"); log(" run 'abc' with -dff option\n");
log("\n"); log("\n");
log(" -nobram\n");
log(" do not use EFX_RAM_5K cells in output netlist\n");
log("\n");
log("\n"); log("\n");
log("The following commands are executed by this synthesis command:\n"); log("The following commands are executed by this synthesis command:\n");
help_script(); help_script();
@ -67,7 +70,7 @@ struct SynthEfinixPass : public ScriptPass
} }
string top_opt, edif_file, json_file; string top_opt, edif_file, json_file;
bool flatten, retime; bool flatten, retime, nobram;
void clear_flags() YS_OVERRIDE void clear_flags() YS_OVERRIDE
{ {
@ -76,6 +79,7 @@ struct SynthEfinixPass : public ScriptPass
json_file = ""; json_file = "";
flatten = true; flatten = true;
retime = false; retime = false;
nobram = false;
} }
void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
@ -114,6 +118,10 @@ struct SynthEfinixPass : public ScriptPass
retime = true; retime = true;
continue; continue;
} }
if (args[argidx] == "-nobram") {
nobram = true;
continue;
}
break; break;
} }
extra_args(args, argidx, design); extra_args(args, argidx, design);
@ -150,18 +158,22 @@ struct SynthEfinixPass : public ScriptPass
run("synth -run coarse"); run("synth -run coarse");
} }
if (check_label("map_bram", "(skip if -nobram)")) if (!nobram || check_label("map_bram", "(skip if -nobram)"))
{ {
run("memory_bram -rules +/efinix/bram.txt"); run("memory_bram -rules +/efinix/brams.txt");
run("techmap -map +/efinix/brams_map.v"); run("techmap -map +/efinix/brams_map.v");
run("setundef -zero -params t:EFX_RAM_5K"); run("setundef -zero -params t:EFX_RAM_5K");
} }
if (check_label("fine")) if (check_label("map_ffram"))
{ {
run("opt -fast -mux_undef -undriven -fine"); run("opt -fast -mux_undef -undriven -fine");
run("memory_map"); run("memory_map");
run("opt -undriven -fine"); run("opt -undriven -fine");
}
if (check_label("map_gates"))
{
run("techmap -map +/techmap.v -map +/efinix/arith_map.v"); run("techmap -map +/techmap.v -map +/efinix/arith_map.v");
if (retime || help_mode) if (retime || help_mode)
run("abc -dff", "(only if -retime)"); run("abc -dff", "(only if -retime)");

View File

@ -7,9 +7,9 @@ $(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_map.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_sim.v)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/cells_sim.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/arith_map.v)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/arith_map.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/brams_map.v)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/brams_map.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/bram.txt)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/brams.txt))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/drams_map.v)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/lutrams_map.v))
$(eval $(call add_share_file,share/gowin,techlibs/gowin/dram.txt)) $(eval $(call add_share_file,share/gowin,techlibs/gowin/lutrams.txt))

View File

@ -55,7 +55,7 @@ struct SynthGowinPass : public ScriptPass
log(" -nobram\n"); log(" -nobram\n");
log(" do not use BRAM cells in output netlist\n"); log(" do not use BRAM cells in output netlist\n");
log("\n"); log("\n");
log(" -nodram\n"); log(" -nolutram\n");
log(" do not use distributed RAM cells in output netlist\n"); log(" do not use distributed RAM cells in output netlist\n");
log("\n"); log("\n");
log(" -noflatten\n"); log(" -noflatten\n");
@ -80,7 +80,7 @@ struct SynthGowinPass : public ScriptPass
} }
string top_opt, vout_file; string top_opt, vout_file;
bool retime, nobram, nodram, flatten, nodffe, nowidelut, abc9, noiopads; bool retime, nobram, nolutram, flatten, nodffe, nowidelut, abc9, noiopads;
void clear_flags() YS_OVERRIDE void clear_flags() YS_OVERRIDE
{ {
@ -90,7 +90,7 @@ struct SynthGowinPass : public ScriptPass
flatten = true; flatten = true;
nobram = false; nobram = false;
nodffe = false; nodffe = false;
nodram = false; nolutram = false;
nowidelut = false; nowidelut = false;
abc9 = false; abc9 = false;
noiopads = false; noiopads = false;
@ -128,8 +128,8 @@ struct SynthGowinPass : public ScriptPass
nobram = true; nobram = true;
continue; continue;
} }
if (args[argidx] == "-nodram") { if (args[argidx] == "-nolutram" || /*deprecated*/args[argidx] == "-nodram") {
nodram = true; nolutram = true;
continue; continue;
} }
if (args[argidx] == "-nodffe") { if (args[argidx] == "-nodffe") {
@ -188,24 +188,28 @@ struct SynthGowinPass : public ScriptPass
run("synth -run coarse"); run("synth -run coarse");
} }
if (!nobram && check_label("bram", "(skip if -nobram)")) if (!nobram && check_label("map_bram", "(skip if -nobram)"))
{ {
run("memory_bram -rules +/gowin/bram.txt"); run("memory_bram -rules +/gowin/brams.txt");
run("techmap -map +/gowin/brams_map.v -map +/gowin/cells_sim.v"); run("techmap -map +/gowin/brams_map.v -map +/gowin/cells_sim.v");
} }
if (!nodram && check_label("dram", "(skip if -nodram)")) if (!nolutram && check_label("map_lutram", "(skip if -nolutram)"))
{ {
run("memory_bram -rules +/gowin/dram.txt"); run("memory_bram -rules +/gowin/lutrams.txt");
run("techmap -map +/gowin/drams_map.v"); run("techmap -map +/gowin/lutrams_map.v");
run("determine_init"); run("determine_init");
} }
if (check_label("fine")) if (check_label("map_ffram"))
{ {
run("opt -fast -mux_undef -undriven -fine"); run("opt -fast -mux_undef -undriven -fine");
run("memory_map"); run("memory_map");
run("opt -undriven -fine"); run("opt -undriven -fine");
}
if (check_label("map_gates"))
{
run("techmap -map +/techmap.v -map +/gowin/arith_map.v"); run("techmap -map +/techmap.v -map +/gowin/arith_map.v");
run("techmap -map +/techmap.v"); run("techmap -map +/techmap.v");
if (retime || help_mode) if (retime || help_mode)
@ -248,7 +252,6 @@ struct SynthGowinPass : public ScriptPass
run("iopadmap -bits -inpad IBUF O:I -outpad OBUF I:O " run("iopadmap -bits -inpad IBUF O:I -outpad OBUF I:O "
"-toutpad TBUF OEN:I:O -tinoutpad IOBUF OEN:O:I:IO", "(unless -noiopads)"); "-toutpad TBUF OEN:I:O -tinoutpad IOBUF OEN:O:I:IO", "(unless -noiopads)");
run("clean"); run("clean");
} }
if (check_label("check")) if (check_label("check"))