No more secrets Part D: Here is the ALU: all together now!

Da raspibo.
Jump to navigation Jump to search

The entire ALU is now able to perform many different computations:

F1 F0 enA enB invB Cin Sign  Result
0  1  0   0   0    x   x     0
1  0  0   0   0    1   x     1
0  1  0   0   1    x   x     -1 (all output bits are set to one)
0  1  1   0   0    x   x     A
0  1  0   1   0    x   x     B
0  1  0   1   1    x   x     not B
0  0  1   1   0    x   x     A and B (bitwise)
0  1  1   1   0    x   x     A or B (bitwise)
0  0  1   1   1    x   x     A and not B (bitwise)
0  1  1   1   1    x   x     A or not B (bitwise)
1  0  1   1   0    0   0/1   A + B
1  0  1   1   1    1   0/1   A - B
1  0  1   0   0    1   0/1   A + 1
1  0  1   0   1    0   0/1   A - 1
1  1  1   1   1    1   0/1   1 if A<B, 0 otherwise
1  1  1   0   1    1   0/1   1 if A<0, 0 otherwise
1  1  0   1   1    1   0/1   1 if B>0, 0 otherwise