aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs/ice40/synth_ice40.cc
diff options
context:
space:
mode:
authorMarcelina Koƛcielnicka <mwk@0x04.net>2022-02-27 09:29:26 +0100
committerMarcelina Koƛcielnicka <mwk@0x04.net>2022-05-18 17:32:56 +0200
commitd7dc2313b915d3c316630104a86eb754744fdd57 (patch)
treed767e249ee6c49356b95c27b29342f2b48f89453 /techlibs/ice40/synth_ice40.cc
parent3b2f95953c8b8343f2696c5f47bfb2864417a8b1 (diff)
downloadyosys-d7dc2313b915d3c316630104a86eb754744fdd57.tar.gz
yosys-d7dc2313b915d3c316630104a86eb754744fdd57.tar.bz2
yosys-d7dc2313b915d3c316630104a86eb754744fdd57.zip
ice40: Use `memory_libmap` pass.
Diffstat (limited to 'techlibs/ice40/synth_ice40.cc')
-rw-r--r--techlibs/ice40/synth_ice40.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/techlibs/ice40/synth_ice40.cc b/techlibs/ice40/synth_ice40.cc
index 421ec3b4e..c10b7003e 100644
--- a/techlibs/ice40/synth_ice40.cc
+++ b/techlibs/ice40/synth_ice40.cc
@@ -90,6 +90,9 @@ struct SynthIce40Pass : public ScriptPass
log(" -nobram\n");
log(" do not use SB_RAM40_4K* cells in output netlist\n");
log("\n");
+ log(" -spram\n");
+ log(" enable automatic inference of SB_SPRAM256KA\n");
+ log("\n");
log(" -dsp\n");
log(" use iCE40 UltraPlus DSP cells for large arithmetic\n");
log("\n");
@@ -116,7 +119,7 @@ struct SynthIce40Pass : public ScriptPass
}
string top_opt, blif_file, edif_file, json_file, device_opt;
- bool nocarry, nodffe, nobram, dsp, flatten, retime, noabc, abc2, vpr, abc9, dff, flowmap;
+ bool nocarry, nodffe, nobram, spram, dsp, flatten, retime, noabc, abc2, vpr, abc9, dff, flowmap;
int min_ce_use;
void clear_flags() override
@@ -129,6 +132,7 @@ struct SynthIce40Pass : public ScriptPass
nodffe = false;
min_ce_use = -1;
nobram = false;
+ spram = false;
dsp = false;
flatten = true;
retime = false;
@@ -204,6 +208,10 @@ struct SynthIce40Pass : public ScriptPass
nobram = true;
continue;
}
+ if (args[argidx] == "-spram") {
+ spram = true;
+ continue;
+ }
if (args[argidx] == "-dsp") {
dsp = true;
continue;
@@ -322,19 +330,24 @@ struct SynthIce40Pass : public ScriptPass
run("opt_clean");
}
- if (!nobram && check_label("map_bram", "(skip if -nobram)"))
+ if (check_label("map_ram"))
{
- run("memory_bram -rules +/ice40/brams.txt");
- run("techmap -map +/ice40/brams_map.v");
+ std::string args = "";
+ if (!spram)
+ args += " -no-auto-huge";
+ if (nobram)
+ args += " -no-auto-block";
+ if (help_mode)
+ args += " [-no-auto-huge] [-no-auto-block]";
+ run("memory_libmap -lib +/ice40/brams.txt -lib +/ice40/spram.txt" + args, "(-no-auto-huge unless -spram, -no-auto-block if -nobram)");
+ run("techmap -map +/ice40/brams_map.v -map +/ice40/spram_map.v");
run("ice40_braminit");
}
if (check_label("map_ffram"))
{
run("opt -fast -mux_undef -undriven -fine");
- run("memory_map -iattr -attr !ram_block -attr !rom_block -attr logic_block "
- "-attr syn_ramstyle=auto -attr syn_ramstyle=registers "
- "-attr syn_romstyle=auto -attr syn_romstyle=logic");
+ run("memory_map");
run("opt -undriven -fine");
}