ConservativeLoadStoreQueue<MetadataType extends Logic> constructor
- required Logic clk,
- required Logic reset,
- required Logic quiesce,
- required Logic allocate,
- required MemoryQueueRequest<
MetadataType> request, - required Logic takeAllocation,
- required Logic updateLoadAddress,
- required Tagged<
MemoryAccess> loadAddressUpdate, - required Logic updateStoreAddress,
- required Tagged<
MemoryAccess> storeAddressUpdate, - required Logic updateStoreData,
- required Tagged<
Logic> storeDataUpdate, - required Logic releaseLoad,
- required TagRelease loadRelease,
- required Logic commitStore,
- required TagRelease storeCommit,
- required Logic cancelLoads,
- required Logic loadCancellationMask,
- required Logic cancelStores,
- required Logic storeCancellationMask,
- required Logic takeLoadIssue,
- required Logic takeStoreDrain,
- required int loadCount,
- required int storeCount,
- required int sequenceWidth,
- RegisterFileFunctor? storageImplementation,
- String name = 'conservative_load_store_queue',
Creates a scalar-allocation conservative load/store queue driven by explicit actions.
Every output schema is derived from request. storageImplementation
selects the backing for queue entries, slot ownership, and per-load
older-store masks. The default retains flops.
Implementation
ConservativeLoadStoreQueue(
{required Logic clk,
required Logic reset,
required Logic quiesce,
required Logic allocate,
required MemoryQueueRequest<MetadataType> request,
required Logic takeAllocation,
required Logic updateLoadAddress,
required Tagged<MemoryAccess> loadAddressUpdate,
required Logic updateStoreAddress,
required Tagged<MemoryAccess> storeAddressUpdate,
required Logic updateStoreData,
required Tagged<Logic> storeDataUpdate,
required Logic releaseLoad,
required TagRelease loadRelease,
required Logic commitStore,
required TagRelease storeCommit,
required Logic cancelLoads,
required Logic loadCancellationMask,
required Logic cancelStores,
required Logic storeCancellationMask,
required Logic takeLoadIssue,
required Logic takeStoreDrain,
required this.loadCount,
required this.storeCount,
required this.sequenceWidth,
RegisterFileFunctor? storageImplementation,
super.name = 'conservative_load_store_queue'})
: loadTagWidth = max(1, loadCount.log2Ceil),
storeTagWidth = max(1, storeCount.log2Ceil),
super(
definitionName: 'ConservativeLoadStoreQueue_'
'L${loadCount}_S${storeCount}_Q${sequenceWidth}_'
'A${request.access.address.width}_D${request.data.width}_'
'B${request.access.byteEnable.width}_'
'${payloadShapeIdentity(request)}'
'${storageImplementation == null ? '' : '_'}'
'${storageImplementation?.identity ?? ''}') {
if (loadCount < 1 || storeCount < 1 || sequenceWidth < 2) {
throw ArgumentError(
'Queue capacities and sequence width must be positive.');
}
if (loadCount + storeCount >= (1 << (sequenceWidth - 1))) {
throw ArgumentError.value(
sequenceWidth,
'sequenceWidth',
'The total live memory window must fit in less than half the '
'wrapping sequence space.');
}
final queueTagWidth = max(loadTagWidth, storeTagWidth);
final addressWidth = request.access.address.width;
final byteCount = request.access.byteEnable.width;
final dataWidth = request.data.width;
if (loadAddressUpdate.tagWidth != loadTagWidth ||
loadAddressUpdate.data.address.width != addressWidth ||
loadAddressUpdate.data.byteEnable.width != byteCount ||
storeAddressUpdate.tagWidth != storeTagWidth ||
storeAddressUpdate.data.address.width != addressWidth ||
storeAddressUpdate.data.byteEnable.width != byteCount ||
storeDataUpdate.tagWidth != storeTagWidth ||
storeDataUpdate.data.width != dataWidth ||
loadRelease.tagWidth != loadTagWidth ||
storeCommit.tagWidth != storeTagWidth ||
loadCancellationMask.width != loadCount ||
storeCancellationMask.width != storeCount) {
throw ArgumentError('Request, update, and queue shapes must match.');
}
final localClk = addInput('clk', clk);
final localReset = addInput('reset', reset);
final localQuiesce = addInput('quiesce', quiesce);
final localAllocate = addInput('allocate', allocate);
final localRequest = addTypedInput('request', request);
final localTakeAllocation = addInput('takeAllocation', takeAllocation);
final localUpdateLoadAddress =
addInput('updateLoadAddress', updateLoadAddress);
final localLoadAddressUpdate =
addTypedInput('loadAddressUpdate', loadAddressUpdate);
final localUpdateStoreAddress =
addInput('updateStoreAddress', updateStoreAddress);
final localStoreAddressUpdate =
addTypedInput('storeAddressUpdate', storeAddressUpdate);
final localUpdateStoreData = addInput('updateStoreData', updateStoreData);
final localStoreDataUpdate =
addTypedInput('storeDataUpdate', storeDataUpdate);
final localReleaseLoad = addInput('releaseLoad', releaseLoad);
final localLoadRelease = addTypedInput('loadRelease', loadRelease);
final localCommitStore = addInput('commitStore', commitStore);
final localStoreCommit = addTypedInput('storeCommit', storeCommit);
final localCancelLoads = addInput('cancelLoads', cancelLoads);
final localLoadCancellationMask = addInput(
'loadCancellationMask', loadCancellationMask,
width: loadCount);
final localCancelStores = addInput('cancelStores', cancelStores);
final localStoreCancellationMask = addInput(
'storeCancellationMask', storeCancellationMask,
width: storeCount);
final localTakeLoadIssue = addInput('takeLoadIssue', takeLoadIssue);
final localTakeStoreDrain = addInput('takeStoreDrain', takeStoreDrain);
final loadEntryPrototype = LoadQueueEntry<MetadataType>(
localRequest.metadata.cloneTyped(),
addressWidth: addressWidth,
byteCount: byteCount,
memorySequenceWidth: sequenceWidth,
loadSequenceWidth: sequenceWidth,
destinationTagWidth: localRequest.destinationTagWidth);
final storeEntryPrototype = StoreQueueEntry<MetadataType>(
localRequest.metadata.cloneTyped(),
dataWidth: dataWidth,
addressWidth: addressWidth,
byteCount: byteCount,
memorySequenceWidth: sequenceWidth,
storeSequenceWidth: sequenceWidth);
addOutput('canAllocate');
addOutput('allocationValid');
allocation = addTypedPayloadOutput(
this,
'allocation',
AllocatedMemoryOperation<MetadataType>(localRequest.cloneTyped(),
queueTagWidth: queueTagWidth, sequenceWidth: sequenceWidth));
addOutput('canCancel');
addOutput('loadIssueValid');
loadIssue = addTypedPayloadOutput(
this,
'loadIssue',
Tagged<ConservativeLoadIssue<MetadataType>>(
ConservativeLoadIssue<MetadataType>(loadEntryPrototype.cloneTyped(),
dataWidth: dataWidth),
tagWidth: loadTagWidth));
addOutput('storeDrainValid');
storeDrain = addTypedPayloadOutput(
this,
'storeDrain',
Tagged<StoreQueueEntry<MetadataType>>(storeEntryPrototype.cloneTyped(),
tagWidth: storeTagWidth));
addOutput('occupiedLoads', width: loadCount);
addOutput('occupiedStores', width: storeCount);
addOutput('loadOccupancy', width: max(1, (loadCount + 1).log2Ceil));
addOutput('storeOccupancy', width: max(1, (storeCount + 1).log2Ceil));
addOutput('unresolvedOlderStoreLoads', width: loadCount);
addOutput('partialOverlapLoads', width: loadCount);
addOutput('forwardingDataWaitLoads', width: loadCount);
addOutput('quiesced');
addOutput('invalidLoadAddressUpdate');
addOutput('invalidStoreAddressUpdate');
addOutput('invalidStoreDataUpdate');
addOutput('invalidLoadRelease');
addOutput('invalidStoreCommit');
addOutput('cancelInactiveLoads', width: loadCount);
addOutput('cancelInactiveStores', width: storeCount);
final storedLoads = [
for (var slot = 0; slot < loadCount; slot++)
loadEntryPrototype.cloneTyped(name: '${name}_load_$slot')
];
final storedStores = [
for (var slot = 0; slot < storeCount; slot++)
storeEntryPrototype.cloneTyped(name: '${name}_store_$slot')
];
loadEntries = [
for (var slot = 0; slot < loadCount; slot++)
addTypedPayloadOutput(this, 'loadEntry$slot', loadEntryPrototype)
];
storeEntries = [
for (var slot = 0; slot < storeCount; slot++)
addTypedPayloadOutput(this, 'storeEntry$slot', storeEntryPrototype)
];
for (var slot = 0; slot < loadCount; slot++) {
loadEntries[slot] <= storedLoads[slot];
}
for (var slot = 0; slot < storeCount; slot++) {
storeEntries[slot] <= storedStores[slot];
}
final loadSlot =
ReadyAndValidInterface(Logic(name: 'loadSlot', width: loadTagWidth));
final storeSlot =
ReadyAndValidInterface(Logic(name: 'storeSlot', width: storeTagWidth));
final loadPoolReleases = [
for (var lane = 0; lane <= loadCount; lane++)
ReadyAndValidInterface(
TagRelease(tagWidth: loadTagWidth, name: 'loadPoolRelease$lane'))
];
final storePoolReleases = [
for (var lane = 0; lane <= storeCount; lane++)
ReadyAndValidInterface(
TagRelease(tagWidth: storeTagWidth, name: 'storePoolRelease$lane'))
];
final loadPoolRestore = ReadyThenValidInterface(
Logic(name: 'loadPoolRestore', width: loadCount));
final storePoolRestore = ReadyThenValidInterface(
Logic(name: 'storePoolRestore', width: storeCount));
loadPoolRestore.valid <= Const(0);
loadPoolRestore.data <= Const(0, width: loadCount);
storePoolRestore.valid <= Const(0);
storePoolRestore.data <= Const(0, width: storeCount);
final loadPool = ReadyValidMultiIndexPool(
clk: localClk,
reset: localReset,
quiesce: localQuiesce,
allocations: [loadSlot],
releases: loadPoolReleases,
restore: loadPoolRestore,
capacity: loadCount,
storageImplementation: storageImplementation,
name: 'load_slot_pool');
final storePool = ReadyValidMultiIndexPool(
clk: localClk,
reset: localReset,
quiesce: localQuiesce,
allocations: [storeSlot],
releases: storePoolReleases,
restore: storePoolRestore,
capacity: storeCount,
storageImplementation: storageImplementation,
name: 'store_slot_pool');
final memorySequence =
Logic(name: '${name}_memory_sequence', width: sequenceWidth);
final loadSequence =
Logic(name: '${name}_load_sequence', width: sequenceWidth);
final storeSequence =
Logic(name: '${name}_store_sequence', width: sequenceWidth);
final cancellationOffered = (localCancelLoads | localCancelStores)
.named('${name}_cancellation_offered');
final allocationAllowed = (~localQuiesce & ~cancellationOffered)
.named('${name}_allocation_allowed');
final selectedSlotValid =
mux(localRequest.isStore, storeSlot.valid, loadSlot.valid);
final selectedQueueTag = mux(
localRequest.isStore,
storeSlot.data.zeroExtend(queueTagWidth),
loadSlot.data.zeroExtend(queueTagWidth));
final selectedQueueSequence =
mux(localRequest.isStore, storeSequence, loadSequence);
final proposedAllocation =
allocation.cloneTyped(name: '${name}_proposed_allocation');
proposedAllocation.request <= localRequest;
proposedAllocation.queueTag <= selectedQueueTag;
proposedAllocation.memorySequence <= memorySequence;
proposedAllocation.queueSequence <= selectedQueueSequence;
final retainedAllocation =
allocation.cloneTyped(name: '${name}_retained_allocation');
final allocationBusy = Logic(name: '${name}_allocation_busy');
final acceptedAllocation = (localTakeAllocation & allocationBusy)
.named('${name}_allocation_accepted');
final allocationSlotAvailable = (~allocationBusy | acceptedAllocation)
.named('${name}_allocation_slot_available');
allocationValid <= allocationBusy;
allocation <= retainedAllocation;
canAllocate <=
allocationSlotAvailable & allocationAllowed & selectedSlotValid;
loadSlot.ready <=
localAllocate &
~localRequest.isStore &
allocationSlotAvailable &
allocationAllowed;
storeSlot.ready <=
localAllocate &
localRequest.isStore &
allocationSlotAvailable &
allocationAllowed;
final acceptedRequest =
(canAllocate & localAllocate).named('${name}_request_accepted');
final acceptedLoadAllocation = (acceptedRequest & ~localRequest.isStore)
.named('${name}_load_allocation_accepted');
final acceptedStoreAllocation = (acceptedRequest & localRequest.isStore)
.named('${name}_store_allocation_accepted');
final proposedLoad =
loadEntryPrototype.cloneTyped(name: '${name}_proposed_load');
proposedLoad.metadata <= localRequest.metadata;
proposedLoad.address <= localRequest.access.address;
proposedLoad.byteEnable <= localRequest.access.byteEnable;
proposedLoad.memorySequence <= memorySequence;
proposedLoad.loadSequence <= loadSequence;
proposedLoad.destinationTag <= localRequest.destinationTag;
proposedLoad.addressValid <= localRequest.addressValid;
proposedLoad.executed <= Const(0);
proposedLoad.waitingForMiss <= Const(0);
final proposedStore =
storeEntryPrototype.cloneTyped(name: '${name}_proposed_store');
proposedStore.metadata <= localRequest.metadata;
proposedStore.data <= localRequest.data;
proposedStore.address <= localRequest.access.address;
proposedStore.byteEnable <= localRequest.access.byteEnable;
proposedStore.memorySequence <= memorySequence;
proposedStore.storeSequence <= storeSequence;
proposedStore.addressValid <= localRequest.addressValid;
proposedStore.dataValid <= localRequest.dataValid;
proposedStore.committed <= Const(0);
proposedStore.draining <= Const(0);
Logic inRange(Logic tag, int count, String operation) =>
count == (1 << tag.width)
? Const(1)
: tag
.lt(Const(count, width: tag.width))
.named('${name}_${operation}_in_range');
Logic selectOccupied(Logic occupied, Logic tag) {
var selected = occupied[occupied.width - 1];
for (var slot = occupied.width - 2; slot >= 0; slot--) {
selected = mux(tag.eq(slot), occupied[slot], selected);
}
return selected;
}
final loadTrackerAllocation =
ReadyAndValidInterface(Logic(width: loadTagWidth));
final storeTrackerAllocation =
ReadyAndValidInterface(Logic(width: storeTagWidth));
final loadTrackerRelease =
ReadyAndValidInterface(TagRelease(tagWidth: loadTagWidth));
final storeTrackerRelease =
ReadyAndValidInterface(TagRelease(tagWidth: storeTagWidth));
final loadTrackerCancellation =
ReadyAndValidInterface(Logic(width: loadCount));
final storeTrackerCancellation =
ReadyAndValidInterface(Logic(width: storeCount));
final retainedLoadIssue =
loadIssue.cloneTyped(name: '${name}_retained_load_issue');
final loadIssueBusy = Logic(name: '${name}_load_issue_busy');
final acceptedLoadIssue = (localTakeLoadIssue & loadIssueBusy)
.named('${name}_load_issue_accepted');
final retainedStoreDrain =
storeDrain.cloneTyped(name: '${name}_retained_store_drain');
final storeDrainBusy = Logic(name: '${name}_store_drain_busy');
final acceptedStoreDrain = (localTakeStoreDrain & storeDrainBusy)
.named('${name}_store_drain_accepted');
final releaseMatchesIssue = localLoadRelease.tag.eq(retainedLoadIssue.tag);
addOutput('canReleaseLoad') <=
~(loadIssueBusy & releaseMatchesIssue & ~localTakeLoadIssue);
final acceptedLoadRelease = localReleaseLoad & canReleaseLoad;
final validLoadRelease = acceptedLoadRelease &
inRange(localLoadRelease.tag, loadCount, 'load_release') &
selectOccupied(loadPool.allocatedMask, localLoadRelease.tag);
Logic releasingLoad(Logic tag) =>
validLoadRelease & localLoadRelease.tag.eq(tag);
Logic liveStoreForMutation(Logic tag, String action) =>
inRange(tag, storeCount, action) &
selectOccupied(storePool.allocatedMask, tag) &
~(acceptedStoreDrain & retainedStoreDrain.tag.eq(tag));
final validLoadAddressUpdate = localUpdateLoadAddress &
inRange(localLoadAddressUpdate.tag, loadCount, 'load_address') &
selectOccupied(loadPool.allocatedMask, localLoadAddressUpdate.tag) &
~releasingLoad(localLoadAddressUpdate.tag);
final validStoreAddressUpdate = localUpdateStoreAddress &
liveStoreForMutation(localStoreAddressUpdate.tag, 'store_address');
final validStoreDataUpdate = localUpdateStoreData &
liveStoreForMutation(localStoreDataUpdate.tag, 'store_data');
final validStoreCommit = localCommitStore &
liveStoreForMutation(localStoreCommit.tag, 'store_commit');
invalidLoadAddressUpdate <=
localUpdateLoadAddress & ~validLoadAddressUpdate;
invalidStoreAddressUpdate <=
localUpdateStoreAddress & ~validStoreAddressUpdate;
invalidStoreDataUpdate <= localUpdateStoreData & ~validStoreDataUpdate;
invalidLoadRelease <= acceptedLoadRelease & ~validLoadRelease;
invalidStoreCommit <= localCommitStore & ~validStoreCommit;
final cancellationReady =
(localQuiesce & ~allocationBusy & ~loadIssueBusy & ~storeDrainBusy)
.named('${name}_cancellation_ready');
canCancel <= cancellationReady;
quiesced <= cancellationReady;
final acceptedLoadCancellation = (canCancel & localCancelLoads)
.named('${name}_load_cancellation_accepted');
final acceptedStoreCancellation = (canCancel & localCancelStores)
.named('${name}_store_cancellation_accepted');
loadTrackerAllocation.valid <= acceptedLoadAllocation;
loadTrackerAllocation.data <= loadSlot.data;
storeTrackerAllocation.valid <= acceptedStoreAllocation;
storeTrackerAllocation.data <= storeSlot.data;
loadTrackerRelease.valid <= validLoadRelease;
loadTrackerRelease.data.tag <= localLoadRelease.tag;
loadTrackerCancellation.valid <= acceptedLoadCancellation;
loadTrackerCancellation.data <= localLoadCancellationMask;
storeTrackerCancellation.valid <= acceptedStoreCancellation;
storeTrackerCancellation.data <= localStoreCancellationMask;
olderStoreTracker = OlderStoreMaskTracker(
clk: localClk,
reset: localReset,
storageImplementation: storageImplementation,
storeAllocation: storeTrackerAllocation,
storeRelease: storeTrackerRelease,
loadAllocation: loadTrackerAllocation,
loadRelease: loadTrackerRelease,
storeCancellationMask: storeTrackerCancellation,
loadCancellationMask: loadTrackerCancellation,
selectedLoad: Const(0, width: loadTagWidth),
storeCount: storeCount,
loadCount: loadCount,
name: 'lsq_older_store_masks');
final policy = LoadStoreQueuePolicy(
occupiedLoads: loadPool.allocatedMask,
occupiedStores: storePool.allocatedMask,
loadEntries: storedLoads,
storeEntries: storedStores,
storeCandidateMasks: olderStoreTracker.loadOlderStoreMasks,
maximumLiveEntries: loadCount + storeCount,
name: 'lsq_policy');
addressMatchers = policy.addressMatchers;
forwardSelectors = policy.forwardSelectors;
unresolvedOlderStoreLoads <= policy.unresolvedOlderStoreLoads;
partialOverlapLoads <= policy.partialOverlapLoads;
forwardingDataWaitLoads <= policy.forwardingDataWaitLoads;
final proposedLoadIssue =
loadIssue.cloneTyped(name: '${name}_proposed_load_issue');
proposedLoadIssue.tag <= policy.selectedLoadTag;
proposedLoadIssue.data <= policy.selectedLoad;
final captureLoadIssue = ~loadIssueBusy &
~localQuiesce &
~cancellationOffered &
policy.selectedLoadValid &
~releasingLoad(policy.selectedLoadTag);
loadIssueValid <= loadIssueBusy;
loadIssue <= retainedLoadIssue;
final proposedStoreDrain =
storeDrain.cloneTyped(name: '${name}_proposed_store_drain');
proposedStoreDrain.tag <= policy.selectedStoreTag;
for (var field = 0;
field < proposedStoreDrain.data.elements.length;
field++) {
proposedStoreDrain.data.elements[field] <=
(identical(proposedStoreDrain.data.elements[field],
proposedStoreDrain.data.draining)
? Const(1)
: policy.selectedStore.elements[field]);
}
final captureStoreDrain = ~storeDrainBusy &
~localQuiesce &
~cancellationOffered &
policy.selectedStoreValid;
storeDrainValid <= storeDrainBusy;
storeDrain <= retainedStoreDrain;
storeTrackerRelease.valid <= acceptedStoreDrain;
storeTrackerRelease.data.tag <= retainedStoreDrain.tag;
cancelInactiveLoads <= olderStoreTracker.cancelInactiveLoads;
cancelInactiveStores <= olderStoreTracker.cancelInactiveStores;
loadPoolReleases.first.valid <= validLoadRelease;
loadPoolReleases.first.data.tag <= localLoadRelease.tag;
for (var load = 0; load < loadCount; load++) {
loadPoolReleases[load + 1].valid <=
acceptedLoadCancellation &
localLoadCancellationMask[load] &
loadPool.allocatedMask[load];
loadPoolReleases[load + 1].data.tag <= Const(load, width: loadTagWidth);
}
storePoolReleases.first.valid <= acceptedStoreDrain;
storePoolReleases.first.data.tag <= retainedStoreDrain.tag;
for (var store = 0; store < storeCount; store++) {
storePoolReleases[store + 1].valid <=
acceptedStoreCancellation &
localStoreCancellationMask[store] &
storePool.allocatedMask[store];
storePoolReleases[store + 1].data.tag <=
Const(store, width: storeTagWidth);
}
occupiedLoads <= loadPool.allocatedMask;
occupiedStores <= storePool.allocatedMask;
loadOccupancy <= loadPool.allocatedCount;
storeOccupancy <= storePool.allocatedCount;
final nextLoads = storageImplementation == null
? storedLoads
: [for (final entry in storedLoads) entry.cloneTyped()];
final nextStores = storageImplementation == null
? storedStores
: [for (final entry in storedStores) entry.cloneTyped()];
final loadStateActions = <Conditional>[
for (var load = 0; load < loadCount; load++) ...[
If(validLoadRelease & localLoadRelease.tag.eq(load),
then: [nextLoads[load] < 0]),
If(acceptedLoadAllocation & loadSlot.data.eq(load),
then: [nextLoads[load] < proposedLoad]),
If(validLoadAddressUpdate & localLoadAddressUpdate.tag.eq(load), then: [
nextLoads[load].address < localLoadAddressUpdate.data.address,
nextLoads[load].byteEnable < localLoadAddressUpdate.data.byteEnable,
nextLoads[load].addressValid < 1
]),
If(
acceptedLoadIssue &
retainedLoadIssue.tag.eq(load) &
~(validLoadRelease & releaseMatchesIssue),
then: [
nextLoads[load].executed < 1,
nextLoads[load].waitingForMiss < ~retainedLoadIssue.data.forwarded
]),
If(acceptedLoadCancellation & localLoadCancellationMask[load],
then: [nextLoads[load] < 0])
],
];
final storeStateActions = <Conditional>[
for (var store = 0; store < storeCount; store++) ...[
If(acceptedStoreDrain & retainedStoreDrain.tag.eq(store),
then: [nextStores[store] < 0]),
If(acceptedStoreAllocation & storeSlot.data.eq(store),
then: [nextStores[store] < proposedStore]),
If(captureStoreDrain & policy.selectedStoreTag.eq(store),
then: [nextStores[store].draining < 1]),
If(validStoreAddressUpdate & localStoreAddressUpdate.tag.eq(store),
then: [
nextStores[store].address < localStoreAddressUpdate.data.address,
nextStores[store].byteEnable <
localStoreAddressUpdate.data.byteEnable,
nextStores[store].addressValid < 1
]),
If(validStoreDataUpdate & localStoreDataUpdate.tag.eq(store), then: [
nextStores[store].data < localStoreDataUpdate.data,
nextStores[store].dataValid < 1
]),
If(validStoreCommit & localStoreCommit.tag.eq(store),
then: [nextStores[store].committed < 1]),
If(acceptedStoreCancellation & localStoreCancellationMask[store],
then: [nextStores[store] < 0])
]
];
Sequential(localClk, reset: localReset, resetValues: {
memorySequence: 0,
loadSequence: 0,
storeSequence: 0,
allocationBusy: 0,
retainedAllocation: 0,
loadIssueBusy: 0,
retainedLoadIssue: 0,
storeDrainBusy: 0,
retainedStoreDrain: 0,
if (storageImplementation == null) ...{
for (final load in storedLoads) load: 0,
for (final store in storedStores) store: 0,
}
}, [
If(acceptedRequest, then: [
memorySequence < memorySequence + Const(1, width: sequenceWidth)
]),
If(acceptedRequest, then: [
allocationBusy < 1,
retainedAllocation < proposedAllocation
], orElse: [
If(acceptedAllocation, then: [allocationBusy < 0])
]),
If(acceptedLoadAllocation,
then: [loadSequence < loadSequence + Const(1, width: sequenceWidth)]),
If(acceptedStoreAllocation, then: [
storeSequence < storeSequence + Const(1, width: sequenceWidth)
]),
If(captureLoadIssue,
then: [loadIssueBusy < 1, retainedLoadIssue < proposedLoadIssue]),
If(acceptedLoadIssue, then: [loadIssueBusy < 0]),
If(captureStoreDrain,
then: [storeDrainBusy < 1, retainedStoreDrain < proposedStoreDrain]),
If(acceptedStoreDrain, then: [storeDrainBusy < 0]),
if (storageImplementation == null) ...[
...loadStateActions,
...storeStateActions,
]
]);
if (storageImplementation != null) {
Combinational([
for (var slot = 0; slot < loadCount; slot++)
nextLoads[slot] < storedLoads[slot],
...loadStateActions,
]);
Combinational([
for (var slot = 0; slot < storeCount; slot++)
nextStores[slot] < storedStores[slot],
...storeStateActions,
]);
connectRegisterFileBank(
clk: localClk,
reset: localReset,
current: storedLoads,
next: nextLoads,
resetValues: List.filled(loadCount,
LogicValue.filled(storedLoads.first.width, LogicValue.zero)),
implementation: storageImplementation,
name: '${name}_load_storage',
);
connectRegisterFileBank(
clk: localClk,
reset: localReset,
current: storedStores,
next: nextStores,
resetValues: List.filled(storeCount,
LogicValue.filled(storedStores.first.width, LogicValue.zero)),
implementation: storageImplementation,
name: '${name}_store_storage',
);
}
}