Merge pull request #1314 from YosysHQ/eddie/fix_techmap

techmap -max_iter to apply to each module individually
This commit is contained in:
Clifford Wolf 2019-08-21 09:12:56 +02:00 committed by GitHub
commit 7d8db1c053
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 4 deletions

View File

@ -943,7 +943,8 @@ struct TechmapPass : public Pass {
log(" instead of inlining them.\n");
log("\n");
log(" -max_iter <number>\n");
log(" only run the specified number of iterations.\n");
log(" only run the specified number of iterations on each module.\n");
log(" default: unlimited\n");
log("\n");
log(" -recursive\n");
log(" instead of the iterative breadth-first algorithm use a recursive\n");
@ -1157,15 +1158,16 @@ struct TechmapPass : public Pass {
RTLIL::Module *module = *worker.module_queue.begin();
worker.module_queue.erase(module);
int module_max_iter = max_iter;
bool did_something = true;
std::set<RTLIL::Cell*> handled_cells;
while (did_something) {
did_something = false;
if (worker.techmap_module(design, module, map, handled_cells, celltypeMap, false))
did_something = true;
if (worker.techmap_module(design, module, map, handled_cells, celltypeMap, false))
did_something = true;
if (did_something)
module->check();
if (max_iter > 0 && --max_iter == 0)
if (module_max_iter > 0 && --module_max_iter == 0)
break;
}
}

View File

@ -0,0 +1,8 @@
module top;
sub s0();
foo f0();
endmodule
module foo;
sub s0();
endmodule

View File

@ -0,0 +1,4 @@
module sub;
sub _TECHMAP_REPLACE_ ();
bar f0();
endmodule

View File

@ -0,0 +1,3 @@
set -ev
../../yosys -p 'hierarchy -top top; techmap -map recursive_map.v -max_iter 1; select -assert-count 2 t:sub; select -assert-count 2 t:bar' recursive.v