Explaining The Operation Of The 74181 ALU

You will all no doubt be familiar with the 74 series logic integrated circuits, they provide the glue logic for countless projects. If you look back through old listings of the series you’ll find alongside the familiar simple gates a host of now obsolete chips that reveal their roots in the pre-microprocessor computer industry of the late 1960s, implementing entire functions that would now be integrated.

One of the more famous of these devices is the 74181, a cascadable 4-bit arithmetic logic unit, or ALU. An ALU is the heart of a microprocessor, performing its operations. The 74181 appeared in many late-60s and early-70s minicomputers, will be familiar to generations of EE and CS students as the device they were taught about ALUs on, and can now be found in some home-built retrocomputers.

[Ken Shirriff], doyen of the integrated circuit teardown, has published a piece taking a look at the 74181, in particular at its logic functions and the reason for some of them that are rather surprising. As well as the normal logic functions, for example the chip can do “(A + B) PLUS AB“. Why on earth you might think would an ALU need to do that?

The answer lies in the way it performs carrying while adding, a significant speed-up can be achieved over ripple carrying along a chain of adders if it can be ascertained whether a bit addition might generate a carry bit. He explains the function required to perform this operation, and suddenly the unusual extra function makes sense. Addition is transformed from a serial process to a parallel one, with a consequent speed increase.

It’s one of those moments in which you have to salute those logic designers from an era when on-chip real-estate was costly and every ounce of speed had to be teased from their designs. Give it a read, and have a go at the interactive 74181 simulator further down [Ken]’s page. We learned something from the article, and so may you.

We brought you the first part of [Ken]’s 74181 investigations earlier in the year. If you would like to see a 74181 in action, take a look at this 4-bit 74 logic single board computer.

17 thoughts on “Explaining The Operation Of The 74181 ALU

  1. There’s also a carry look-ahead generator, the 74182, which speeded up carry propagation over 4 x 74181s, to make a faster 16 bit ALU. In 1972 I got as far as wiring that much up, but never did find time to go much further with a DIY CPU design. The board is still around here somewhere.

    1. There is a decent-sized group of retrocomputing afficionados not fueled by nostalgia alone. These circuits contain interesting, pretty elegant solutions for problems of the day that some see as inspiring.

      1. Yup, agreed. I’m building a “retro”-ish (computing power-wise) computer on gate-level (end result will be 74xx gates, right now purely design stage), so I like it when HaD posts stuff on logic-gate level stuff like this, low-level programming or otherwise “retro”/simplified computing topics.

        Mr Benchoff, please keep these coming! :)

          1. you need to seek out some of the early miniframes like Cromemco. I was lucky enough to get my hands on one back in the early 90’s because a business auction had no idea what it was and I bought it at metal scrap price. Hacked the root password and had a 16 terminal miniframe computer in the house where I started to learn a Unix. it had a HUGE hard drive with a clear case in the bottom Luckily it had a emergency repair mode that you could short a jumper on the board to force it to boot to single user mode, I then found the /etc/passwd file and exported it over serial to a zenith laptop, edited it to have a new hash for root that was a known password and then sent it back. removed the jumper and rebooted, BOOM I AM ROOT!…

            I then played with the old database as well as the financial software that was still on it. when I was lucky enough to discover that whoever managed the device read all the OS install floppies into binary images on the drive. I simply did a DD -if /images/floppyX of /dev/fd0 and had a full set of not only the install disks, but the DB install disks and the Development environment that was not even installed. Serial terminals ROCKED!

  2. As an old fart, I absolutely LOVE the idea of implementing CPUs in FPGAs instead of by wirewrapping boards full of DIPs.

    Finally, the imaginary HDL I learned in college is real, and can be used to create actual hardware!

    1. PAL/CPLD/FPGA were all originally meant to get your stuff short-run tested prior to a high volume ASIC run.

      Since the FPGA were eventually used in production hardware, there are now versions that are hybridized with built in flash and ARM cpus.

      There are even free Verilog to gcc C compilers around that will auto-generate modular logic testing software source code. I’ve been contemplating how complex exporting KiCAD tagged-symbolic logic symbols with net-lists into a form the logic compiler understands… ;-)

    2. I looked at this and thought it would be a good way to learn schematic entry. Then when I looked at the schematic I thought VHDL is still easier. I guess I will never learn schematic entry which is no loss because with the complexity of modern CPLDs/FPGA schematic entry is close to useless anyway.

      It would be interesting to scale this to 8 bits though, through in some registers and addressing and see what you get.

      I went through my junk box yesterday and found 100 Xilinx XC9536XL’s (36 registers) and this looks like an experiment made for little CPDs like that.

      1. I bought a bunch of Xilinx XC9536 and XC9572 chips about a decade ago. I think I even have a few bigger chips, but not many. I’ve always really enjoyed logic design, and I got the chips specifically because the software supported schematic entry. I honestly don’t know the first thing about any of the languages used for CPLDs and FPGAs though.

        1. For small chips there is PALASM and CUPL languages which are variants of Boolean expressions. These were often used in the era of PLA/PAL/GAL. The mainstream IDEs — Altera Quartus and Xilinx ISE both support VHDL and Verilog and as far as I know they both also support schematic entry.

          There are some new players in the field as well. I saw one that is intended to be very ‘C’ like.

  3. I still have two of these beautiful IC’s. My electronics teacher dared us to create our own out of OR’s, AND’s, and the N and X varieties. I along with 2 other techs built one in 74xx and 4xxx logic. Needless to say, it worked, and could do 4-bit math easily. It’s a wonder, in the old days (circa ’85), that they used SX processors (that if you needed extra “math functions”), that you would need the “1 digit more Math Co-processor” as well. :) I miss those days. -KC8KVA

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s