CsrBlockBinding constructor
- required CsrBlockConfig config,
- required Logic clk,
- required Logic reset,
- required DataPortInterface<
Logic> ? frontWrite, - required DataPortInterface<
Logic> ? frontRead, - bool allowLargerRegisters = false,
- int logicalRegisterIncrement = 1,
- BigInt? wideLogicalRegisterIncrement,
- BigInt? addressExtent,
- bool asyncReset = false,
- CsrImplementationConfiguration? implementationConfiguration,
- bool reserveName = false,
- bool reserveDefinitionName = false,
- String? definitionName,
Constructs one block using an explicit or scoped implementation policy.
Frontdoor and raw model addresses are relative to the block, irrespective
of config's base address. Software hardware selections use
block/register names, as in CsrTop.
Implementation
factory CsrBlockBinding({
required CsrBlockConfig config,
required Logic clk,
required Logic reset,
required DataPortInterface? frontWrite,
required DataPortInterface? frontRead,
bool allowLargerRegisters = false,
int logicalRegisterIncrement = 1,
BigInt? wideLogicalRegisterIncrement,
BigInt? addressExtent,
bool asyncReset = false,
CsrImplementationConfiguration? implementationConfiguration,
bool reserveName = false,
bool reserveDefinitionName = false,
String? definitionName,
}) {
final implementation =
implementationConfiguration ?? CsrImplementationScope.current;
if (implementation.implementation == CsrImplementation.rtl) {
if (implementation.hardwareRegisters != null) {
throw ArgumentError('Selective CSR hardware exposure requires '
'software implementation.');
}
final block = CsrBlock(
config: config,
clk: clk,
reset: reset,
frontWrite: frontWrite,
frontRead: frontRead,
allowLargerRegisters: allowLargerRegisters,
logicalRegisterIncrement: logicalRegisterIncrement,
wideLogicalRegisterIncrement: wideLogicalRegisterIncrement,
addressExtent: addressExtent,
asyncReset: asyncReset,
reserveName: reserveName,
reserveDefinitionName: reserveDefinitionName,
definitionName: definitionName,
);
return CsrBlockBinding._(block, null, block.getBackdoorPortsByName,
block.getBackdoorPortsByBigIntAddr);
}
final block = CsrBlockModel(
config: config,
clk: clk,
reset: reset,
frontWrite: frontWrite,
frontRead: frontRead,
allowLargerRegisters: allowLargerRegisters,
logicalRegisterIncrement: logicalRegisterIncrement,
wideLogicalRegisterIncrement: wideLogicalRegisterIncrement,
addressExtent: addressExtent,
asyncReset: asyncReset,
hardwareRegisters: implementation.hardwareRegisters,
reserveName: reserveName,
reserveDefinitionName: reserveDefinitionName,
definitionName: definitionName,
);
return CsrBlockBinding._(block, block.model, block.getBackdoorPortsByName,
block.getBackdoorPortsByBigIntAddr);
}