BridgeModule.fromJson constructor

BridgeModule.fromJson(
  1. Map<String, dynamic> jsonContents, {
  2. String? name,
  3. bool reserveName = false,
})

Creates a BridgeModule from a JSON module description.

This factory constructor parses JSON content (typically constructed by tools parsing other specifications) to automatically create a module with the appropriate ports, interfaces, and parameters.

The JSON should contain module metadata including module name and parameters, port definitions with directions and widths, interface definitions and port mappings, and complex port structures and member mappings.

The jsonContents contains the JSON object with the module definition. The name provides an optional instance name override, and reserveName controls whether to reserve the instance name.

The created module is automatically marked as a SystemVerilog leaf since it represents an existing hardware description.

Implementation

factory BridgeModule.fromJson(
  Map<String, dynamic> jsonContents, {
  String? name,
  bool reserveName = false,
}) {
  final definitionName = jsonContents['name']! as String;

  return BridgeModule(
    definitionName,
    name: name,
    reserveName: reserveName,
    allowUniquification: false,
    isSystemVerilogLeaf: true,
  )..addFromJson(jsonContents);
}