Arithmetic Logic Unit (ALU): Definition, Design & Function

ALU Definition

ALU stands for arithmetic logic unit is one of the essential part of CPU. The primary function of the ALU is to perform computation on operands, computation kind of arithmetic and logic operation that are going to perform on operands in computer instruction words. There are some processor where ALU doesn’t perform task as a single unit rather divided into parts and perform the function individually and once the information has been processed by the ALU, it sends to the computer’s memory . In other words we can say it as a complex digital circuit which perform both bitwise and mathematical operations on binary numbers and a last component of CPU that perform calculation in the processor. Basically this unit use operands and code that tells it which operation to perform for input data.

ALU Design

ALU Block Diagram


Accumulator is a part of ALU which is a 8-bit register. Mainly this register is used to store 8-bit data and performing arithmetic and logic operation on it. The result of operation stored in accumulator.

Flags: Flags are programmable that are used to store and transfer the data from the registers by using instructions. ALU use flip-flops that are used in two states either set and reset which is according to data condition in accumulator and other registers.

ALU 8-bit register
  • S (sign) flag: if the D7 bit is set to be 1 then sign flag is set. Basically it is used to signed numbers
  • Z (Zero) flag: This flag is set when ALU result is 0.
  • AC (Auxiliary Carry) flag: In arithmetic operation when carry is generated then it passed to next digit then AC flag is set.
  • P (Parity) flag: After the ALU operation when result has even number of 1’s the parity flag is set and if it has odd numbers then flag is reset.
  • C (Carry) flag: this flag is set when arithmetic result is in a carry, otherwise the flag is reset.

Register Section

Register section we can say it’s a storage device of ALU which also transfer data from registers by using instructions. Register section contain some of the components that perform different functions.

  • Stack Pointer(SP): This register points to the memory location in read/write memory which is known as stack. This is 16 bit register which is used as a memory pointer. When the program in execution sometimes data to be stored in stack pointer because it store the last stored value at the top of the stack.
  • Program Counter(PC): This register counter contain 16-bit address of the instruction being executed at the current time. When the instruction fetched then it increase it counter by 1 and once the instruction is fetched then it points to the next instruction in the sequence. Counter is normally start with zero when system turn on.
  • Storage Registers: As the name implies these registers store 8-bit data when program is executing. Registers are identified as B, C, D, E, H, L and combined as the registers pair BC, DE and HL to perform 16 bit operations.

Time and Control Section

Purpose of this unit is to synchronize microprocessor operations as per the clock pulse and to generate the control signals that are necessary for smooth communication between microprocessors and peripherals devices. The synchronizing pulses on data bus RD and WR bar indicates that data is available or not. The purpose of control unit is to control of data between microprocessors and peripheral devices.

ALU Functions

This unit perform some of the responsible functions of all logical and arithmetic operations. Arithmetic operations are simple addition, subtraction, multiplication and division and logical operations are comparison between numbers, letters or special characters. This is also responsible for some of the following conditions that are equal-to condition, less-Than condition and greater than condition.