Table of Contents
What is ALU?
ALU (Arithmetic logic unit) is a part of CPU which performs the operations like Arithmetic, Logical and Bitwise (Bit shifting). ALU is fundamental building blocks of computing circuits like GPU, FPGA, CPU.
Design of ALU is more crucial when it comes to performance because it consumes more energy and generates more heat hence balance must be maintain between power and complexity.
Unlike FPGA it can perform operations on floating points.
ALU is made of Combinational Digital Electronic Circuits also known as Combinational Circuits (CC) which means ALU is made up of different types of logic gates. Combinational Circuits’s output depends on the input value at any given time.
Logic gates like NOT, AND, OR XOR are used to create these circuits.part
Basic structure of ALU
Integer operand : ALU has a total three data buses, two of them are input buses (A and B bus) and the remaining is output bus (Y bus). Each of these buses carries one binary integer number value. Size of these buses is the same as the native word size of the external circuitry.
Opcode : Opcode bus carries operation selection code (enumerated value of operation) to ALU. In simple terms Opcode tells ALU which operation is to be performed.
Opcode bus size is dependent on max ability of ALU to perform operations, e.g. a four-bit opcode can specify up to sixteen different ALU operations.
Status : Status are individual signals which carry information about the result of current ALU operation. Here are some of the status signals.
1. Carry-out : Which says carry has been generated from addition operation, borrow has been generated by subtraction operation or overflow bit resulting in binary-shift operation.
2. Zero : It indicates that all the bits of Y are zero. If we are subtracting one number from the same number we will generate zero status eg(7-7 will generate zero status) and by seeing zero status we can say that both the values are the same.
3. Negative : It indicates the result of ALU operation has generated negative value.
4. Overflow : It indicates the result of ALU operation has exceeded the range of Y.
5. Parity : It indicates the number of set bits (bit values 1) in Y, e.g. if the value of Y is “10110” this has 3 set bits (3 1’s bit) which means we have odd number of set bits then the value of parity status is “0”.
If the value of Y is “1001” this has 2 set bits (2 1’s bit) which means we have even number of set bits then the value of parity status is “1”
These status output signals are stored in registers to make them available for next ALU operations or controlling conditional branching. The group of bit registers which store the status outputs are often treated as a single, multi-bit register, which is referred to as the “status register” or “condition code register”.