Introduction to Microprocessor and Computer History of computer Computing device Year of invention Description Abacus 2700-2300 BC It is a calculating tool. It uses beans or stones moved in grooves in sand or on tablets of wood, stone, or metal. Pascal's calculator 1642 It is a mechanical calculator invented by Blaise Pascal. It uses gears which are numbered from 0-9. Difference engine 1822 It is an automatic mechanical calculator designed to tabulate polynomial functions. Electronic Numerical Integrator and Computer(ENIAC) 1946 it was amongst the earliest electronic generalpurpose computers made. 4004 Microprocessor 1971 It was the first commercially available microprocessor by Intel. Block diagram of computer Microprocessor ALU Control unit Input device Bus Bus Register Array B u s Memory Output device Introduction to computer • Input device : is a device that is used to input data and control signal into a computer. E.g. keyboard, mouse , scanner … • Output device : is a device that is used to get( receive ) output from a computer. E.g. monitor, speaker, • Memory : is a storage device that is used to hold data and instruction temporarily or permanently in a computer. E.g. ROM, RAM, Hard Disk • Microprocessor: is a device that accept an input data and process it using defined instruction to give an output. Introduction to microprocessor • Microprocessor is an integrated circuit that contains all the functions of a computers central processing unit (CPU). • Microprocessors can be found inside computer, mobile, calculator, television, embedded systems (microcontroller) … • Any electronic circuit that can be programmable to do some operations can be called microprocessor. • A microprocessor include a ALU, registers, control unit and bus. Introduction to microprocessor • ALU : is a circuit in microprocessor that perform arithmetic and bitwise logic operations. • Arithmetic operations are addition, subtraction, multiplication, division … • Logic operations are NEG, OR, AND ,XOR … • Control unit: is a component in microprocessor that control the flow of instruction and data between ALU, input/output devices and memory. • Registers: are stack of memory that can store 8-bit, 16- bit, 32-bit or 64-bit data at a time. Introduction to microprocessor • Bus : is a collection of wires that are used to transfer data in a form of signals (bits). • There are 3 types of buses those are data bus, address bus and control bus. • Data bus are buses that are used to transfer data between components of computer or microprocessor. • The width of data bus tell how much bit the microprocessor can read or write into memory and input/output device at a time. • Data bus is bidirectional. It means bits can be transferred both directions. Introduction to microprocessor • Address bus are buses that are used to carry the address of memory or input/output device from which data will be read or write to. • The width of address bus can tell as how much memory size we can address. It n-bit address bus can support 2n memory. • E.g. 8-bit address bus can support 28=256 byte. • Address bus is unidirectional bus. • Control bus are buses that tell what kind of operation we be done with the memory or input/output device. • Like read memory, write memory, read I/O and write I/O Introduction to microprocessor • Control bus is unidirectional. Microprocessor Memory Input Control bus Data bus Address bus output Introduction to microprocessor • Microprocessor has 3 basic operations. Those are fetching, decoding and executing instructions. • Fetching is the processes of getting instructions to be processed from memory or input/output. • Decoding is understanding what kind of operation the instruction will perform. • Executing is the running the operation ( executing the instruction). Introduction to microprocessor • Every microprocessor has a list of instruction that can process. • This list of instruction are recognized by decoder and called instruction set. • Depending on the type of instruction set microprocessor can be of 2 type CISC and RISC. • CISC (complex instruction set computer) is a microprocessor designed to have a single instruction perform multiple low level operation like load from memory, arithmetic operation and store to memory. • RISC (reduced instruction set computer) is a microprocessor in which all its instructions are designed to processes only one operation. Introduction to microprocessor • Difference between CISC and RISC CISC RISC CSIC processor has complex instructions that take up multiple clocks for execution. RISC processors have simple instructions taking about one clock cycle. It has a micro-programming unit. It has a hard-wired unit of programming. Decoding of instructions is complex. Decoding of instructions is simple. Execution time is very high. Execution time is very less. It has a memory unit to implement complex instructions. It has no memory unit and uses a separate hardware to implement instructions. It is an easy complier design. It is a complex complier design. Introduction to microprocessor • Special processor are processors which are designed for some special purposes. They use as supporting processor for microprocessors. • A coprocessor is a specially designed microprocessor, which can handle its particular function many times faster than the ordinary microprocessor. • I/O processor is a specially designed microprocessor having a local memory of its own, which is used to control I/O devices with minimum CPU involvement. • DSP (Digital Signal Processor) is specially designed to process the analog signals into a digital form. Characteristics of microprocessor • Instruction Set − It is the set of instructions that the microprocessor can understand. • Bandwidth − It is the number of bits processed in a single instruction. • Clock Speed − It determines the number of operations per second the processor can perform. It is measured in hertz. • Word Length − It depends upon the width of internal data bus, registers, ALU, etc. An 8-bit microprocessor can process 8-bit data at a time. • Data Types − The microprocessor has multiple data type formats like binary, BCD, ASCII, signed and unsigned numbers. Features of a Microprocessor • Features of a Microprocessor • • • • Cost-effective :microprocessor chips are available at low prices. Size : microprocessor is of small size chip. Low Power Consumption Versatility : it can be used in a number of applications by configuring the software program. • Reliability − The failure rate of an IC in microprocessors is very low. Different types of Intel microprocessor Microprocessor Data bus width Memory size 4004 4-bit 4KB 8008 8-bit 16KB 8086 16-bit 1 MB 80386DX 32-bit 4 GB Pentium 64-bit 4G + 16K cache Core2(dual core) 64 1T + 32K L1 cache + a shared 2 or 4 M L2 cache Itanium (Dual Core) 128 1T + 2.5 M L1 and L2 cache + 24 M L3 cache 8086 microprocessor • 8086 microprocessor is the first 16-bit microprocessor build by intel in the year 1976. • It has 20-bit address bus and 16-bit data bus so it can support 1Mega byte memory. Features of 8086 microprocessor • Features of 8086 microprocessor • It has 6 byte instruction queue • It is 16-bit microprocessor having 16-bit ALU, 16-bit registers and 16-bit internal bus. • It was available in 3 modes • 8086 → 5MHz • 8086-2 → 8MHz • (c)8086-1 → 10 MHz • It use two stage pipeline one for fetching instruction the other for executing instruction. 8085 vs 8086 microprocessor Characteristic Intel 8085 Intel 8086 size 8-bit 16-bit Address bus 16-bit 20-bit Memory 64 kilobyte 1 megabyte Instruction queue Doesn’t have Have an instruction queue Pipelining Doesn’t support support Input/output 28=256 I/O’s 216=65,536 I/O's 8088 vs 8086 microprocessor • 8086 and 8088 have similar architecture except for those points. • 8086 vs 8088 • 8088 has 8-bit external data bus where as 8086 has 16-bit external data bus. • 8088 has a queue size 4 byte where as 8086 has 6 byte size queue. • 8088 is 30% less in speed than 8086. • 8088 microprocessor was built in order to support peripheral devices which are intractable with 8-bit bus. Architecture of 8086 microprocessor EU and BIU • 8086 microprocessor has to parts. These are Bus Interface Unit(BIU) And Execution unit(EU). • Bus interface unit is used to fetch instruction and data to be used by execution unit. • Execution unit is used to decode and execute an instruction given by Bus interface unit. EU and BIU • Functionality of Bus interface unit • • • • Fetch instruction and data from memory Write data to memory Write data to port Read data from port • Functionality of Execution unit • Tell BIU where to fetch the instruction or data • Decode an instruction • Execute an instruction Pipelining • Non-pipelined architecture Time Fetch Decode Execute Fetch Decode Execute • Pipelined architecture • BIU • EU Fetch Fetch Fetch Wait Decode Execute Fetch Decode Fetch Execute Decode Fetch Wait Fetch decode Pipelining • 8086 microprocessor BIU will be used to fetch instruction where as EU will be used to decode and execute that instruction. • When instruction is being executed another instruction will be fetched at the same time. • In execution unit wait can happen if • The requested data not in the queue • Jump instruction has happened Memory segmentation • 8086 has address bus 20-bit so it allow it to address 1 megabyte memory from 00000H to FFFFFH. • Because 8086 is 16-bit processor its internal bus width is 16-bit allowing it only to access a memory size between 0000H-FFFFH or 64 kilobyte memory. • Because of this reason the 1 megabyte memory is divided into segments of 64 kilobyte memory. • In 8086 microprocessor there are 4 segments data segment, code segment, extra segment and stack segment. Memory segmentation • The physical address of a memory is found by adding the segment address and an offset address. • E.g. If the segment address=12340 and off set address is =12FFH • The physical address of the memory will be • Physical address= segment address+ offset address • Physical address= 12340H+12FFH • Physical address=1263FH • The physical address is expressed in segment address : offset address. Memory segmentation 8086 segments • Code segment are used to store programs that are run by 8086. • Data segment are segments where data is stored. • Extra segment is used to store data and mostly it is used for string operation. • Stack segment is used to store temporary data. It is used as stack memory when we use the instruction pop and push. It is also used to hold address of next instruction when there is a call instruction. • The segment address of segments are stored in the segment registers. Segment registers • Segment registers are registers which are used to hold the address of the segment memory. • Those registers are CS, DS, ES and SS. • CS register is used to hold the segment address of code segment. • DS register is used to hold the segment address of Data segment. • ES register is used to hold the segment address of Extra segment. • SS register is used to hold the segment address of Stack segment. Segment registers Segment Offset Special purpose CS IP Instruction address DS BX,SI,DI, 8-bit or 16 –bit number Data address ES DI String destination address SS SP or BP Stack address Segment registers • E.g. data in CS register is 5673H and data in IP register is 0342H the next instruction to be fetched will be. • Physical address will segment address + offset address. So • The segment address for CS register data multiplied by 10H • And the offset address will be the IP register data. • Next instruction address= (5673HX10H)+0342H • Next instruction address= 56730H+0342H • Next instruction address=56A72H General purpose registers • General purpose registers are registers that are used for storing temporary data. Register name Bit size Special operation AX(accumulator) (AH,AL) AX=16 AH,AL=8 For multiplication , division : in mul and div instructions one operand must be accumulator BX (base) (BH,BL) BX=16 BH,BL=8 Store address information : hold the offset address of memory address. CX (counter) (CH,CL) CX=16 CH,CL=8 Use as counter in loop, shift and rotate instructions. DX (data ) (DH,DL) DX=16 DH,DL=8 Used on word size multiplication and division and to hold the port number of input/output 8086 registers Register name operation SP (stack pointer) Points the address of stack memory. It is used as offset address for stack segment BP (base pointer) It points memory location for data transfer. SI (source index) The source index register often addresses source string data for string instructions. DI (destination index) often addresses string destination data for the string instructions. IP (instruction pointer) Points the address of the next instruction. It address the code segment. Flag register • Flag register indicate the condition of the microprocessor and control its operation. Flag register • Status flags tell as the status of the microprocessor. • Carry holds the carry after addition or the borrow after subtraction. The carry flag also indicates error conditions, as dictated by some programs and procedures. If carry happen it is set. • Parity is the count of ones in a number expressed as even or odd. If the parity count is even it is set. • Auxiliary flag: It is set if a carry is generated out of the lower nibble to higher nibble. • Zero flag: it is set if the result is zero. • Sign flag: in signed numbers It is set if the MSB of the result is 1. For signed operations such a number is treated as negative. • Overflow flag : It will be set if the result of a signed operation is too large to fit in the number of bits available to represent it. Flag register • Control flags are flags that control the operation of the execution. • Trap flag: It is used to set the trace mode i.e. start single stepping mode. Here the microprocessor is interrupted after every instruction so that the program can be debugged. • Interrupt flag: It is used to mask (disable) or unmask (enable) the INTR interrupt. • Direction flag: it is used for string operation memory addressing. if it is set memory is accessed from higher to lower.