Closed
Description
Right now the memory geometry (shape/width and depth) are set either on MemoryInstance
(the internal perma-unstable primitive) or on lib.memory.Memory
(the user-facing interface). However, this creates a problem for the simulator:
MemoryInstance
is not really usable for most code, so whatever it's doing is irrelevant for 99% of users.lib.memory.Memory
can't be directly read usingsim.memory_{read,write}
from RFC 36; those primitives only work onMemoryIdentity
, which is a marker class whose only purpose is to have an identity.- Also we have no primitives for calling
sim.memory_{read,write}
onlib.memory.Memory
at the moment.
- Also we have no primitives for calling
- Neither
lib.memory.Memory
norMemoryInstance
can be passed totraces=[]
, you have to pass aMemoryInstance
.
To solve this, I think we should have a MemoryData(shape: ShapeLike, depth: int, init: MemoryData.Init)
class, which is essentially the 2d counterpart of Signal()
. Once we add this, we:
- Remove/replace
MemoryIdentity
withMemoryData
. - Teach
sim.memory_{read,write}
to useMemoryData
. - Teach
write_vcd(traces=[...])
to useMemoryData
. - Add a
lib.memory.Memory(data=)
constructor that acceptsMemoryData
.- Unclear whether the existing constructor
lib.memory.MemoryData(shape=, depth=)
should be kept.
- Unclear whether the existing constructor