classAwareIssueStructuralReady function
Derives per-issue-lane structural eligibility from resource classes.
entryResourceMasks contains one resource-class mask per reservation
station slot. Each issueLaneResourceMasks entry describes the classes
supported by that issue lane, while resourceAvailableMasks describes
classes currently able to accept work. A slot is eligible when the three
masks intersect.
The returned vectors can be passed directly as the structuralReady
argument of ReadyValidMultiIssueQueue. Age selection, distinct-slot
arbitration, and dispatch ownership remain responsibilities of that queue.
Implementation
List<Logic> classAwareIssueStructuralReady({
required List<Logic> entryResourceMasks,
required List<Logic> issueLaneResourceMasks,
required List<Logic> resourceAvailableMasks,
required int resourceCount,
required String name,
}) {
if (resourceCount < 1 ||
entryResourceMasks.isEmpty ||
issueLaneResourceMasks.isEmpty ||
issueLaneResourceMasks.length != resourceAvailableMasks.length ||
entryResourceMasks.any((mask) => mask.width != resourceCount) ||
issueLaneResourceMasks.any((mask) => mask.width != resourceCount) ||
resourceAvailableMasks.any((mask) => mask.width != resourceCount)) {
throw ArgumentError(
'Class masks, lane masks, and availability masks must have matching '
'positive dimensions.');
}
return [
for (var lane = 0; lane < issueLaneResourceMasks.length; lane++)
[
for (final entryMask in entryResourceMasks)
(entryMask &
issueLaneResourceMasks[lane] &
resourceAvailableMasks[lane])
.or()
].rconcat().named('${name}_lane_${lane}_structural_ready')
];
}