slice method

  1. @override
InterfacePortReference slice(
  1. int endIndex,
  2. int startIndex
)
override

Creates a slice of this port from endIndex down to startIndex.

Both indices are inclusive. For example, slice(7, 0) would create a reference to bits 7 through 0 of the port.

Implementation

@override
InterfacePortReference slice(int endIndex, int startIndex) =>
    startIndex == 0 && endIndex == width - 1
        ? this
        : SliceInterfacePortReference(
            module,
            portName,
            sliceLowerIndex: startIndex,
            sliceUpperIndex: endIndex,
            interfaceReference: interfaceReference,
          );