connectSsaDriverFromMappings static method

  1. @protected
void connectSsaDriverFromMappings(
  1. Logic driver,
  2. Map<Logic, Logic> mappings, {
  3. required int context,
})

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) {
    if (!mappings.containsKey(ssaDriver.ref)) {
      throw UninitializedSignalException(ssaDriver.ref.name);
    }

    // if these are already connected, just skip it, we're fine already
    if (ssaDriver.srcConnection != null &&
        ssaDriver.srcConnection == mappings[ssaDriver.ref]!) {
      continue;
    }

    // if these are the same signal, also just skip it
    if (ssaDriver == mappings[ssaDriver.ref]!) {
      continue;
    }

    ssaDriver <= mappings[ssaDriver.ref]!;
  }
}