Got myself a bunch of 74LS181, because they were cheap and they have been used in the VAX 11/780. And now I made myself a little tester breadboard where I am trying to figure this out in practice. My head is spinning from all this active low and high and open collector (A=B), etc.
I wonder if the VAX or some PDP-8 might have used this ALU in active low mode? Then they would have to have all the registers in active low also, or inverting buffers, crazy. I'm only thinking about the active high mode now.
But then the carry-in is weird, it has to be held high the whole time. This is extremely annoying because how will I do an add-with-carry if I have to hold the carry high just to make an add?
The A=B output is also weird, because you would want a zero flag, but there is none, the A=B flag is an all-1 flag (I suppose it's a zero flag in active low mode? Why would they bias this device to be more useful in active low mode?
And all that complexity comes just for having a huge amount of weird functions which I have no idea how to use?
- OK not A (regardless of B)
- OK A (regardless of B), but mind the carry or else it's A-1, also OK
- ?? not A or not B, that's a strange one
- ?? A or B, but mind the carry, and it's on the arithmetic side, there is a pure logical A or B also near the end
- ?? not A and B
- ?? A or not B
- OK all bits off
- OK minus 1, all bits on
- ?? A nand B, sure, a universal gate, but in an ALU?
- ?? A plus (A and not B), woah!
- OK not B (regardless of A), symmetric to 1st
- ?? (A or B) plus (A and not B), but mind the carry!!!
- OK A xor B
- OK A minus B, with carry L, test 7 - 2 = 5 the output carry is H, that seems so weird! Do we have to think of carry being active low?
- ?? A and not B, perhaps useful to clear in A the bits of B
- ?? (A and B) - 1
- ?? not A or B
- ?? A plus (A and B)
- ?? not A xor not B
- OK A plus B, but with carry H, if L you get A plus B + 1, so how can you do an add with carry? Or does this mean carry is actually active low? That would fit with the subtraction weirdness?
- OK B (regardless of A and carry)
- ?? (A of not B) plus (A and B), whoa!!!! Who in the world would have ever used this?
- OK A and B
- ?? (A and B) - 1
- OK all bit on
- OK A plus A (a left shift)
- ?? A or not B
- ?? (A + B) plus A
- OK A or B
- ?? (A + not B) plus A
- OK A (regardless of B and carry)
- OK A minus 1 (if carry is H)
Of 32 functions only 15 (less than half!) seem useful to me.
But then, I remember that the PDP-8 instruction set has no OR, so people had to use some weird combination of AND and TAD. Perhaps among the seemingly useless functions are some useful ones?
Any right shift perhaps?
Anything useful to speed up multiplication or division loops?
Note, I am not asking "why" is it the way it is. I am sure there is a certain beauty and symmetry, to all of this and a minimization of transistors. My question was how more than half of the functions that seem so weird were actually useful to anyone?