Merge pull request #1950 from YosysHQ/eddie/design_import

design: -import to not count black/white-boxes as candidates for top
This commit is contained in:
Eddie Hung 2020-04-22 09:32:13 -07:00 committed by GitHub
commit 28623f19ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 7 deletions

View File

@ -228,14 +228,20 @@ struct DesignPass : public Pass {
} }
if (import_mode) { if (import_mode) {
std::vector<RTLIL::Module*> candidates;
for (auto module : copy_src_modules) for (auto module : copy_src_modules)
{ {
if (module->get_bool_attribute(ID::top)) { if (module->get_bool_attribute(ID::top)) {
copy_src_modules.clear(); candidates.clear();
copy_src_modules.push_back(module); candidates.push_back(module);
break; break;
} }
if (!module->get_blackbox_attribute())
candidates.push_back(module);
} }
if (GetSize(candidates) == 1)
copy_src_modules = std::move(candidates);
} }
} }

View File

@ -1,9 +1,17 @@
read_verilog <<EOT read_verilog <<EOT
(* blackbox *)
module bb(input i, output o);
endmodule
(* whitebox *)
module wb(input i, output o);
assign o = ~i;
endmodule
module top(input i, output o); module top(input i, output o);
assign o = i; assign o = ~i;
endmodule endmodule
EOT EOT
design -stash foo
design -delete foo design -stash gate
logger -expect error "No saved design 'foo' found!" 1 design -import gate -as gate
design -delete foo

9
tests/various/design1.ys Normal file
View File

@ -0,0 +1,9 @@
read_verilog <<EOT
module top(input i, output o);
assign o = i;
endmodule
EOT
design -stash foo
design -delete foo
logger -expect error "No saved design 'foo' found!" 1
design -delete foo