-
Notifications
You must be signed in to change notification settings - Fork 53
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
Calyx does not correctly support zero bit values #1866
Comments
I think at the Calyx level, this would be easy to do. The big question is how do we correctly parameterize primitives like memories to actually accept zero-bit ports. For example, the parameterization currently looks like this: https://github.com/calyxir/calyx/blob/main/primitives/memories.sv#L16 I assume if we just dump out 0 for the idx port, we'd get incorrect/failing Verilog compilation. A possible alternative is using |
I don't think that would be too complex, but can registers be external in the same way as memories? |
Ah, if that is the only limitation then we should change registers to also accept If that would solve the problem @andrewb1999, can you open a new issue about it? We can keep this one open as a separate question. CC @EclecticGriffin @sampsyo since this affects semantics |
@calyxir/semantics (because I just made a team) |
Interesting point about the Verilog implementation… I guess the overall question is: do we need to eliminate all 0-bit signals before emitting Verilog? (That is, does Verilog (or do common Verilog implementations) not support the creation of 0-bit wires, even if they are never read or written?) That seems likely and, if so, it seems like there are two parts to coping with this:
Anyway, I guess all I'm saying is that this points in the direction of a compiler pass that eliminates zero-width wires, if we believe we must expunge them before emitting Verilog? |
|
Zero bit values are useful for cases where memories have a single value, and therefore do not need an address port. Currently memories will need idx_bits to be set to at least 1 to ensure no zero bit values are created. This makes memory generators more complicated and introduces extra unnecessary wires.
Zero bit values can be treated as if they do not exist, and should likely be removed before calling a backend (Verilog specifically does not support zero bit values). Currently, Calyx fails during verilog generation and gives an error about overflow on subtraction.
The most immediate use case for this is to allow the AMC frontend to support memories with a single value.
The text was updated successfully, but these errors were encountered: