aboutsummaryrefslogtreecommitdiffstats
path: root/passes
diff options
context:
space:
mode:
authorMarcelina Koƛcielnicka <mwk@0x04.net>2022-06-02 17:15:28 +0200
committerMarcelina Koƛcielnicka <mwk@0x04.net>2022-06-02 23:16:12 +0200
commit71dfbf33b292b6920ff1bab308c0c10b737bf763 (patch)
tree4e844cbe19ede678ee1efd0cf5a1581f2f9b0d23 /passes
parent3a0aa9c6630c6e2bb2ffb2d7f5b4e3921316ba48 (diff)
downloadyosys-71dfbf33b292b6920ff1bab308c0c10b737bf763.tar.gz
yosys-71dfbf33b292b6920ff1bab308c0c10b737bf763.tar.bz2
yosys-71dfbf33b292b6920ff1bab308c0c10b737bf763.zip
Add -no-rw-check option to memory_dff + memory + synth_{ice40,ecp5,gowin}.
Diffstat (limited to 'passes')
-rw-r--r--passes/memory/memory.cc11
-rw-r--r--passes/memory/memory_dff.cc19
2 files changed, 23 insertions, 7 deletions
diff --git a/passes/memory/memory.cc b/passes/memory/memory.cc
index e34cc927e..d5dec6198 100644
--- a/passes/memory/memory.cc
+++ b/passes/memory/memory.cc
@@ -31,7 +31,7 @@ struct MemoryPass : public Pass {
{
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
log("\n");
- log(" memory [-norom] [-nomap] [-nordff] [-nowiden] [-nosat] [-memx] [-bram <bram_rules>] [selection]\n");
+ log(" memory [-norom] [-nomap] [-nordff] [-nowiden] [-nosat] [-memx] [-no-rw-check] [-bram <bram_rules>] [selection]\n");
log("\n");
log("This pass calls all the other memory_* passes in a useful order:\n");
log("\n");
@@ -39,7 +39,7 @@ struct MemoryPass : public Pass {
log(" opt_mem_priority\n");
log(" opt_mem_feedback\n");
log(" memory_bmux2rom (skipped if called with -norom)\n");
- log(" memory_dff (skipped if called with -nordff or -memx)\n");
+ log(" memory_dff [-no-rw-check] (skipped if called with -nordff or -memx)\n");
log(" opt_clean\n");
log(" memory_share [-nowiden] [-nosat]\n");
log(" opt_mem_widen\n");
@@ -59,6 +59,7 @@ struct MemoryPass : public Pass {
bool flag_nomap = false;
bool flag_nordff = false;
bool flag_memx = false;
+ string memory_dff_opts;
string memory_bram_opts;
string memory_share_opts;
@@ -92,6 +93,10 @@ struct MemoryPass : public Pass {
memory_share_opts += " -nosat";
continue;
}
+ if (args[argidx] == "-no-rw-check") {
+ memory_dff_opts += " -no-rw-check";
+ continue;
+ }
if (argidx+1 < args.size() && args[argidx] == "-bram") {
memory_bram_opts += " -rules " + args[++argidx];
continue;
@@ -106,7 +111,7 @@ struct MemoryPass : public Pass {
if (!flag_norom)
Pass::call(design, "memory_bmux2rom");
if (!flag_nordff)
- Pass::call(design, "memory_dff");
+ Pass::call(design, "memory_dff" + memory_dff_opts);
Pass::call(design, "opt_clean");
Pass::call(design, "memory_share" + memory_share_opts);
Pass::call(design, "opt_mem_widen");
diff --git a/passes/memory/memory_dff.cc b/passes/memory/memory_dff.cc
index dd3d8a8f3..998e86491 100644
--- a/passes/memory/memory_dff.cc
+++ b/passes/memory/memory_dff.cc
@@ -220,8 +220,9 @@ struct MemoryDffWorker
ModWalker modwalker;
FfInitVals initvals;
FfMergeHelper merger;
+ bool flag_no_rw_check;
- MemoryDffWorker(Module *module) : module(module), modwalker(module->design)
+ MemoryDffWorker(Module *module, bool flag_no_rw_check) : module(module), modwalker(module->design), flag_no_rw_check(flag_no_rw_check)
{
modwalker.setup(module);
initvals.set(&modwalker.sigmap, module);
@@ -358,7 +359,7 @@ struct MemoryDffWorker
}
// Check for no_rw_check
- bool no_rw_check = mem.get_bool_attribute(ID::no_rw_check);
+ bool no_rw_check = flag_no_rw_check || mem.get_bool_attribute(ID::no_rw_check);
for (auto attr: {ID::ram_block, ID::rom_block, ID::ram_style, ID::rom_style, ID::ramstyle, ID::romstyle, ID::syn_ramstyle, ID::syn_romstyle}) {
if (mem.get_string_attribute(attr) == "no_rw_check") {
no_rw_check = true;
@@ -628,25 +629,35 @@ struct MemoryDffPass : public Pass {
{
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
log("\n");
- log(" memory_dff [options] [selection]\n");
+ log(" memory_dff [-no-rw-check] [selection]\n");
log("\n");
log("This pass detects DFFs at memory read ports and merges them into the memory port.\n");
log("I.e. it consumes an asynchronous memory port and the flip-flops at its\n");
log("interface and yields a synchronous memory port.\n");
log("\n");
+ log(" -no-rw-check\n");
+ log(" marks all recognized read ports as \"return don't-care value on\n");
+ log(" read/write collision\" (same result as setting the no_rw_check\n");
+ log(" attribute on all memories).\n");
+ log("\n");
}
void execute(std::vector<std::string> args, RTLIL::Design *design) override
{
+ bool flag_no_rw_check = false;
log_header(design, "Executing MEMORY_DFF pass (merging $dff cells to $memrd).\n");
size_t argidx;
for (argidx = 1; argidx < args.size(); argidx++) {
+ if (args[argidx] == "-no-rw-check") {
+ flag_no_rw_check = true;
+ continue;
+ }
break;
}
extra_args(args, argidx, design);
for (auto mod : design->selected_modules()) {
- MemoryDffWorker worker(mod);
+ MemoryDffWorker worker(mod, flag_no_rw_check);
worker.run();
}
}