Arbiter constructor

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

Constructs an arbiter where each element in requests is a one-bit signal requesting a corresponding bit from grants.

Implementation

Arbiter(List<Logic> requests, {super.name = 'arbiter'}) {
  for (var i = 0; i < requests.length; i++) {
    if (requests[i].width != 1) {
      throw RohdHclException('Each request must be 1 bit,'
          ' but found ${requests[i]} at index $i.');
    }

    _requests.add(addInput('request_$i', requests[i]));
    _grants.add(addOutput('grant_$i'));
  }
}