ALU Basics

You are not logged in.

Please Log In for full access to the web site.
Note that this link will take you to an external site (https://accounts.google.com) to authenticate, and then you will be redirected back to this page.

So far we have learned how to represent signed numbers in binary using 2's complement, and we have built a circuit that generates the 2's complement of an input for us.
Now in this section, we will figure out how to perform subtraction using the previously learned circuits, then how to choose between addition and subtraction, and finally understand the basics of an ALU.
With this, we will reach our goal of building our own signed calculator.

1) Binary Subtraction Using 2's Complement

In the previous section on signed arithmetic and overflow, we learned that when we add the 2's complement of a number to itself, we get a 0 in fixed-bit binary arithmetic as a consequence of overflow.
Now that we have a solid representation for negative numbers, let's try subtraction using an adder circuit

How does the adder perform subtraction using 2's complement?

2) Introducing the Arithmetic Logic Unit (ALU)

In real processors, arithmetic operations such as addition and subtraction—and logical operations such as AND or OR—are grouped into a single block called the Arithmetic Logic Unit, or ALU.

A block diagram of a 4-bit 4-operation ALU

The ALU typically has two data inputs, a result output, and a set of control lines that decide which operation is performed. These control lines are what allow the same internal circuitry to compute sums, differences, or logical results.

3) Selecting Operations Using a Multiplexer

To allow our circuit to perform either arithmetic or logic operations, we will use a Multiplexer to choose between different inputs based on a control signal. For this, we will need individual blocks handling each operation as well as the multiplexer to select.

For this simplified example, we will select between four different operations: addition, subtraction, bitwise NAND, and bitwise XOR.

Schematic of the ALU

Components you'll need:

  • 1× 74283 4-bit Binary Adder IC
  • 2× 74157 Quad 2-to-1 Multiplexer IC
  • 2× 7486 Quad XOR gate IC
  • 1× *7400 Quad NAND gate IC
  • 2× 4-bit DIP switches
  • 1× 2-bit DIP switch
  • 4× LEDs
  • 14× 220Ω resistors
  • Breadboard & Jumper wires
ADD/SUBTRACT CIRCUIT ON BREADBOARD
ADD/SUBTRACT CIRCUIT ON BREADBOARD

Final Submission

Upload a short video (20 seconds) showing your add/subtract circuit working. Demonstrate both operations clearly using different input values on the switches.
 No file selected


In the next section, we will understand the working of an ALU IC - 74181.