mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
Merge pull request #4228 from povik/synth-inject
synth: Introduce `-extra-map` for amending techmap
This commit is contained in:
commit
e4f11eb0a0
|
@ -1041,8 +1041,8 @@ struct TechmapPass : public Pass {
|
||||||
log("\n");
|
log("\n");
|
||||||
log("When a port on a module in the map file has the 'techmap_autopurge' attribute\n");
|
log("When a port on a module in the map file has the 'techmap_autopurge' attribute\n");
|
||||||
log("set, and that port is not connected in the instantiation that is mapped, then\n");
|
log("set, and that port is not connected in the instantiation that is mapped, then\n");
|
||||||
log("then a cell port connected only to such wires will be omitted in the mapped\n");
|
log("a cell port connected only to such wires will be omitted in the mapped version\n");
|
||||||
log("version of the circuit.\n");
|
log("of the circuit.\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
log("All wires in the modules from the map file matching the pattern _TECHMAP_*\n");
|
log("All wires in the modules from the map file matching the pattern _TECHMAP_*\n");
|
||||||
log("or *._TECHMAP_* are special wires that are used to pass instructions from\n");
|
log("or *._TECHMAP_* are special wires that are used to pass instructions from\n");
|
||||||
|
|
|
@ -88,6 +88,10 @@ struct SynthPass : public ScriptPass {
|
||||||
log(" read/write collision\" (same result as setting the no_rw_check\n");
|
log(" read/write collision\" (same result as setting the no_rw_check\n");
|
||||||
log(" attribute on all memories).\n");
|
log(" attribute on all memories).\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -extra-map filename\n");
|
||||||
|
log(" source extra rules from the given file to complement the default\n");
|
||||||
|
log(" mapping library in the `techmap` step. this option can be\n");
|
||||||
|
log(" repeated.\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();
|
||||||
|
@ -96,8 +100,8 @@ struct SynthPass : public ScriptPass {
|
||||||
|
|
||||||
string top_module, fsm_opts, memory_opts, abc;
|
string top_module, fsm_opts, memory_opts, abc;
|
||||||
bool autotop, flatten, noalumacc, nofsm, noabc, noshare, flowmap, booth;
|
bool autotop, flatten, noalumacc, nofsm, noabc, noshare, flowmap, booth;
|
||||||
|
|
||||||
int lut;
|
int lut;
|
||||||
|
std::vector<std::string> techmap_maps;
|
||||||
|
|
||||||
void clear_flags() override
|
void clear_flags() override
|
||||||
{
|
{
|
||||||
|
@ -115,6 +119,7 @@ struct SynthPass : public ScriptPass {
|
||||||
flowmap = false;
|
flowmap = false;
|
||||||
booth = false;
|
booth = false;
|
||||||
abc = "abc";
|
abc = "abc";
|
||||||
|
techmap_maps.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
||||||
|
@ -151,7 +156,7 @@ struct SynthPass : public ScriptPass {
|
||||||
flatten = true;
|
flatten = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (args[argidx] == "-lut") {
|
if (args[argidx] == "-lut" && argidx + 1 < args.size()) {
|
||||||
lut = atoi(args[++argidx].c_str());
|
lut = atoi(args[++argidx].c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -192,6 +197,10 @@ struct SynthPass : public ScriptPass {
|
||||||
memory_opts += " -no-rw-check";
|
memory_opts += " -no-rw-check";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (args[argidx] == "-extra-map" && argidx + 1 < args.size()) {
|
||||||
|
techmap_maps.push_back(args[++argidx]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
extra_args(args, argidx, design);
|
extra_args(args, argidx, design);
|
||||||
|
@ -261,7 +270,17 @@ struct SynthPass : public ScriptPass {
|
||||||
run("opt -fast -full");
|
run("opt -fast -full");
|
||||||
run("memory_map");
|
run("memory_map");
|
||||||
run("opt -full");
|
run("opt -full");
|
||||||
run("techmap");
|
if (help_mode) {
|
||||||
|
run("techmap", " (unless -extra-map)");
|
||||||
|
run("techmap -map +/techmap.v -map <inject>", " (if -extra-map)");
|
||||||
|
} else {
|
||||||
|
std::string techmap_opts;
|
||||||
|
if (!techmap_maps.empty())
|
||||||
|
techmap_opts += " -map +/techmap.v";
|
||||||
|
for (auto fn : techmap_maps)
|
||||||
|
techmap_opts += stringf(" -map %s", fn.c_str());
|
||||||
|
run("techmap" + techmap_opts);
|
||||||
|
}
|
||||||
if (help_mode) {
|
if (help_mode) {
|
||||||
run("techmap -map +/gate2lut.v", "(if -noabc and -lut)");
|
run("techmap -map +/gate2lut.v", "(if -noabc and -lut)");
|
||||||
run("clean; opt_lut", " (if -noabc and -lut)");
|
run("clean; opt_lut", " (if -noabc and -lut)");
|
||||||
|
|
Loading…
Reference in a new issue