Sequential.multi constructor

Sequential.multi(
  1. List<Logic> clks,
  2. List<Conditional> _conditionals, {
  3. Logic? reset,
  4. Map<Logic, dynamic>? resetValues,
  5. String name = 'sequential',
  6. bool allowMultipleAssignments = true,
})

Constructs a Sequential multi-triggered by any of clks.

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.

Implementation

Sequential.multi(
  List<Logic> clks,
  super._conditionals, {
  super.reset,
  super.resetValues,
  super.name = 'sequential',
  this.allowMultipleAssignments = true,
}) {
  if (clks.isEmpty) {
    throw IllegalConfigurationException('Must provide at least one clock.');
  }

  for (var i = 0; i < clks.length; i++) {
    final clk = clks[i];
    if (clk.width > 1) {
      throw Exception('Each clk must be 1 bit, but saw $clk.');
    }
    _clks.add(addInput(
        _portUniquifier.getUniqueName(
            initialName: Sanitizer.sanitizeSV(
                Naming.unpreferredName('clk${i}_${clk.name}'))),
        clk));
    _preTickClkValues.add(null);
  }
  _setup();
}