Add16 and input bits seem inverted, why?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Add16 and input bits seem inverted, why?

wetFence
I don't understand how the Add16 inputs work.

In my mind these two things are equivalent:
b=0000000000000001
and
b[15]=true
Am I correct?

So if I do
Add16(a=false, b[15]=true, out=out);
then I would expect the result to be
0000000000000001
but instead it is
1000000000000000

To get the right result, I have to do
b[0]=true

Why the inversion?

I know my Add16 is valid because it passes the tests, I'm trying to implement Inc16 from Add16 chips.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add16 and input bits seem inverted, why?

ybakos
The 16 bits are indexed right-to-left.

When bit 15 is a 1, and the rest are 0, you have 1000000000000000.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add16 and input bits seem inverted, why?

cadet1620
Administrator
In reply to this post by wetFence
The rationale for numbering hardware bits from right to left is so that bit n is the 2n-weighted bit of the binary number on the bus.

--Mark

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add16 and input bits seem inverted, why?

wetFence
Thanks to both of you, that makes sense now.
Loading...