Decades ago, when computers first came into light, they used a certain component for memory and circuitry of the CPU called big vacuum tubes. That made the first-gen computers as big as a room. Years later, after the invention of Transistors, the size of computers reduced drastically. With time this technology evolved, and we got the Integrated Circuits (IC) which has large numbers of tiny transistors integrated into a small chip. This resulted in circuits that are orders of magnitude smaller and faster.
Today, every computer, no matter what kind, uses a microprocessor. A Microprocessor is also an IC that forms the computer’s brain and performs arithmetic and logical operations.
Working of a Microprocessor
Microprocessor basically takes instructions in the form of binary as input, processes the data, and gives output accordingly. The Microprocessor has three main parts: ALU, Control unit, and Memory Registers. The ALU takes care of all arithmetic and logic operations like addition, subtraction, AND, OR, XOR, etc. Control units fetch one instruction at a time from the main memory and then execute it. Memory registers are a series of registers like accumulator (A), B, C, D, etc., which act as temporary fast access memory locations for processing data.
The Microprocessors are programmed using their native language, called the Assembly Language.
Let’s now see the working of a microprocessor in action using a simple assembly language program. Assembly Language is a very Low-Level programming language, and it might look a bit intimidating at first glance. So, don’t worry about the code itself and focus on how the Microprocessor processes the instructions.
Problem: Write a program to add two 8-bit numbers stored at address 2050 and address 2051 in an 8085 microprocessor. (Assume no carry is generated and the starting address of program is 2500).
As we know that every Microprocessor has its own Assembly Language that might slightly differ from others.8085 has its own as well. 8085 is pronounced as an "eighty-eighty-five" microprocessor, and it is an 8-bit microprocessor designed by Intel in 1977. This Microprocessor is not used that much today; however, its simple architecture and not-very-complex programming make it the best for beginners to learn.
All the memory that a microprocessor can access is specified by a hexadecimal number called a memory address. Using this address, the processor knows where the data and instructions are stored. The program’s starting address means that the instructions are stored at consecutive memory locations starting from 2500. Each memory location has a memory block of 1 byte.
Memory Address | Instructions | Description |
---|---|---|
2500 | LDA 2050 | LDA 2050 (Load Accumulator) instruction loads the data stored at memory location 2050 to the Accumulator (A memory register, as stated earlier). So, if ‘5’ was at location 2050, the Accumulator now stored the same value. |
2503 | MOV H, A | MOV H, A (Move value at A to H) instruction sends the value at A to H. H is also a register in the microprocessors register array. |
2504 | LDA 2051 | LDA 2051, again, this instruction loads the 2nd number from location 2051 to Accumulator. Let’s say that it was ‘3.’ |
2507 | ADD H | ADD H instruction adds the number in the accumulator (which is 3) to the number in the H register (which is 5) and stores the result in the accumulator itself. |
2508 | HLT | HLT stops executing the program and halts any further execution. |
Let’s see what was happening inside the MP while the code was being executed.
The Control units fetch the instruction one by one from memory starting from the memory location 2500. In the first three instructions, it simply moves data between memory locations. In the third instruction, it asks the ALU to do the ADD operation. The ALU adds the two numbers and transfers the data to the accumulator. As soon as the control unit sees HLT, it stops fetching instructions.
Classification of Microprocessors
Microprocessors can be classified based on word length as well as based on architecture.
-
Based on Word Length: Word length is the number of bits the processor can process at a time. Based on its word length, microprocessors can be classified as 8-bit, 16-bit, 32-bit, and 64-bit.
-
Based on Architecture: Microprocessors are classified into two classes based on architecture: RISC and CISC architecture.
More on Risc and CISC Architectures
RISC stands for reduced instruction set computers. This architecture’s hardware is more straightforward and has few specific instruction sets like loading data and performing mathematical operations. The execution of each instruction requires special circuitry, and since RISC has fewer instructions, it has simpler circuits, thus making it fast.
CISC stands for Complex instruction set computers. The idea behind this architecture is to use a large set of instructions but reduce the number of instructions per program by using specialized instructions. A single instruction can do multiple tasks like loading, evaluating, and storing operations.