nmigen-tutorial icon indicating copy to clipboard operation
nmigen-tutorial copied to clipboard

Confusing explanation about signal width

Open DurandA opened this issue 4 years ago • 1 comments

In 6_combining.md there is a slightly confusing explanation:

Here, a+b must 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.

DurandA avatar Dec 11 '20 04:12 DurandA

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.

RobertBaruch avatar Dec 11 '20 15:12 RobertBaruch