addInputArray method

LogicArray addInputArray(
  1. String name,
  2. Logic source, {
  3. List<int> dimensions = const [1],
  4. int elementWidth = 1,
  5. int numUnpackedDimensions = 0,
})

Registers and returns an input LogicArray port to this Module with the specified dimensions, elementWidth, and numUnpackedDimensions named name.

This is very similar to addInput, except for LogicArrays.

Performs validation on overall width matching for source, but not on dimensions, elementWidth, or numUnpackedDimensions.

Implementation

LogicArray addInputArray(
  String name,
  Logic source, {
  List<int> dimensions = const [1],
  int elementWidth = 1,
  int numUnpackedDimensions = 0,
}) {
  _checkForSafePortName(name);

  final inArr = LogicArray(
    name: name,
    dimensions,
    elementWidth,
    numUnpackedDimensions: numUnpackedDimensions,
    naming: Naming.reserved,
  )
    ..gets(source)
    // ignore: invalid_use_of_protected_member
    ..setAllParentModule(this);

  _inputs[name] = inArr;

  _inputSources[name] = source;

  return inArr;
}