assignSubset method

  1. @override
void assignSubset(
  1. List<Logic> updatedSubset, {
  2. int start = 0,
})
override

Performs an assignment operation on a portion this signal to be driven by updatedSubset. Each index of updatedSubset will be assigned to drive the corresponding index, plus start, of this signal.

Each of the elements of updatedSubset must have the same width as the corresponding member of elements of this signal.

Example:

// assign elements 2 and 3 of receiverLogic to sig1 and sig2, respectively
receiverLogic.assignSubset([sig1, sig2], start: 2);

Implementation

@override
void assignSubset(List<Logic> updatedSubset, {int start = 0}) {
  if (updatedSubset.length > elements.length - start) {
    throw SignalWidthMismatchException.forWidthOverflow(
        updatedSubset.length, elements.length - start);
  }

  // Assign Logic array from `start` index to `start+updatedSubset.length`
  for (var i = 0; i < updatedSubset.length; i++) {
    elements[start + i] <= updatedSubset[i];
  }
}