Sequential.multi constructor

Sequential.multi(
  1. List<Logic> posedgeTriggers,
  2. List<Conditional> _conditionals, {
  3. Logic? reset,
  4. Map<Logic, dynamic>? resetValues,
  5. bool asyncReset = false,
  6. String name = 'sequential',
  7. bool allowMultipleAssignments = true,
  8. List<Logic> negedgeTriggers = const [],
})

Constructs a Sequential multi-triggered by any of posedgeTriggers and negedgeTriggers (on positive and negative edges, respectively).

If reset is provided, then all signals driven by this block will be conditionally reset when the signal is high. The default reset value is to 0, but if resetValues is provided then the corresponding value associated with the driven signal will be set to that value instead upon reset. If a signal is in resetValues but not driven by any other Conditional in this block, it will be driven to the specified reset value.

If asyncReset is true, the reset signal (if provided) will be treated as an async reset. If asyncReset is false, the reset signal will be treated as synchronous.

If a trigger signal is sampled within the conditionals, the value will be the "new" value of that trigger, as opposed to the "old" value as with other non-trigger signals. This is meant to help model how an asynchronous trigger (e.g. async reset) could affect the behavior of the sequential elements implied. One must be careful to describe logic which is synthesizable. The Sequential will attempt to drive X in scenarios it can detect may not simulate and synthesize the same way, but it cannot guarantee it. If both a trigger and an input that is not a trigger glitch simultaneously during the phases of the Simulator, then applicable inputs will be treated as LogicValue.x since it is unpredictable which value would be sampled.

Implementation

Sequential.multi(
  List<Logic> posedgeTriggers,
  super._conditionals, {
  Logic? reset,
  super.resetValues,
  this.asyncReset = false,
  super.name = 'sequential',
  this.allowMultipleAssignments = true,
  List<Logic> negedgeTriggers = const [],
}) : super(reset: reset) {
  _registerInputTriggers([
    ...posedgeTriggers,
    if (reset != null && asyncReset) reset,
  ], isPosedge: true);
  _registerInputTriggers(negedgeTriggers, isPosedge: false);

  if (_triggers.isEmpty) {
    throw IllegalConfigurationException('Must provide at least one trigger.');
  }

  _setup();
}