74181 arithmetic mode

M=0


For a detailed list of 74181 operations, please consult the 74LS181/ 74S181 datasheet.
(In all examples mentioned here: high_active A,B,F and low_active carry at the 74181 I/O_pins)
For convenience, we call the F_outputs Q, like in all other ALU examples.

Basically, it works a bit like the first version of my multiplexer_ALU
mentioned in the previous article.

Q=A+B: S3..0 = 1001
The blue marked ANDs are active, so that !P=!(A|B) and !G=!(A&B).
To make it short, a NOR for !P and a NAND for !G, like in the 74283.
The first XOR emits 0, wenn !P=!G.
Means, it emits 1, when !P is active, and !G is inactive...
so we have the first half adder.
Now the second XOR as the other half_adder, adding the Carry.
It's easy.

Q=A-B: S3..0 = 0110
The red marked ANDs are active.
Basically it's like A+B, with B inverted.
Note: borrow is low_active, like with the 6502.

Q=A+1: S3..0 = 0000
Generate is inactive. Propagate is A. ALU output is A+Carry_input.
All we have to do is to force the Carry_input to active.

Q=A-1: S3..0 = 1111
When enabling the red and blue marked ANDs, we have A+(B|!B),
what is identical to A+1.
The ALU will perform an addition, acting like all B_Inputs would be 1.
What would be the same as adding -1, or decrementing.

Q=A+A: S3..0 = 1100
Both generate_ANDs are active, so the B_signals will be eliminated
(because !B|B=1), setting the propagate and generate signals to A.
To make it short, we are adding A with A, what is identical
to shifting A left.

Note: 74181 can't shift right.


[HOME] [UP]/ [BACK] [1] [2] [3] [4] [5] [6] [7] [8] [NEXT]

(c) Dieter Mueller 2005