Explore removal of need to clear completed reads
Currently, it's necessary to manually clear completed reads from a memory interface once they've been processed by a component, to prevent them from being re-processed in future. This places a burden on the component, and introduces potential problems when multiple components may use the same MemoryInterface instance (i.e., when should the clear occur?).
A trivial fix would be to handle this at the core-level, with a clear occurring at the same level as the ticking of other components. Unfortunately, the presence of zero-cycle memory requests complicates this, as a read request may have been made and immediately responded to during the same cycle, with processing due to occur the next cycle at the earliest: clearing the responses would cause these to be lost.
Several potential fixes to this may be:
- Deprecate zero-cycle memory responses. All responses must arrive the cycle after they were made, at the earliest. However, this would necessitate the introduction of a more complex in-order model that can handle multi-cycle loads, and may prevent simulation of some simpler processors.
- Make zero-cycle memory responses a first-class feature. All systems should acknowledge the potential for zero-cycle responses, and anticipate that a response may arrive synchronously, immediately after the request was made. This may slightly impact performance, as memory-related systems may end up performing unnecessary scans of the memory interface for non-zero-cycle latency models.
- Per-response clearing. Allow responses to be individually removed from the memory interface. This may introduce additional overhead, but would remove the need for clearing entirely.