createModule method

  1. @override
Module createModule()
override

Creates a Module instance as configured.

Implementation

@override
Module createModule() {
  final addressWidth = depthKnob.value.log2Ceil;
  final laneWidth = laneBytesKnob.value * 8;
  final dataWidth = lanesKnob.value * laneWidth;
  final word = TypedLogicArray<Logic, LogicValue>(
      [lanesKnob.value], ({name}) => Logic(name: name, width: laneWidth));
  if (boundaryKnob.value == InferenceConfiguratorBoundary.readyValid) {
    return ReadyValidTensorAccumulatingMemoryBank(
      clk: Logic(),
      reset: Logic(),
      depth: depthKnob.value,
      laneWidth: laneWidth,
      writes: ReadyValidInterface(TensorAccumulatingWriteRequest(
          ByteMaskedWriteRequest(
              addrWidth: addressWidth, dataWidth: dataWidth))),
      reads: ReadyValidInterface(TensorScratchpadReadRequest(
          addressWidth: addressWidth, tagWidth: tagWidthKnob.value)),
      responses: ReadyValidInterface(TensorScratchpadReadResponse<Logic>(
          data: word, tagWidth: tagWidthKnob.value)),
    );
  }
  return TensorAccumulatingMemoryBank(
    clk: Logic(),
    reset: Logic(),
    depth: depthKnob.value,
    laneWidth: laneWidth,
    write: Logic(),
    writeAddress: Logic(width: addressWidth),
    writeData: word,
    writeMask: Logic(width: dataWidth ~/ 8),
    writeAccumulate: Logic(),
    read: Logic(),
    readAddress: Logic(width: addressWidth),
    readTag: Logic(width: tagWidthKnob.value),
    consumeResponse: Logic(),
  );
}