-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hard to obtain needed context to build IR for referencing results of FirrtlMemory
#4022
Comments
This is a tricky one. The type of chisel/src/main/scala/chisel3/util/SRAM.scala Line 641 in 03ef61f
wmask : chisel/src/main/scala/chisel3/util/SRAM.scala Line 564 in 03ef61f
It's not super clean, but for computing the field index, |
I’m wondering how about going to another path to intmodule version of SRAM? w/o using firrtl.mem as intermediate representation? We also have some problem on the memory for the mbist which cannot be represented by firrtl ir. |
@jackkoenig I apologize for the late update. Let's say a mem mem_sram :
data-type => UInt<8>
depth => 1024
read-latency => 1
write-latency => 1
reader => R0
writer => W0
readwriter => RW0
read-under-write => undefined and auto connect them to a connect mem_sram.R0.addr, mem.readPorts[0].address
connect mem_sram.R0.clk, clock
connect mem.readPorts[0].data, mem_sram.R0.data
connect mem_sram.R0.en, mem.readPorts[0].enable
connect mem_sram.W0.addr, mem.writePorts[0].address
connect mem_sram.W0.clk, clock
connect mem_sram.W0.data, mem.writePorts[0].data
connect mem_sram.W0.en, mem.writePorts[0].enable
connect mem_sram.W0.mask, UInt<1>(0h1)
connect mem_sram.RW0.addr, mem.readwritePorts[0].address
connect mem_sram.RW0.clk, clock
connect mem_sram.RW0.en, mem.readwritePorts[0].enable
connect mem.readwritePorts[0].readData, mem_sram.RW0.rdata
connect mem_sram.RW0.wdata, mem.readwritePorts[0].writeData
connect mem_sram.RW0.wmode, mem.readwritePorts[0].isWrite
connect mem_sram.RW0.wmask, UInt<1>(0h1) The concrete value of
chisel/core/src/main/scala/chisel3/internal/firrtl/IR.scala Lines 291 to 299 in d4dd11c
So the first thing is that we need a way to determine which referenced mem port (e.g. Then, we need to know which bundle the field (e.g chisel/panamaconverter/src/PanamaCIRCTConverter.scala Lines 378 to 381 in d4dd11c
These are the difficulties I can imagine at the moment and I'm trying to explain it clearly, but if you have any further questions please feel free to ask me. |
I'm trying to add support for #3955 in panama converter, and it's working in progress under
binder-fir-mem-binding
branch (code is a bit mess at the moment). We create IRfirrtl.memory
forFirrtlMemory
, the IR returns multipleMlirValue
results based on the number of ports.So far, I seem to be successfully associating the
MlirValue
with the target port viaSramTarget
. For referencing normal bundle fields, we compute the field index (becausefirrtl.subfield
needs index) viachisel.data.binding
(code). But for referencing fields under ports ofFirrtlMemory
in subsequent operations, something likeSlot(Slot(Node(chisel3.SramTarget),RW0),wmask)
is given in the Chisel IR - only the field name is provided in theSlot
.Currently panama converter does not store types itself, but tries its best to use the context given by Chisel internal. Am I missing a clean way to compute their indexes? Reflection might work, but it's not really clean to me. Maybe we should make some changes / improvements to
FirrtlMemory
?The text was updated successfully, but these errors were encountered: