getBackdoorPortsByAddr method

CsrBackdoorInterface getBackdoorPortsByAddr(
  1. int blockAddr,
  2. int regAddr
)

Accessor to the backdoor ports of a particular register using its address regAddr within the block with address blockAddr.

Implementation

CsrBackdoorInterface getBackdoorPortsByAddr(int blockAddr, int regAddr) {
  final idx = _config.blocks.indexOf(_config.getBlockByAddr(blockAddr));
  if (idx >= 0 && idx < backdoorInterfaces.length) {
    final idx1 = _config.blocks[idx].registers
        .indexOf(_config.blocks[idx].getRegisterByAddr(regAddr));
    if (_backdoorIndexMaps[idx].containsKey(idx1)) {
      return backdoorInterfaces[idx][_backdoorIndexMaps[idx][idx1]!];
    } else {
      throw Exception('Register with address $regAddr in block with '
          'address $blockAddr could not be found.');
    }
  } else {
    throw Exception('Block with address $blockAddr could not be found.');
  }
}