createModule method

  1. @override
Module createModule()
override

Creates a Module instance as configured.

Implementation

@override
Module createModule() {
  final readClients = max(1, readClientsKnob.value);
  final writeClients = max(0, writeClientsKnob.value);
  final depth = max(1, depthKnob.value);
  final dataWidth = max(1, dataWidthKnob.value);
  final addrWidth = _addressWidth(depth);
  if (boundaryKnob.value == ConfiguratorBoundary.actions) {
    return MemoryPortArbiter(
      clk: Logic(name: 'clk'),
      reset: Logic(name: 'reset'),
      readOffers: [
        for (var client = 0; client < readClients; client++)
          Logic(name: 'readOffer_$client'),
      ],
      readAddresses: [
        for (var client = 0; client < readClients; client++)
          Logic(name: 'readAddress_$client', width: addrWidth),
      ],
      consumeResponses: retainResultsKnob.value
          ? [
              for (var client = 0; client < readClients; client++)
                StaticOrRuntimeParameter.runtime(
                    Logic(name: 'consumeResponse_$client'),
                    name: 'consumeResponse_$client'),
            ]
          : null,
      writeOffers: [
        for (var client = 0; client < writeClients; client++)
          Logic(name: 'writeOffer_$client'),
      ],
      writeRequests: [
        for (var client = 0; client < writeClients; client++)
          MemoryWriteRequest(dataWidth: dataWidth, addrWidth: addrWidth),
      ],
      responseSchema: Logic(name: 'response', width: dataWidth),
      depth: depth,
      maximumOutstandingReads: readClients,
      memoryFunctor: synchronousRegisterFileFunctor,
    );
  }
  return ReadyValidMemoryPortArbiter(
    clk: Logic(name: 'clk'),
    reset: Logic(name: 'reset'),
    readRequests: [
      for (var client = 0; client < readClients; client++)
        ReadyAndValidInterface<Logic>(Logic(width: addrWidth)),
    ],
    readResponses: [
      for (var client = 0; client < readClients; client++)
        ReadyAndValidInterface<Logic>(Logic(width: dataWidth)),
    ],
    writeRequests: [
      for (var client = 0; client < writeClients; client++)
        ReadyAndValidInterface<MemoryWriteRequest>(
            MemoryWriteRequest(dataWidth: dataWidth, addrWidth: addrWidth)),
    ],
    depth: depth,
    maximumOutstandingReads: readClients,
    memoryFunctor: synchronousRegisterFileFunctor,
  );
}