-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Default assignments for non-@data
ports
#1919
Comments
Relevant to @calyxir/semantics! |
Was this supposed to be closed? |
The pass adds these assignments automatically but we should discuss what the right thing to do semantically is |
Ah gotcha |
Fascinating! Yes, it seems like this is relevant to a somewhat larger discussion (which does not have an issue yet, IIRC) about moving default-0 assignments from the Verilog backend to an actual, proper Calyx pass. The advantages would be (1) the semantics are clearer, (2) the 0-assignment insertion could be shared between the Verilog and FIRRTL backends instead of reimplemented separately by both, and (3) we would have a chance to optimize them away ourselves opportunistically. Roughly speaking, you can imagine making this work by taking each non- In the long term, you can even imagine flipping the defaults, so ports must be annotated with |
If there are no assignments to a non-
@data
port, the compiler will fail to generate a default assignment for that port leading to that control-path value being set to'x
. The following example on #1607 fails because of this:Data file:
Expected output:
Actual output:
The problem is that because
write_en
is set to'x
, the readm[1]
returns0
instead of20
.The solution is adding a compilation pass that generates default assignments to non-
@data
ports with no source-level assignments. It's a little tricky to figure out where exactly this pass should go since adding it at the start of the compilation will breakdead-cell-removal
andcell-sharing
passes.The text was updated successfully, but these errors were encountered: