Pipeline constructor
Constructs a simple pipeline, separating arbitrary combinational logic by flop stages.
Each stage in the list stages
is a function whose sole parameter is a
PipelineStageInfo object and which returns a List of Conditional
objects. Each stage can be thought of as being the contents of a
Combinational block. Use the PipelineStageInfo object to grab
signals for a given pipe stage. Flops are positive edge triggered
based on clk
.
Then i
th element of stages
defines the combinational logic driving a
flop of index i
. That is, the first entry in stages
drives the
first set of flops, so logic defined in the first stage combinationally
consumes inputs to the Pipeline. The output of the Pipeline is
driven by flops driven by the last entry of stages
.
Signals to be pipelined can optionally be specified in the signals
list. Any signal referenced in a stage via the PipelineStageInfo
will automatically be included in the entire pipeline.
If a reset
signal is provided, then it will be consumed as an
active-high reset for every signal through the pipeline. The default
reset value is 0 for all signals, but that can be overridden by
setting resetValues
to the desired value. The values specified
in resetValues
should be a type acceptable to Logic's put
function.
Each stage can be stalled independently using stalls
, where every index
of stalls
corresponds to the index of the stage to be stalled. When
a stage's stall is asserted, the output of that stage will not change.
Implementation
Pipeline(Logic clk,
{List<List<Conditional> Function(PipelineStageInfo p)> stages = const [],
List<Logic?>? stalls,
List<Logic> signals = const [],
Map<Logic, Const> resetValues = const {},
Logic? reset})
: this.multi([clk],
stages: stages,
stalls: stalls,
signals: signals,
resetValues: resetValues,
reset: reset);