ErrorCheckingReceiver constructor
Creates a receiver for transmission
.
Implementation
ErrorCheckingReceiver(Logic transmission,
{required int codeWidth,
required this.supportsErrorCorrection,
required super.name,
super.definitionName}) {
if (codeWidth <= 0) {
throw RohdHclException('Must provide non-empty code.');
}
this.transmission =
addInput('transmission', transmission, width: transmission.width);
addOutput('code', width: codeWidth) <=
this.transmission.slice(-1, -codeWidth);
addOutput('original_data', width: transmission.width - codeWidth) <=
this.transmission.slice(-1 - codeWidth, 0);
if (supportsErrorCorrection) {
addOutput('corrected_data', width: originalData.width);
}
addOutput('correctable_error');
addOutput('uncorrectable_error');
addOutput('error');
correctableError <= calculateCorrectableError();
uncorrectableError <= calculateUncorrectableError();
error <= correctableError | uncorrectableError;
if (supportsErrorCorrection) {
correctedData! <= calculateCorrectedData()!;
}
}