--- Quote Start ---
The operator resize is new for me (thanks for the hint btw).
--- Quote End ---
No problem :)
Its a useful operator in that it will sign-extend for you.
--- Quote Start ---
I have not any more time to test until monday (maybe) but using them as SIGNED makes no sense for the projet (it represents one bit less available, except if you want it to spin a robot and it displays in the other sense). I just compiled the code using UNSIGNED and it seems exactly the same(loking at the RTL).
--- Quote End ---
If you draw yourself a "number circle" you'll find that an N-bit signed number or unsigned number has exactly the same binary patterns, so whether you use one format or the other really depends on what makes the most sense to you.
For example, a 3-bit number can represent
Bin U S
-- - -
000 0 0
001 1 1
010 2 2
011 3 3
100 4 -4
101 5 -3
110 6 -2
111 7 -1
In either case;
Unsigned: 101 + 100 = 5 + 4 -> 1 = 001
Signed: 101 + 010 = -3 + 4 -> +1 = 001
The point is that you can use the SIGNED data type without needing to use an extra bit relative to UNSIGNED. If you need a 31-bit representation for your modulo math, it can be signed or unsigned.
Cheers,
Dave