Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions lib/src/synthesizers/utilities/synth_module_definition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -616,16 +616,31 @@ class SynthModuleDefinition {
continue;
}

final numSubModulesConnected = logics
final connectedSubModules = logics
.map((e) => e.parentModule)
.nonNulls
.where((e) =>
e != module &&
getSynthSubModuleInstantiation(e).needsInstantiation)
.toSet()
.length;
.toSet();

if (numSubModulesConnected > 1) {
if (connectedSubModules.length > 1) {
reducedInternalSignals.add(internalSignal);
continue;
}

// If the signal appears in multiple inout port mappings on the
// same (single) connected submodule, it's a loopback and needs
// a wire declaration so both ports can reference it by name.
final hasInOutLoopback = connectedSubModules.any((m) =>
getSynthSubModuleInstantiation(m)
.inOutMapping
.values
.where((v) => v == internalSignal)
.length >
1);

if (hasInOutLoopback) {
reducedInternalSignals.add(internalSignal);
continue;
}
Expand Down
Loading
Loading