nmigen-tutorial
nmigen-tutorial copied to clipboard
Confusing explanation about signal width
In 6_combining.md there is a slightly confusing explanation:
Here,
a+bmust be a 17-bit signal because in Python, integers are as wide as they need to be.
Please correct me if I'm wrong, but I think it has nothing to do with Python integers behaviour: Signal operators are overloaded (e.g. __add__ in Value which is inherited by Signal) so this behaviour is down to nMigen.
Well, yes, I guess I should say that an expression has as many bits as it needs, until it is assigned to a signal, and then the result is truncated to the signal's width.