-
Notifications
You must be signed in to change notification settings - Fork 23
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
Wiring doesn't check for type match, only length match #457
Comments
Currently, Wiring is structural. So, if two types have the same structure, then they can be connected. If you want to override the behavior or wiring, you can overload the operator on the class to be stricter. Operators depend on the type. For example, they can add checks the types. Open to suggestions. |
It seem like right now, if you have a signed add module, you can send unsigned inputs to it and it will wire it without an error. IMO I would prefer it to give an error in this case unless you do an explicit cast. A lot of problems of Verilog come up because it doesn't do typechecking like this. Thoughts anybody? |
Except wiring is not structural, because I can't wire |
Wiring a scalar to an array is not normally considered structural. |
I agree that the add should do type checking. Let me look at the code. |
That'd be cool, I'd be happy to help too once I clear my plate of some other stuff :) |
Let's move this discussion to hwtypes. And get @leonardt and @cdonovick involved. |
I think this discussion would fit well under leonardt/hwtypes#98 |
Ports with bit type, uint type, and sint type can be wired to each other, as long as the length matches. Don't we want to check that they type itself matches, and require an explicit cast?
The text was updated successfully, but these errors were encountered: