Curious ALU problem.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Curious ALU problem.

Mark M
I have built and successfully tested ALU but to do so I had to remove the invert from the NG pin so it tests for a 1 instead of a Zero on bit 15 of the output. And the 2s complement in the hardware sim seems back to front. for example an output value of 19 (dec) is listed as 0000000000010011 (Bin) I thought that positive numbers had a leading 1 and negatives a leading zero in 2s complement.

Could someone explain this to me please I'm a little confused as this seems back to front.
Reply | Threaded
Open this post in threaded view
|

Re: Curious ALU problem.

cadet1620
Administrator
Look at Figure 2.1; all negative numbers have the sign bit set.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Curious ALU problem.

Mark M
Thanks Mark

All clear now,
I've read that part of the Chapter several times over and still managed to convince myself that it was the opposite way round, must have had a brain freeze or something.

Still it's one chip and one line of code less, I guess 15 lines isn't too bad for a first attempt I expect I could probably optimise that down by playing with the muxes a bit. But it works so I may not bother.

I haven't done any digital design for some years, I'm an analogue man mostly (Audio stuff), It's amazing how much you forget.

Regards (another) Mark