• Forum
  • Lounge
  • What is an ALU (arithmetic Logical Unit)

What is an ALU (arithmetic Logical Unit) made of?

So i'm learning about digital design in school and what ALUs are, theoretical. Yes they take inputs and output stuff, but what exactly is it? what is it in real life, how do you implement it? i've seen a picture of an ALU chip, but i still can't wrap my head around it. I know about the theoretical/conceptual design but how does it work in real life? It is just wires that carry bits? if so how does one add these bits? if anyone knows, please explain to me, i'm very confused on how it works in real life, not the conceptual version explained in the book.
What is an ALU made of?
Transistors. Lots of them. And other microscopic electrical primitives.

It is just wires that carry bits? if so how does one add these bits?
You should be familiar with logic gates and their hardware implementation. You should be familiar with things like primitive RS latch and more complex flip-flops. Also more complex things like counters and adders.

Basing on these elements you could create more complex ones. Then from those you can make even more complex things. Essentually this is how all elctronics works.
The difference (pun) between on and off is voltage potential.

Here's something about the mechanics of the transistor itself:
At the most basic level, an ALU is a MUX which selects the output from one of several arithmetic units. For instance, a simple ALU may have an A (data) input, a B (data) input, and an OP input. The output is determined by:
OP=0 output = A
OP=1 output = B
OP=2 output = A | B
OP=3 output = A & B
OP=4 output = A ^ B
OP=5 output = A + B
OP=6 output = A - B
OP=7 output = B - A
In theory, all 8 operations could really be implemented with different logic, all of which acts in parallel, with the MUX selecting one of the 8 outputs. However, most ALUs combine logic units to reduce complexity:
OP=0 output = (A) | (0)
OP=1 output = (B) | (0)
OP=2 output = (A) | (B)
OP=3 output = (A) & (B)
OP=4 output = (A) ^ (B)
OP=5 output = (A) + (B)
OP=6 output = (A) + -(B)
OP=7 output = (B) + -(A)
The above simplification replaces the 8 separate logic units into 4 logic units (|, &, ^, and +) plus a simple selector (A, B) and a more complicated selector (A, B, 0, -A, -B).
Of course the simplification blurs the lines between ALU implementation and the decode logic around the ALU, but hopefully you get the idea.

Of course, the logic unit for | simply ors the input bits for A and B together in parallel. The logic unit for + is more complicated, but if you search for "ripple adder" you should see a very simple example of what goes into ALU logic.
Likewise, searching for "multiplexer" should show examples of the logic selecting from different outputs.
Last edited on
An ALU is mostly just a real lot of transistors, and a significant amount of resistors, then just wires.

Of course these aren't actual wires or the big (in comparison) transistors you see in electronics but they work the same way but are just really tiny.

If you're studying electrical circuits you should know that a transistor is able to control the flow of current, but in digital circuits it's pretty much just on or off, we don't care too much (unless you get more technical) about tolerance.

You can use transistors (and sometimes other components are needed) to make digital logic gates (AND, NAND, OR, NOT, etc).

Often people design chip logic using the logic gate because it's easier to design on a higher level.

Transistor AND gate:

Transistor OR gate:

(Logic Gate) Full Adder Circuit:

The full adder circuit add 2 input bits and a carry input (usually from previous bit sum) to produce an output bit, and an output carry (if the sum is too large)
Last edited on
closed account (L6b7X9L8)
The ALU is an amazing piece of technology, in short it is an electronic function processor.

The ALU loads values from input registers then a control unit tells it a command on what function to perform, whether it add's values, compares them etc etc.

As people have pointed out it is a chip with transistors and other logic gates put into certain sequences, depending on the instructions that it gets, the voltage travels down different pipelines within the logic to perform mathematical operations on the values.

It's a genius piece of tech. :)
They are made up of logic gates , which are made up of transistors (these days).
If you want to dig deep , follow here
http://www.allaboutcircuits.com/vol_4/index.html and there's always wikipedia
That Veritasium Video is very good and easy to understand if you want to understand Transistors internally.

Transistor AND gate:

Transistor OR gate:

In actual processors , logic gates are not made up of those simple circuits , they are more complex .
If you build your own logic gates using those circuits (I did :) ) , you'll understand the problems.
Look at this NOT gate: http://sub.allaboutcircuits.com/images/04073.png
Just wanted to point it out. :)
mpauna wrote:
ALU is a MUX

umm, no .
ALU is the combination of those arithmetic units you were specifying , the MUX which is used to select which line to output is less significant when talking in general.What you are saying otherwise is too specific.
Topic archived. No new replies allowed.