ALU in Detail
You should have heard of an Arithmetic and Logic Unit before, while discussing a Computer CPU or a micro controller. In this tutorial we will look at what an ALU really is?
We will discuss a 4 bit ALU; this would limit many possibilities 16. We would assume that associated registers and instruction set are also 4 bit.
Lets start with a simple half adder. Half adder adds two single binary digits A and B. It has two outputs, sum (S) and carry (C). The carry signal represents an overflow into the next digit of a multi-digit addition.Figures below illustrate a simple half adder constructed from logic gates
The basic Unit: 1 bit ALU
4 BIT ALU
- The selection lines MO and M1 select the function ALU performs. These selection lines combined with the input arguments and desired functions a Instruction Set can be formed.
- These Instructions can used to create meaningful programs. Since these are required to be easily available they can be stored on ROM unit.
- The input arguments A and B are often stored in Internal Registers. These along with other special purpose register form the registers of the microcontroller.
- ROM memories are slower in speed, hence an intermediate high speed RAM is often used.
- All the critical timings, decoding of the instructions are often grouped together in seperate control and timings unit'
- If a Micro controller would be constructed only from ALU, RAM, ROM there would not be any external interface. Hence we have Input/Output IO ports.
- Additional features such as 'Interrupts, communication protocols, EEPROM, Timers/Counters, Debug interfaces etc are incorporated to make a controller complete.
In above discussion we might have left out intricate details involved in a ALU, CPU design. But the aim was to understand ALU/CPU at a deeper level.