createModelOccupancy method
Creates a model-driven occupancy for occupancyObserver, if any.
The signal is owned by a child named instanceName, which should match
the RTL child whose occupancy it replaces so observers see the same
hierarchy in both implementations.
Implementation
@protected
Logic? createModelOccupancy(String instanceName, int capacity) {
final observer = occupancyObserver;
if (observer == null) {
return null;
}
final signal = _ModelOccupancy(
clk,
width: capacity.bitLength,
name: instanceName,
).occupancy;
observer(signal, capacity);
return signal;
}