mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #6078 from YosysHQ/emil/hierarchy-fix-keep-cache
hierarchy: fix keep cache usage by caching false too
This commit is contained in:
commit
468ba27d91
|
|
@ -684,24 +684,30 @@ void hierarchy_clean(RTLIL::Design *design, RTLIL::Module *top, bool purge_lib)
|
||||||
|
|
||||||
bool set_keep_print(std::map<RTLIL::Module*, bool> &cache, RTLIL::Module *mod)
|
bool set_keep_print(std::map<RTLIL::Module*, bool> &cache, RTLIL::Module *mod)
|
||||||
{
|
{
|
||||||
if (cache.count(mod) == 0)
|
auto it = cache.find(mod);
|
||||||
for (auto c : mod->cells()) {
|
if (it != cache.end())
|
||||||
RTLIL::Module *m = mod->design->module(c->type);
|
return it->second;
|
||||||
if ((m != nullptr && set_keep_print(cache, m)) || c->type == ID($print))
|
cache[mod] = false;
|
||||||
return cache[mod] = true;
|
for (auto c : mod->cells()) {
|
||||||
}
|
RTLIL::Module *m = mod->design->module(c->type);
|
||||||
return cache[mod];
|
if ((m != nullptr && set_keep_print(cache, m)) || c->type == ID($print))
|
||||||
|
return cache[mod] = true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_keep_assert(std::map<RTLIL::Module*, bool> &cache, RTLIL::Module *mod)
|
bool set_keep_assert(std::map<RTLIL::Module*, bool> &cache, RTLIL::Module *mod)
|
||||||
{
|
{
|
||||||
if (cache.count(mod) == 0)
|
auto it = cache.find(mod);
|
||||||
for (auto c : mod->cells()) {
|
if (it != cache.end())
|
||||||
RTLIL::Module *m = mod->design->module(c->type);
|
return it->second;
|
||||||
if ((m != nullptr && set_keep_assert(cache, m)) || c->type.in(ID($check), ID($assert), ID($assume), ID($live), ID($fair), ID($cover)))
|
cache[mod] = false;
|
||||||
return cache[mod] = true;
|
for (auto c : mod->cells()) {
|
||||||
}
|
RTLIL::Module *m = mod->design->module(c->type);
|
||||||
return cache[mod];
|
if ((m != nullptr && set_keep_assert(cache, m)) || c->type.in(ID($check), ID($assert), ID($assume), ID($live), ID($fair), ID($cover)))
|
||||||
|
return cache[mod] = true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int find_top_mod_score(Design *design, Module *module, dict<Module*, int> &db)
|
int find_top_mod_score(Design *design, Module *module, dict<Module*, int> &db)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
module top(input x, output y);
|
||||||
|
top top_i(.x(x), .y(y));
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
read_verilog hierarchy_recursive.v
|
||||||
|
hierarchy -auto-top
|
||||||
|
select -assert-any top
|
||||||
|
select -assert-none a:keep
|
||||||
|
|
||||||
|
design -reset
|
||||||
|
read_verilog <<EOT
|
||||||
|
module top(input x, output y);
|
||||||
|
top top_i(.x(x), .y(y));
|
||||||
|
always @(x) $display("x=%d", x);
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
hierarchy -auto-top
|
||||||
|
select -assert-any top %% a:keep
|
||||||
|
|
||||||
|
design -reset
|
||||||
|
read_verilog -formal <<EOT
|
||||||
|
module a(input x); b b_i(.x(x)); endmodule
|
||||||
|
module b(input x); a a_i(.x(x)); always @(x) assert (x == x); endmodule
|
||||||
|
module top(input x); a a_i(.x(x)); endmodule
|
||||||
|
EOT
|
||||||
|
hierarchy -top top
|
||||||
|
select -assert-any a %% a:keep
|
||||||
|
select -assert-any b %% a:keep
|
||||||
|
select -assert-any top %% a:keep
|
||||||
Loading…
Reference in New Issue