Hacker News new | comments | show | ask | jobs | submit login
Inside the vintage 74181 ALU chip: how it works and why it's so strange (righto.com)
92 points by dwaxe on Mar 19, 2017 | hide | past | web | favorite | 13 comments

Wow, what a blast from the past. I remember gazing at the data book as a kid[+], wondering what sort of super genius came up with some of those bizarre operations and wondering when I'd learn enough / be smart enough to want to use them all.

Never did get around to figuring it out and now I don't have to!

[+] Once upon a time you could write to TI, National etc and they would send you data sheets and even whole databooks for free. (I think I remember buying a set of TI TTL datebooks at a junk shop, but I think National or Linear would send theirs for free). Since I had to pay for parts out of my pocket money there was a lot of pouring over designs before getting parts and trying to build anything. I guess this is the equivalent of the folks who had to submit card decks once a day.

In my assembler and technician days I stayed alert to visits by distributor reps: older but good databooks were likely to be found in the trashbins shortly thereafter, ready to be fished out and taken home.

These days, for a given part-number, Googling "part-number pdf" returns links to where datasheets can be downloaded. This is a distinct improvement: disk space is easier found than shelf space.

You can still find scans of the databooks at archive.org (and if you have some, you are encouraged to contribute...), especially useful for information on obsolete parts whose datasheets were never available separately in digital form.

My fellow engineers in the early 80s used to collect so many free databooks that we joked we heated our houses by burning them.

I remember using this chip in college in a "build a CPU from scratch" course.

Most teams implemented these elaborate instruction decoding methods, mapping 000 -> addition, 001 -> and, etc.

We just jammed 4 bits from our opcode right into the ALU select, so we ended up with all of the weird operations this writeup documents. Worked great; our CPU was almost "too simple".

Woz would have approved, I think.

I built a working computer in Minecraft, and ended up going with exactly that because the decoding circuits would have been too complex for the project otherwise: https://www.youtube.com/watch?v=s9XT-dyfEiU

This build could be improved in a lot of ways as I've grown as a developer and engineer in the years since I built it, but back then, "Jam the opcode bits into the ALU" was the simplest thing I could think of at the time, and worked quite well. If I ever tackle something like this again (a year's worth of Redstone is... I'm not sure I have the patience for that anymore) I'd like to try an 8-bit system just for the challenge of packing the opcodes down a bit. The 16-bit opcodes I used here were rather inefficient.

I'm seriously wondering at this point how many college CS assignments meant to be completed in Logic Works (or some equivalent) have instead been implemented in Minecraft. If Minecraft existed when I went through college, I imagine it's one of the things I might have attempted (at least for the simpler assignments).

Kudos to any teachers that use Minecraft as a neat visual aid. That would have been awesome.

> We just jammed 4 bits from our opcode right into the ALU select

That's how it is meant to be used, so props to you for picking the right (and shortest) path.

It's one way to use the 74181, but there are others. For instance the Xerox Alto uses a PROM to map opcode bits to the 16 most useful 74181 operations, calling the others "relatively useless".

Space/speed trade-off.

The custom CPU for Cinematronics (Vectorbeam) games used three of these (from https://archive.org/details/ArcadeGameManualRipoff)

The ALU is implemented using three 24LS181 (N6M6L6) function generators, three 74LS85 (N9,M9,L9) 4 bit magnitude comparators, and a 74S182 (L4) look ahead carry generator.

It amazes me that making a 12 bit processor out of TTL was still a reasonable thing to do in the late 1970s.

I think the key insight that lead to its development is the realisation that, if you have a carry-lookahead adder/subtractor, P and G already provide OR and AND (along with their negations), and taken together without the carry lookahead logic enabled, give XOR.

An existing article about how the '181 works starts here and continues for a few pages:


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact