-
Notifications
You must be signed in to change notification settings - Fork 156
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
Code duplication/divergence in (System)Verilog backends is going to bite us someday. #220
Comments
Integer often winds up being represented by 64 bits. When using fromInteger# to assign to, say, a 'BitVector 8', this is fine in Verilog, because the top 64-8 bits get discarded. But because the template is an expression template, it can also get applied inside of a bitstring concatentation like {x, y, $unsigned(an_integer), z} Here the difference between an 8-bit and a 64-bit value changes the meaning of the expression. This commit explicitly slices Integers when moving into four common sized integer-like types. See clash-lang#219 (this may not be a complete fix for that bug) and clash-lang#220 (filed as a result of this work)
This primitive template was syntactically invalid, so I can only assume we never generate it? Found during my expression template review under clash-lang#219. Note that the same mistake has appeared in both the Verilog and SystemVerilog backends; see clash-lang#220.
@thoughtpolice is planning to fold the current backends into The reason they don't share code right now is mostly for pragmatic/lazy reasons:
Anyhow, option 2 will (eventually) happen when the current backends get merged into |
Thanks for the historical context. I'm happy to hold off and let @thoughtpolice do this, or to pitch in myself. |
I need to revive my WIP branch. Just moving everything in isn't too hard; I'll get to it soon... |
The Verilog and SystemVerilog backends have a lot in common. Nearly parallel code. Nearly identical primitives.
Nearly. They diverge in places. Some of those places are probably intentional.
The two target languages are so similar that the backends ought to share code. I'm filing this to seek feedback before I go crazy and clean anything up.
I see two obvious options:
My preference would be for option 2 -- the rest of the compiler would not notice, and it reduces boilerplate.
The text was updated successfully, but these errors were encountered: