3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-04 22:46:10 +00:00

Error out on latches.

This commit is contained in:
nella 2026-06-17 17:36:32 +02:00
parent 1023361d6c
commit b2d688dbf9
14 changed files with 149 additions and 37 deletions

View file

@ -116,13 +116,19 @@ struct SynthPass : public ScriptPass
log(" read/write collision\" (same result as setting the no_rw_check\n");
log(" attribute on all memories).\n");
log("\n");
log(" -latches <auto|warn|error>\n");
log(" select the behaviour for latches that cannot be mapped to a\n");
log(" dedicated hardware primitive and are implemented using LUTs\n");
log(" instead. 'error' (the default) aborts synthesis, 'warn' only\n");
log(" prints a warning, and 'auto' permits them without complaint.\n");
log("\n");
log("\n");
log("The following commands are executed by this synthesis command:\n");
help_script();
log("\n");
}
string top_module, json_file, blif_file, plib, fsm_opts, memory_opts, carry_mode;
string top_module, json_file, blif_file, plib, fsm_opts, memory_opts, carry_mode, latches;
std::vector<string> extra_plib, extra_map;
bool autotop, forvpr, noalumacc, nofsm, noshare, noregfile, iopad, complexdff, flatten;
@ -144,6 +150,7 @@ struct SynthPass : public ScriptPass
flatten = true;
json_file = "";
blif_file = "";
latches = "error";
}
void execute(std::vector<std::string> args, RTLIL::Design *design) override
@ -243,12 +250,18 @@ struct SynthPass : public ScriptPass
flatten = false;
continue;
}
if (args[argidx] == "-latches" && argidx+1 < args.size()) {
latches = args[++argidx];
continue;
}
break;
}
extra_args(args, argidx, design);
if (!design->full_selection())
log_cmd_error("This command only operates on fully selected designs!\n");
if (latches != "auto" && latches != "warn" && latches != "error")
log_cmd_error("Invalid value '%s' for -latches (expected auto, warn or error)\n", latches.c_str());
log_header(design, "Executing SYNTH_FABULOUS pass.\n");
log_push();
@ -279,7 +292,7 @@ struct SynthPass : public ScriptPass
run("hierarchy -check");
} else
run(stringf("hierarchy -check -top %s", top_module));
run("proc");
run("proc -latches " + (latches == "error" ? std::string("auto") : latches));
}
@ -359,7 +372,10 @@ struct SynthPass : public ScriptPass
} else {
run("dfflegalize -cell $_DFF_P_ 0 -cell $_DLATCH_?_ x", "without -complex-dff");
}
run("check -nolatches");
if (help_mode)
run("select -assert-none t:$_DLATCH_* t:$_DLATCHSR_*", "(only if -latches error, the default)");
else if (latches == "error")
run("select -assert-none t:$_DLATCH_* t:$_DLATCHSR_*");
run("techmap -map +/fabulous/latches_map.v");
run("techmap -map +/fabulous/ff_map.v");
if (help_mode) {