-
Notifications
You must be signed in to change notification settings - Fork 177
Eliminate CHIRRTL #727
Comments
The current proposal is to remove MPort's after running ExpandWhens. To handle mport enables, we will need to add an explicit enable field in MPorts. One problem I haven't solved yet is how to handle the read enable for non-combinational read ports (for combinational reads, the enable can always be true without loss of QOR). The current CHIRRTL and Chisel semantics is that the enable is true wherever the address is combinationally assigned to (thus always true if address is a register), not where it is declared. Thus:
should be compiled to:
This would just require more special casing in ExpandWhen's to keep track of wherever these mports are referenced, and then add them to the enable field. If feels very inelegant. |
Another thought is to change mports to have two fields, an enable and a data field:
should be easily expanded after ExpandWhens:
then the mports can be removed:
|
@azidar, one thing to note is that I have a patch for |
Plan of record is to support memory port as new IR statement to support, which has a clock and enable port. Have to remove after expandwhens but before middle form, is part of high form. CHIRRTL:
AFTER RESOLVE ENABLE:
AFTER EXPAND WHENS:
AFTER REMOVE MPORT:
Why you can't support unconditional clock assignment to mem port:
|
Adding on some more summary notes for future reference:
Since this subsumes #286, #512, #840, #913, and #1161, I've closed those issues. |
New conclusion: add optional enable to mport. resolve whens. with flag, add optimization that deasserts enable when address is invalid. This preserves existing behavior, gives clear spec semantics, and has a clean implementation. |
Sounds reasonable, but the enable pin often has a long setup time (moreso than the address for some RAMs), so any magic that could add additional logic to the enable should be optional. In particular, it shouldn't be mandatory that an invalid address kills the enable, even though that's a valid thing to do. |
That is actually well-aligned with how we're changing it. The current implementation of What we've now resolved is that there will be a new explicit enable that is driven by a new, optional parameter in the Chisel API. The spec for inferred |
Thanks for the explanation. It seems like a pretty coherent strategy (just don't mess up code gen for current designs in the process of implementing it :)) |
Type of issue
What is the use case for changing the behavior?
Lowering pass generates Firrtl with memory's clock connected to validIf #702 exposes a problem with the current way we are handling memory ports with CHIRRTL. The plan of record is to remove CHIRRTL entirely, and add MPort as first-class node in the FIRRTL IR.
This issue is to track discussions about how to make this possible.
Impact
Development Phase
The advantages of this approach is that CHIRRTL is a wart, bridging how FIRRTL handles memories, and how Chisel handles memories. See #702 for more detail.
The text was updated successfully, but these errors were encountered: