Microprocessor

3y ago
33 Views
3 Downloads
1.18 MB
66 Pages
Last View : 12d ago
Last Download : 3m ago
Upload by : Rosemary Rios
Transcription

MicroprocessorLecture (2)1

Outline Introduction to instruction set architecture, microarchitectureand system architecture Microcomputer architecture and Basic Blocks of aMicrocomputer Introduction to microprocessorSimplified Explanation of Control Unit designProgram Execution by Conventional MicroprocessorsPipelineBranch Prediction FeatureScalar and Superscalar MicroprocessorsMicroprocessor architectures RISC vs. CISCMicroprocessor Data TypesEvolution of the microprocessor2

Introduction to instruction set architecture(1)What are Instructions?Instructions are the direction given to a computer, that causeselectrical signals to be sent through specific circuits forprocessing Instructions are the most basic actions the processor can take:- ADD AX, BX — Add value AX to BX and store in AX- CMP AX, 5 — Compare value in AX to 5- JE 16 — Jump ahead 16 bytes if comparison was equalHigh level programming languages (C, C , Java) allow manyprocessor instructions to be written simply: if (A B 5) then — Jump if sum of A and B is 5 Every program must be converted to the processor instructionsof the computer it will be run on.3

Introduction to instruction set architecture (2) Instruction set– Design defines functions performed by the processor– Differentiates computer architecture by the Number of instructions Complexity of operations performed by individualinstructions Data types supported Format (layout, fixed vs. variable length) Use of registers Addressing (size, modes)4

Introduction to instruction set architecture (ISA) (3) Instruction set architecture (ISA) refer to the actual programmer visibleinstruction set. Serves as an interface between software and hardware. Provides a mechanism by which the software tells the hardware what should bedone.High level language code : C, C , Java, Fortran,compilerAssembly language code: architecture specific statementsassemblerMachine language code: architecture specific bit patternssoftwareinstruction sethardware5

Introduction to instruction set architecture (4) Instruction set design issues include:– Where are operands stored? registers, memory, stack, accumulator– How many explicit operands are there? 0, 1, 2, or 3– How is the operand location specified? register, immediate, indirect, . . .– What type & size of operands are supported? byte, int, float, double, string, vector. . .– What operations are supported? add, sub, mul, move, compare . . .6

Microarchitecture and system architecture (1)What is Computer Architecture? The science and art of designing, selecting, andinterconnecting hardware components and designing thehardware/software interface to create a computing systemthat meets functional, performance, energy consumption,cost, and other specific goals. “The term architecture is used to describe the attributesof a system as seen by the programmer, i.e., the conceptualstructure and functional behavior as distinct from theorganization of the dataflow and controls, the logic design,and the physical implementation.” Gene Amdahl, IBMJournal of R&D, April 19647

Microarchitecture and system architecture (2) What is Computer Architecture? Functionaloperation of the individual HW units within acomputer system, and the flow of information andcontrol among them.TechnologyHardware mmingLanguageInterfaceInterface Design(ISA)ApplicationsOSMeasurement &Evaluation8

Microarchitecture and system architecture (3) The task the computer designer faces is a complex one:Determine what attributes are important for a newcomputer, Then design a computer to maximize :- performance and- Energy efficiency,while staying within : cost, power, and availability constraints. This task has many aspects, including instruction set design,functional organization, logic design, and implementation. Architecture is concerned with internal structures of each, interconnections( speed and width) , and relative speeds of components Want maximum execution speedBalance is often critical issue.9

Microarchitecture and system architecture (4)ISA vs. Microarchitecture Level Tradeoff A similar tradeoff (control vs. data-driven execution) can be madeat the microarchitecture level ISA: Specifies how the programmer sees instructions to beexecuted– Programmer sees a sequential, control-flow execution order vs.– Programmer sees a data-flow execution order Microarchitecture: How the underlying implementation actuallyexecutes instructions– Microarchitecture can execute instructions in any order as longas it obeys the semantics specified by the ISA when making theinstruction results visible to software Programmer should see the order specified by the ISA10

Microarchitecture and system architecture (5) Microarchitecture is the steps a processor takesto execute a particular set of instructions. Processors of the same architecture have the sameinstructions but may carry them out in differentways. Microarchitecture Features:–Cache memory–Pipelining–Out-of-Order Execution–Superscalar Issue11

Microcomputer architecture and Basic Blocks of a MicrocomputerBasic Blocks of a MicrocomputerA microcomputer has three basic blocks: a centralprocessing unit (CPU), a memory unit,and an input/output (I/O) unit.The CPU(microprocessor) executes all the instructionsand performs arithmetic and logic operations on data.A memory unit stores both data and instructions. Thememory section typicallycontains ROM and RAM chips.A system bus (comprised of several wires) connectsthese blocks.12

