PriorityArbiter constructor

PriorityArbiter(
  1. List<Logic> requests, {
  2. String name = 'priority_arbiter',
})

Constructs an arbiter where the grant is given to the lowest-indexed request.

Implementation

PriorityArbiter(super.requests, {super.name = 'priority_arbiter'}) {
  Combinational([
    CaseZ(requests.rswizzle(), conditionalType: ConditionalType.priority, [
      for (var i = 0; i < count; i++)
        CaseItem(
          Const(
            LogicValue.filled(count, LogicValue.z).withSet(i, LogicValue.one),
          ),
          [for (var g = 0; g < count; g++) grants[g] < (i == g ? 1 : 0)],
        )
    ], defaultItem: [
      for (var g = 0; g < count; g++) grants[g] < 0
    ]),
  ]);
}