minAddrBits method

  1. @override
int minAddrBits()

Method to determine the minimum number of address bits needed to address all registers across all blocks. This is based on the highest address reachable in any block (its base address plus its effective size).

Implementation

@override
int minAddrBits() {
  var maxAddr = 0;
  for (final block in blocks) {
    final highestBlockAddr = block.baseAddr + blockSizeForBlock(block) - 1;
    if (highestBlockAddr > maxAddr) {
      maxAddr = highestBlockAddr;
    }
  }
  return maxAddr.bitLength;
}