createModule method

  1. @override
Module createModule()
override

Creates a Module instance as configured.

Implementation

@override
Module createModule() {
  final depth = max(1, depthKnob.value);
  final dataWidth = max(1, min(dataWidthKnob.value, 32));
  final mask = (1 << dataWidth) - 1;
  return SynchronousReadOnlyMemory(
    clk: Logic(name: 'clk'),
    reset: Logic(name: 'reset'),
    readPorts: [
      for (var port = 0; port < max(1, readPortsKnob.value); port++)
        SynchronousReadDataPortInterface(dataWidth, _addressWidth(depth)),
    ],
    entryCount: depth,
    initialWords: [for (var word = 0; word < depth; word++) word & mask],
  );
}