connectSsaDriverFromMappings static method
Connects driver to drive all appropriate SSA nodes based on mappings
which match the provided context.
Implementation
@protected
static void connectSsaDriverFromMappings(
Logic driver, Map<Logic, Logic> mappings,
{required int context}) {
final ssaDrivers = Conditional._findSsaDriversFrom(driver, context);
// take all the "current" names for these signals
for (final ssaDriver in ssaDrivers) {
final reference = SsaLogic.referenceOf(ssaDriver, context: context);
if (!mappings.containsKey(reference)) {
throw UninitializedSignalException(reference.name);
}
// if these are already connected, just skip it, we're fine already
if (ssaDriver.srcConnection != null &&
ssaDriver.srcConnection == mappings[reference]!) {
continue;
}
// if these are the same signal, also just skip it
if (ssaDriver == mappings[reference]!) {
continue;
}
// if at this point there's still a srcConnection, then something is wrong
// and someone probably reused a signal when they shouldn't have
if (ssaDriver.srcConnection != null) {
throw MappedSignalAlreadyAssignedException(reference.name);
}
ssaDriver <= mappings[reference]!;
}
}