Skip to content

Commit 533aa9b

Browse files
committed
Do not touch pre-existing modules loaded into Yosys
1 parent b7dcb25 commit 533aa9b

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/slang_frontend.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3395,6 +3395,8 @@ struct SlangFrontend : Frontend {
33953395
(void) filename;
33963396
log_header(design, "Executing SLANG frontend.\n");
33973397

3398+
// names of RTLIL modules added in this invocation; does not include blackboxes
3399+
std::vector<RTLIL::IdString> emitted_module_names;
33983400
slang::driver::Driver driver;
33993401
driver.addStandardArgs();
34003402
SynthesisSettings settings;
@@ -3480,6 +3482,7 @@ struct SlangFrontend : Frontend {
34803482

34813483
for (int i = 0; i < (int) hqueue.queue.size(); i++) {
34823484
NetlistContext &netlist = *hqueue.queue[i];
3485+
emitted_module_names.push_back(netlist.canvas->name);
34833486

34843487
if (netlist.disabled)
34853488
continue;
@@ -3515,6 +3518,11 @@ struct SlangFrontend : Frontend {
35153518
}
35163519

35173520
if (!settings.no_proc.value_or(false)) {
3521+
RTLIL::Selection emitted_modules = RTLIL::Selection::EmptySelection(design);
3522+
for (auto name : emitted_module_names)
3523+
emitted_modules.selected_modules.insert(name);
3524+
design->push_selection(emitted_modules);
3525+
35183526
log_push();
35193527
call(design, "undriven");
35203528
call(design, "proc_clean");
@@ -3527,6 +3535,8 @@ struct SlangFrontend : Frontend {
35273535
call(design, "proc_clean");
35283536
call(design, "opt_expr -keepdc");
35293537
log_pop();
3538+
3539+
design->pop_selection();
35303540
}
35313541
}
35323542
} SlangFrontend;

src/slang_frontend.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,8 @@ struct NetlistContext : RTLILBuilder, public DiagnosticIssuer {
473473
Yosys::dict<const ast::Symbol*, RTLIL::Wire *> wire_cache;
474474

475475
// With this flag set we will not elaborate this netlist; we set this when
476-
// `scopes_remap` is incomplete due to errors in processing the instantiation
477-
// of `realm` somewhere in the input.
476+
// `scopes_remap` is incomplete due to errors in processing an instantiation
477+
// of `realm`.
478478
bool disabled = false;
479479

480480
NetlistContext(RTLIL::Design *design,

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ set(ALL_TESTS
3838
various/intf_array_naming.ys
3939
various/intf_w_hierarchy.ys
4040
various/issue142.ys
41+
various/issue208.ys
4142
various/issue50.ys
4243
various/mem_inference.ys
4344
various/meminit.ys

0 commit comments

Comments
 (0)