Open uenoku opened 1 year ago
I added a workaround to lower ref type values for this issue https://github.com/llvm/circt/commit/8b105752d8d43881c9ad40d46827ee2adf75e551. Feel free to revert the commit.
To fix this issue, we have to lower reftype ports and tapped wires into unpacked arrays.
Discussed a bit, and the conclusion was that the issue is that cmem
misrepresents its type as a vector (UInt<8>[8]
), which in FIRRTL always means "packed".
Ref types only make it possible to avoid noticing it and generate invalid Verilog from (:disappointed: ; we could additionally eventually type-check XMR's in HW in the future?), but the heart of the matter is that it says it's a packed vector (and later, creates a ref type for a packed vector) and then its implementation is actually unpacked and that's no good.
I'm not sure how to best rework cmem
to avoid this, but in CIRCT anyway could we perhaps just give it the right type (hw::UnpackedArray
)? CHIRRTL is a distance from HW, but also it'd be good to not have it using an inaccurate type (and I don't believe we want to add an unpacked type to FIRRTL, at least not anytime soon?).
Currently registers of memories are emitted as unpacked arrays. MemTapAnnotation taps wires for each register but with aggregate preservation, these wires are emitted as packed arrays. Hence it will cause a complication error. For example,
Current output:
It is not allowed to assign an unpaked array to a packed array.