Basic Blocks of a Microcomputer13

Microcomputer architecture and Basic Blocks of a Microcomputer In a single-chip microcomputer, these threeelements are on one chip, whereas in a single-chip microprocessor, separate chipsare required for memory and I/O.14

Microcomputer architecture(Basic Blocks of a Microcomputer)15

Introduction to Microprocessor MPU Microprocessor MPU is fabricate a CPU on asingle chip Along with the microprocessor chip, appropriatememory and I/O chips can be used to design amicrocomputer (with CPU being a microprocessor) Microcontrollers include a microcomputer,timers, and A/D (analog-to- digital) and D/A(digital to analog) converters, all on a single chip.16

Introduction to Microprocessor MPU A microprocessor is a stand alone, self containedsingle chip microcomputer. It must have as a minimum:– a central processing unit (CPU)– nonvolatile and program memory– input and output capabilities. A structure that has these can be programmed in someconvenient programming language can interact with the outside world through theinput/output ports.17

Introduction to the microprocessor Other important requirements: must be relatively simple reasonably small necessarily limited in most of its features – memory,processing power and speed, addressing range and, ofcourse in number of I/O devices it can interact with. The designer must have access to all features of themicroprocessor – bus, memory, registers, all I/O ports, In short, Microprocessors are components withflexible features that the engineer can configure andprogram to perform task or a series of tasks.18

Microprocessor-based SystemControl Unit19

Microcontroller Unit (MCU) An integrated electronic computing and logic device that includesthree major components on a single chip Microprocessor Memory I/O ports Includes support devices TimersA/D converterSerial I/OParallel Slave Port All components connected by commoncommunication lines called the system bus.20

Single-Chip Microprocessor The microprocessor is the CPU of the microcomputer The logic inside the microprocessor chip can be dividedinto three main areas: The register section The control unit, and the arithmetic-logic unit (ALU).21

Register Section Register is a Small, permanent storage locations withinthe CPU used for a particular purpose Manipulated directly by the Control Unit Wired for specific function Size in bits or bytes (not MB like memory) Can hold data, an address or an instruction The number, size, and types of registers vary from onemicroprocessor to another.Basic Microprocessor RegistersThere are four basic microprocessor registers:instruction register, program counter, memory addressregister, and accumulator.22

Register SectionInstruction register (IR) : The instruction register stores instructions. The word size of the microprocessor determines thesize of the instruction register. For example, a 32-bitmicroprocessor has a 32-bit instruction register.23

Register SectionProgram Counter (PC): The program counter contains the address of theinstruction or operation code (op-code). The program counter normally contains the addressof the next instruction to be executed. The size of the program counter is determined by thesize of the address bus.24

Register SectionHow Program Counter is Work ?Upon activating the microprocessor’s RESET input, the addressof the first instruction to be executed is loaded into the programcounter.2. To execute an instruction, the microprocessor typically places thecontents of the program counter on the address bus and reads(“fetches”) the contents of this address(i.e., instruction) frommemory3. The program counter contents are incremented automatically bythe microprocessor’s internal logic. Microprocessor executes aprogram sequentially, unless the program contains an instructionsuch as a JUMP instruction, which changes the sequence.1.25

Register SectionMemory Address Register (MAR).The memory address register contains the address ofdata.The microprocessor uses the address, which is stored inthe memory address register, as a direct pointer tomemory. The contents of the address is the actual datathat is being transferred.26

Register SectionGeneral Purpose Register (GPR) : For an 8-bitmicroprocessor, the general-purpose register is calledthe accumulator. It stores the result after most ALU operations. These 8-bit microprocessors have instructions to shiftor rotate the accumulator one bit to the right or leftthrough the carry flag. In16- and 32-bit microprocessors the accumulator isreplaced by a GPR. any GPR can be used as an accumulator.27

Register Section General Purpose Register (GPR).The term general-purpose comes from the fact thatthese registers can hold data, memoryaddresses, or the results of arithmetic or logicoperations. Most registers are general-purpose, but some, such asthe program counter (PC),are provided for dedicatedfunctions.28

