ReadyValidRegister<LogicType extends Logic> constructor
- required Logic clk,
- required Logic reset,
- required ReadyValidInterface<
LogicType> upstream, - required ReadyValidInterface<
LogicType> downstream, - String name = 'ready_valid_register',
Creates a one-entry registered ready/valid stage.
Implementation
ReadyValidRegister(
{required Logic clk,
required Logic reset,
required ReadyValidInterface<LogicType> upstream,
required ReadyValidInterface<LogicType> downstream,
String name = 'ready_valid_register'})
: super(
definitionName: 'ReadyValidRegister_'
'I${upstream.data.name}_O${downstream.data.name}_'
'${payloadShapesIdentity([upstream.data, downstream.data])}',
name: name) {
downstream.validatePayloadCompatibility(upstream.data);
this.clk = addInput('clk', clk);
this.reset = addInput('reset', reset);
addOutput('occupied');
addOutput('occupancy');
addOutput('empty');
addOutput('full');
this.upstream = addPairInterfacePorts(upstream, PairRole.consumer,
uniquify: (original) => 'upstream_$original');
this.downstream = addPairInterfaceFrom(
IrrevocableReadyValidInterface<LogicType>(downstream.data.cloneTyped()),
downstream,
PairRole.provider,
uniquify: (original) => 'downstream_$original',
);
final storedData = this.upstream.data.cloneTyped();
configureSingleEntryBuffer(
clk: this.clk,
reset: this.reset,
occupied: occupied,
upstream: this.upstream,
downstream: this.downstream,
storedData: storedData,
mode: SingleEntryBufferMode.registered,
name: name,
);
occupancy <= occupied;
empty <= ~occupied;
full <= occupied;
}