generateModelSystemVerilog function

String? generateModelSystemVerilog(
  1. Object candidate,
  2. String moduleName
)

Discovers an explicitly supported behavioral SystemVerilog implementation.

Null means no Verilog model is advertised; errors from an advertised implementation propagate to the caller.

Implementation

String? generateModelSystemVerilog(Object candidate, String moduleName) {
  if (candidate is ComponentModelVerilog) {
    return candidate.generateModelSystemVerilog(moduleName: moduleName);
  }
  if (candidate is ComponentModelVerilogProvider) {
    final model = candidate.componentModelVerilog;
    if (model != null) {
      return model.generateModelSystemVerilog(moduleName: moduleName);
    }
  }
  final Object? model = componentModelOf(candidate);
  return model is ComponentModelVerilog
      ? model.generateModelSystemVerilog(moduleName: moduleName)
      : null;
}