One of the more famous of these devices is the , a cascadable 4-bit arithmetic logic unit, or ALU. An ALU is the heart of a microprocessor. The ALU (arithmetic/logic unit) chip powered many of the minicomputers of the s: it provided fast 4-bit arithmetic and logic functions. Taming the 74LS ALU The 74LS is an old chip. I first found it in my Motorola LS-TTL handbook. At first sight it seems magical.
|Published (Last):||7 September 2013|
|PDF File Size:||16.25 Mb|
|ePub File Size:||1.90 Mb|
|Price:||Free* [*Free Regsitration Required]|
The internal structure of the chip is surprisingly complex and difficult to understand at first. The chip is important because of its key role in minicomputer history.
Before the microprocessor era, minicomputers built their processors from boards of individual chips. Early minicomputers built ALUs out of a large number of simple gates.
This chip provided 32 arithmetic and logic functions, as well as carry lookahead for high performance. Using the chip simplified the design of a minicomputer processor and made it more compact, so it was used in many minicomputers.
The is still used today in retro hacker projects. The implements a 4-bit ALU providing 16 logic functions and 16 arithmetic functions, as the datasheet below shows. The datasheet for the ALU chip shows a strange variety of operations. So how is the implemented and why does it include such strange operations? Is there any reason behind the ‘s operations, or did they just randomly throw things in?
And why are the logic functions and arithmetic functions in any particular row apparently unrelated? I investigated the chip to find out. There’s actually a system behind the ‘s set of functions: Why are there 16 possible functions? If you have a Boolean function f A,B on one-bit inputs, there are 4 rows in the truth table. Each row can output 0 or 1. These 16 functions are selected by the S0-S3 select inputs.
It turns out that there is a rational system behind the operation set: Other arithmetic functions take a bit more analysis.
Even though you’re doing addition, the result is a logical function since no carry can be generated. The other strange arithmetic functions can be understood similarly. Thus, the 16 arithmetic functions of the are a consequence of combining addition with one of the 16 74lw181 functions. Even though many of the functions are strange and probably useless, there’s a reason for them.
The Boolean aul functions for arithmetic are in a different order than for logical operations, explaining why there’s no obvious connection between the arithmetic and logical functions. The straightforward but slow way to build an adder is to use a simple one-bit full adders for each bit, with the carry out of one adder going into the next adder. The result is kind of like doing long addition by hand: This “ripple carry” makes addition a serial operation instead of a parallel operation, harming the processor’s performance.
To avoid this, the computes the carries first and then adds all four bits in parallel, avoiding the delay of ripple carry. This may a,u impossible: The answer is carry lookahead. Carry lookahead uses “Generate” and “Propagate” signals to determine if each bit position will always generate a carry or can potentially generate a carry. This is called the Generate case. This is called the Propagate case since if 7ls181 is a carry-in, it is propagated to the carry out.
The carry from each bit position can be computed from the P and G signals by determining which combinations can produce a carry. For instance, there will be a carry from bit 0 to bit 1 if P 0 is set i.
Higher-order carries have more cases and are progressively more complicated. For example, consider the carry in to bit 2. First, P 1 must be set for a carry out from bit 1. In addition, a carry either was generated by bit 1 or propagated from bit 0.
Finally, the first carry must have come from somewhere: Putting this all together produces the function used by the As 7l4s181 can see, the carry logic gets more complicated for higher-order bits, but the point is that each carry can be computed from G and P terms and the carry-in.
Thus, the carries can be computed in aalu, before the addition takes place. The previous section showed how the P propagate and G generate signals can be used when adding two values. The next step is to examine how P and G are created when adding an arbitrary Boolean function f A, Bas in the In thethe four f values are supplied directly by the four Select S pin values, resulting in the following table: The chip uses the logic block below repeated four times to compute P and G for each bit.
It is straightforward to verify that it implements the table above.
The 74LS181 ALU
This circuit computes the G generate and P propagate signals for each bit of the ALU chip’s sum. The S0-S3 selection lines select which function is added to A. The addition outputs are generated from the internal carries C0 through C3combined with the P and G signals. For the logic operations, the carries are disabled by forcing them all to 1. To select a logic operation, the M input is set to 1. This expression yields all 16 Boolean functions, but in a scrambled order relative to the arithmetic functions.
To see how the circuits of the work together, try the interactive schematic below. The A and B signals are the two 4-bit arguments. The S bits on the right select the operation. C is the carry-in which is inverted.
M is the mode, 74ls11 for logic operations and 0 for arithmetic operations. The dynamic chart under the schematic describes what operation is being performed. The P and G signals are generated by the top part of the circuitry, as described above.
Inside the vintage ALU chip: how it works and why it’s so strange
Alj this, the carry lookahead logic creates the carry C signals by combining the P and G signals with the carry-in Cn. Result and truth table for inputs entered above Select: I opened up a al, took die photos, and reverse engineered its TTL circuitry.
My earlier article discusses the circuitry in detail, but I’ll include a die photo here since it’s a pretty chip. Click al for full size. Around the edges you can see the thin bond wires that connect the pads on the die to the qlu pins. The shiny golden regions are the metal layer, providing the chip’s internal wiring. Underneath the metal, the purplish silicon is doped to form the transistors and ali of the TTL circuits.
The die layout 74lx181 matches the simulator schematic above, with inputs at the top and outputs at the bottom. Die photo of the ALU chip. The metal layer 74ps181 the die is visible; the silicon forming transistors and resistors is hidden behind it.
While the appears at first to be a bunch of gates randomly thrown together to yield bizarre functions, studying it shows that there is a system to its function set: The circuitry is designed around carry lookahead, generating G and P signals, so the result can be produced in parallel without waiting for carry propagation. Modern processors continue to use carry lookahead, but in more complex forms optimized for long words and efficient chip layout. I announce my latest blog posts on Twitter, so follow me at kenshirriff.
The carry-in input and the carry-out output let you chain together multiple chips to add longer words. The simple solution is to ripple the carry from one chip to the next, and many minicomputers used this approach. A faster technique 74ls18 to use a chip, the look-ahead carry generatorthat performs carry lookahead across multiple chips, allowing them to all work in parallel. One thing to note is A PLUS A gives you left shift, but 74ls81 no way to do right shift on the without additional circuitry.
For the ‘s outputs, Propagate must be set for Generate to be meaningful. The carry-lookahead logic in the is almost identical to the earlier 74LS83 adder chip. The ‘s circuitry can be viewed as an extension of the 74LS83 to support 16 Boolean functions and to support logical functions by disabling the carry.
The way the S0 and S1 values appear in the truth table seems backwards to me, but that’s how the chip works. The logic functions are defined in terms of Select inputs as follows: A B F 0 0 S1 0 0 S0 0 0 S2 0 0 S3 Because the first two terms are inverted, the logic function for a particular select input doesn’t match the arithmetic function. The chip has a few additional outputs. P and G are the carry propagate and generate outputs, used for carry lookahead with longer words. The P and G outputs in my schematic are reversed compared to the datasheet, for slightly complicated reasons.
I’m describing the with active-high logic, where a high signal indicates 1, as you’d expect. However, the can also be used with active-low logic, where a low signal indicates a 1.
The works fine with active-low logic except 774ls181 meanings of some pins xlu, and the operations are shuffled around.
Explaining The Operation Of The 74181 ALU
The P and G labels on the datasheet are for active-low logic, so with active-high, they are reversed. One example of a modern carry lookahead adder is Kogge-Stone. See this presentation for more information on modern adders, or this thesis for extensive details. I seem to remember some similar stuff in the high loop of the IFR service monitor, theand had the same one I think. I’d never seen ECL before and if i have since don’t remember it. That would have been a box you would have loved, the IFR service monitor.