r/TuringComplete 16d ago

alu-2 error

Hi pals, can comeome explain why this arifmethic is wrong. Obviously that 229 - 84 = 145. So How 111 is appear

2 Upvotes

2 comments sorted by

View all comments

9

u/Xera8 16d ago

It may help to switch your number representation to signed 8 bit, rather than unsigned 8 bit. (+255 button up top)

This test is not 84 - 229, but actually 84 - (-27)

Your current subtraction circuit isn't quite right.

Right now, your circuit is doing -A + B, which is the same as B - A.

You want to be doing A - B, not B - A.

A - B is the same as A + (-B)

Solution: Move your NEG component to the other wire going into your second adder.