Unlike the '381/'381 the '181 has no overflow bit output, so we need to look at the MSB (sign bit) of the A and B inputs to the ALU and the F output depending on whether it is an addition or subtraction.
An addition overflows, if the inputs are of same sign and the result is of different sign.
OV
= A
MSB ⊕ B
MSB ∧ (F
MSB ⊕ A
MSB)
A subtraction overflows, if the inputs are of different sign and the result
has a sign different from A
's sign.
OV
= (A
MSB ⊕ B
MSB) ∧ (F
MSB ⊕ A
MSB)
Notice how the only difference is the presence or absence of the
negation on the first exclusive-or term. So when we spend a signal
/SUB
indicating whether we add or
subtract, we could say:
OV
= (/SUB
⊕ A
MSB ⊕ B
MSB) ∧ (F
MSB ⊕ A
MSB)
Or as a schematic: