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 = AMSB ⊕ BMSB ∧ (FMSB ⊕ AMSB)
A subtraction overflows, if the inputs are of different sign and the result
has a sign different from A's sign.
OV = (AMSB ⊕ BMSB) ∧ (FMSB ⊕ AMSB)
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 ⊕ AMSB ⊕ BMSB) ∧ (FMSB ⊕ AMSB)
Or as a schematic:
