get method

Logic get(
  1. Logic logic,
  2. [int? stageIndex]
)

Gets the pipelined version of logic. By default stageIndex is the last stage (the output of the pipeline).

During construction, if the signal is not already a part of this Pipeline, the signal will be added to the Pipeline. After construction, only signals registered during construction can be accessed.

Use stageIndex to select the value of logic at a specific stage of the pipeline. The stageIndex must be less than stageCount.

Implementation

Logic get(Logic logic, [int? stageIndex]) {
  if (!_isRegistered(logic)) {
    if (_constructionComplete) {
      throw PortDoesNotExistException(
          'Signal $logic was not piped through this Pipeline.');
    } else {
      _add(logic);
    }
  }

  stageIndex ??= _stages.length - 1;

  final stageLogic = _stages[stageIndex].main[logic]!;
  return stageLogic;
}