Register SectionOther Microprocessor Registers such as general-purposeregisters, index register, status register and stack pointer register. general-purpose registers speeds up the execution of aprogram because the microprocessor does not have to readdata from external memory via the data bus if data is stored inone of its general-purpose registers. Index Register is typically used as a counter in addressmodification for an instruction or for general storagefunctions. Used to access tables or arrays of data. Status Register( a processor status word register orcondition code register, contains individual bits, with eachbit having special significance. The bits in the status registerare called flags.29

Register SectionFlags Type A carry flag is used to reflect whether or not the result generatedby an arithmetic operation is greater than the microprocessor’sword size. AUXILIARY CARRY FLAG: This flag is set to a 1 by theinstruction just ending if a carry occurred from bit 3 to bit 4 ofthe A Register during the instruction’s execution.Auxiliary carry flag30

Register SectionFlags Type A zero flag is used to show whether the result of anoperation is zero. It is set to1 if the result is zero, andit is reset to 0 if the result is nonzero. A parity flag is set to 1 to indicate whether the resultof the last operation contains either an even numberof 1’s (even parity) or an odd number of 1’s (oddparity), depending on the microprocessor.31

Register SectionFlags Type A sign flag (sometimes called a negative flag) is used toindicate whether the result of the last operation ispositive(set to 0) or negative(set to 1) Overflow flag arises from representation of the sign flagby the most significant bit of a word in signed binaryoperation. The overflow flag is set to1 if the result of anarithmetic operation is too big for the microprocessor’smaximum word size, otherwise it is reset to 032

Register SectionEXAMPLE : Find the sign, carry, zero, overflow, and parity evenflag for the following arithmetic sign number:(11110000) (10100001) 10010001SF 1 ,CF 1 ,ZF 0 ,OF 0 ,PF 033

Register Section Stack Pointer Register A stack consists of a numberof RAM locations set aside for reading data from orwriting data into these locations and is typically usedby subroutines Two instructions, PUSH and POP, are usuallyavailable with a stack. The PUSH operationis defined as writing to the top or bottom of the stack,whereas the POP operation means reading from thetop or bottom of the stack.34

Register Section35

Register Section36

Register Section37

Register Section38

Control Unit The main purpose of the control unit is to read anddecode instructions from the program memory. To execute an instruction, the control unit stepsthrough the appropriate blocks of the ALU based onthe op-codes contained in the instruction register.39

Control UnitControl Signal Actions RESET. This input is common to allmicroprocessors. When this input pin is driven HIGHor LOW (depending on the microprocessor), theprogram counter is loaded with a predefined addressspecified by the manufacturer.40

Control UnitControl Signal Actions READ/WRITE (R/W) This output line is common toall microprocessors. The status of this line tells the othermicrocomputer elements whether the microprocessor isperforming a READ or a WRITE operation. A HIGHsignal on this line indicates a READ operation, and aLOW indicates a WRITE operation.41

Control UnitControl Signal Actions READY, This is an input to a microprocessor. Slow devices(memory and I/O) use this signal to gain extra time to transfer datato or receive data from a microprocessor. The READY signal isusually an active low signal; that is, LOW indicates that themicroprocessor is ready. Therefore, when the microprocessorselects a slow device, the device places a LOW on the READY pin. The microprocessor responds by suspending all its internaloperations and enters a WAIT state. When the device is ready tosend or receive data, it removes the READY signal. Themicroprocessor comes out of the WAIT state and performs theappropriate operation.42

Control UnitControl Signal Actions Interrupt Request (INT or IRQ). The external I/Odevices can interrupt the microprocessor via this input pin on themicroprocessor chip. When this signal is activated by the externaldevices, the microprocessor jumps to a special program called theinterrupt service routine. This program is normally written by theuser for performing tasks that the interrupting device wants themicroprocessor to carry out. After completing this program, themicroprocessor returns to the main program it was executing whenthe interrupt occurred.43

Arithmetic-Logic Unit The ALU performs all the data manipulations, such asarithmetic and logic operations, inside amicroprocessor. The size of the ALU conforms to theword length of the microcomputer. ALU Functions:1.Binary addition and logic operations2. Finding the one’s complement of data3. Shifting or rotating the contents of a generalpurpose register 1 bit to the left or right through acarry44

Simplified Explanation of Control Unit design The control unit performs two basicoperations:1. instruction interpretation2. and instruction sequencing.There are two methods for designing a control unit:Hardwired controlMicroprogrammed control(firmware)clocked sequential circuitROM inside the control unit(control memory)more expensiveflexibility45

Simplified Explanation of Control Unit design Hard Wired Control Unit The Cycles or Phases(Fetch, Indirect, Execute, Interrupt) are constructed asa State Machine The Individual instruction executions can beconstructed as State Machines– Common sections can be shared. There is a lot ofsimilarity One ALU is implemented. All instructions share it46

State Machine Combinational logic– Determine outputs at each state.– Determine next state. Storage elements– Maintain state representation.State MachineInputsClockCombinationalLogic CircuitOutputsStorageElements47

Problems With Hard Wired Designs Sequencing & micro-operation logic gets complex Difficult to design, prototype, and test Resultant design is inflexible, and difficult to build upon(Pipeline, multiple computation units, etc.) Adding new instructions requires major design and addscomplexity quickly48

Control Unit : Organization Microprogrammedcontrol The Control Memory contains sequences of microinstructions that providethe control signals to execute instruction cycles, e.g. Fetch, Indirect,Execute, and Interrupt.Horizontal Micro-programming: Wide control memory word High degree of parallel operations possible Little encoding of control information FastVertical Micro-programming : Width can be much narrower Control signals encoded into function codes – need to be decoded More complex, more complicated to program, less flexibility More difficult to modify Slower49

Program Execution by Conventional Microprocessors The following three steps for completing the instruction:1.Fetch. The microprocessor fetches (instruction read) theinstruction from the main memory (external to themicroprocessor) into the instruction register.2. Decode. The microprocessor decodes or translates theinstruction using the control unit. The control unit inputs thecontents of the instruction register, and then decodes(translates) the instruction to determine the instruction type.3. Execute. The microprocessor executes the instruction using thecontrol unit. To accomplish the task, the control unit generatesa number of enable signals required by the instruction.50

Program Execution by Conventional Microprocessors For example, suppose that it is desired to add the contents of tworegisters, X and Y, and store the result in register Z. To accomplishthis, a conventional microprocessor performs the following steps:1. The microprocessor fetches the instruction into the instructionregister.2. The control unit (CU) decodes the contents of the instruction register.3. The CU executes the instruction by generating enable signals for theregister and ALU sections to perform the following:a. The CU transfers the contents of registers X and Y from theRegister section into the ALU.b. The CU commands the ALU to ADD.c. The CU transfers the result from the ALU into register Z of theregister section.51

Program Execution by typical 32-bit Microprocessors Enhancement in 32-bit microprocessors (likePentium) include : cache memory, memorymanagement, pipelining, floating-pointarithmetic, and branch prediction. Cache memory is a high-speed read/writememory implemented as on-chiphardware in typical 32-bit microprocessors inorder to increase processing rates. This topicis covered in more detail in Chapter 3.52

Program Execution by typical 32-bit Microprocessors Memory managementallows programmers to write programs much larger thanthose that could fit in the main memory space availableto the microprocessors; the programs are simply storedon a secondary device, such as a hard disk.This topic is covered in more detail in Chapter 3.53

Pipeline One way to speed up CPU is to increase clock rate– limitations on how fast clock can run to completeinstruction Another way is to execute more than one instruction atone time P

Microcomputer architecture and Basic Blocks of a Microcomputer Basic Blocks of a Microcomputer A microcomputer has three basic blocks: a central processing unit (CPU), a memory unit, and an input/output (I/O) unit. The CPU(microprocessor) executes all the instructions and performs arithmetic and logic operations on data.

Related Documents:

Microprocessor-Based System with Buses: Address, Data, and Control Microprocessor-based Systems Microprocessor ! The microprocessor (MPU) is a computing and logic device that executes binary instructions in a sequence stored in memory. ! Characteristics: " General purpo

A microprocessor which has n data lines is called an n-bit microprocessor i.e., the width of the data bus determines the size of the microprocessor. Hence, an 8-bit microprocessor like 8085 can handle 8-bits of data at

1 Introduction to Microcomputer Microcomputer architecture, organization and its operation. Difference between Microprocessor and Microcontroller. 1 [1] Lecture Notes Introduction to Microprocessor Evolution of Microprocessor, General Architecture, system bus 2 [1] [2] Lecture Notes 2 Functional units of Microprocessor

36 Chapter 3 Microprocessor Types and Specifications Pre-PC Microprocessor History The brain or engine of the PC is the processor (sometimes called microprocessor), or central processing u

A microprocessor can move data from one memory location to another. A microprocessor can make decisions and jump to a new set of instructions based on those decisions. There may be very sophisticated things that a microprocessor

A microprocessor is a programmable electronics chip that has computing and decision making capabilities similar to central processing unit of a computer. Any microprocessor-based systems having limited number of resources are called microcomputers. Nowadays, microprocessor can be seen in almost all types of electronics devices like mobile phones,

different microprocessor knee types James H Campbell1, Phillip M Stevens1,2 and Shane R Wurdeman1,3 Abstract Introduction: Microprocessor knee analyses to date have been primarily limited to microprocessor knees as a cat-egory rather than comparisons across different models. The purpose of the current analysis was to compare outcomes

The common way of categorizing microprocessor is by the number bits that their ALU can work with, at a time. Over time, five standard data widths have evolved for microprocessors: 4-bit, 8-bit, 16bit, 32-bit, 64-bit. Like,8-bit microprocessor means that ALU can work with 8-bit number at a time or, data width of this microprocessor is 8-bit.