SlideShare una empresa de Scribd logo
1 de 20
Chap. 8 Central Processing Unit                                              8-1



    8-1 Introduction
       3 major parts of CPU : Fig. 8-1
           1) Register Set
           2) ALU
           3) Control
       Design Examples of simple CPU
                   Hardwired Control : Chap. 5
                   Microprogrammed Control : Chap. 7
       In this chapter : Chap. 8                Computer Architecture as seen by the programmer

                   Describe the organization and architecture of the CPU
                   with an emphasis on the user’s view of the computer
                   by using two way
                   General purpose organization
                   Stack organization
                   Addressing mode and instruction format
Computer System Architecture              Chap. 8 Central Processing Unit            Dept. of Info. Of Computer
General Register Organization                                                                                                           8-2



   8-2 General Register Organization
                                                                                                                                    External Input
      The importance of register
                                                                                            C lo c k                                                           In p u t
          Memory locations are needed for storing
          pointers, counters, return address, temporary                               R1
          results, and partial products during multiplication                         R2
                                                                                      R3
          Memory access is the most time-consuming                                    R4

          operation in a computer                                                     R5
                                                                                      R6

          More convenient and efficient way is to store                               R7

          intermediate values in processor registers                           Load

      Bus organization for 7 CPU registers : Fig. 8-2                      ( 7 lin e s )
                                                                                               SELA              MUX                                  MUX                 SELB


          2 MUX : select one of 7 register or external data
                                                                                                                    A bus                                  B bus
                   input by SELA and SELB                                         3× 8
                                                                                decoder

          BUS A and BUS B : form the inputs to a
                   common ALU                                                      SELD                                 A r it h m e t ic lo g ic u n it
                                                                                                       OPR                          (A LU )
          ALU : OPR determine the arithmetic or logic
                   microoperation
                                                                                                                                                     External Output
                     » The result of the microoperation is available for
                                                                                                                                    O u tp u t
                       external data output and also goes into the inputs                                          ( a ) B lo c k d ia g ra m
                       of all the registers                                                                  3      3                   3                  5
                 3 X 8 Decoder : select the register (by SELD)                                         SELA      SELB            SELD                 OPR
                        that receives the information from ALU                                                    ( b ) C o n tro l w o rd




Computer System Architecture                   Chap. 8 Central Processing Unit                                      Dept. of Info. Of Computer
8-3



                                   C lo c k                                                                    In p u t


                             R 1
                             R 2
                             R 3
                             R 4
                             R 5
                             R 6
                             R 7


                     L o a d
                (7     lin e s )
                                      S E L A             M U X                                   M U X                   S E L B



                         3 × 8                                A     b u s                               B   b u s
                      d e c o d e r



                          S E L D                                  A r it h m e t ic lo g ic   u n it
                                              O P R                            (A L U )




                                                                              O u tp u t
                                                             ( a ) B lo c k d ia g r a m

                                                      3        3                   3                    5
                                              S E L A     S E L B           S E L D                O P R
                                                            ( b ) C o n tro l w o rd




Computer System Architecture                                   Chap. 8 Central Processing Unit                                 Dept. of Info. Of Computer
8-4



       Binary selector input :       R1 ← R 2 + R 3
            1) MUX A selector (SELA) : to place the content of R2 into BUS A
            2) MUX B selector (SELB) : to place the content of R3 into BUS B
            3) ALU operation selector (OPR) : to provide the arithmetic addition R2 + R3
            4) Decoder selector (SELD) : to transfer the content of the output bus into R1
       Control Word
                   14 bit control word (4 fields) : Fig. 8-2(b)
                       »   SELA (3 bits) : select a source register for the A input of the ALU
                       »   SELB (3 bits) : select a source register for the B input of the ALU       Tab. 8-1
                       »   SELD (3 bits) : select a destination register using the 3 X 8 decoder
                       »   OPR (5 bits) : select one of the operations in the ALU                    Tab. 8-2
                   Encoding of Register Selection Fields : Tab. 8-1
                     » SELA or SELB = 000 (Input) : MUX selects the external input data
                     » SELD = 000 (None) : no destination register is selected but the contents of the output
                       bus are available in the external output
                   Encoding of ALU Operation (OPR) : Tab. 8-2              Control Word, Control Memory
                                                                             Microprogrammed Control
       Examples of Microoperations : Tab. 8-3
           TSFA (Transfer A) : R7 ← R1, External Output ← R 2, External Output ← External Input
           XOR : R5 ← 0 ( XOR R5 ⊕ R5)

Computer System Architecture                      Chap. 8 Central Processing Unit              Dept. of Info. Of Computer
Design of control world                                       8-5




Computer System Architecture        Chap. 8 Central Processing Unit   Dept. of Info. Of Computer
question                                               8-6




           (a) 32 multiplexers, each of size 16 × 1.
           (b) 4 inputs each, to select one of 16 registers.
           (c) 4-to-16 – line decoder
           (d) 32 + 32 + 1 = 65 data input lines
           32 + 1 = 33 data output lines


Computer System Architecture      Chap. 8 Central Processing Unit   Dept. of Info. Of Computer
8-7
                                              Stack Organization
    8-3 Stack Organization
       Stack or LIFO(Last-In, First-Out)
            A storage device that stores information
                       » The item stored last is the first item retrieved = a stack of tray
                   Stack Pointer (SP)
                       » The register that holds the address for the stack
                       » SP always points at the top item in the stack
                   Two Operations of a stack : Insertion and Deletion of Items
                                                                                                                                   A d d re s s
                       » PUSH : Push-Down = Insertion
                       » POP : Pop-Up = Deletion                                                                                        64

                   Stack
                       » 1) Register Stack (Stack Depth)                                    FU LL        EM TY
                                 a finite number of memory words or register(stand alone)
                       » 2) Memory Stack (Stack Depth)
                                 a portion of a large memory                                                                              4
                                                                                                    SP                    C               3
       Register Stack : Fig. 8-3                                                                                         B               2
                                                                                                                          A               1
           PUSH : SP ← SP + 1                                  : Increment SP               Last Item                                     0
                               M [ SP ] ← DR                 : Write to the stack
   SP = 0,
   EMTY = 1,                   If ( SP = 0) then ( FULL ← 1) : Check if stack is full
                                                                                                                         DR
   FULL = 0                    EMTY ← 0                        : Mark not empty
Computer System Architecture                        Chap. 8 Central Processing Unit                          Dept. of Info. Of Computer
8-8



                POP :The first item is stored at address 1, and the last item is stored at address 0
                               DR ← M [ SP ]                     : Read item from the top of stack   * Memory Stack
                                                                                                     PUSH = Address 감소
                               SP ← SP − 1                       : Decrement Stack Pointer           * Register Stack
                               If ( SP = 0) then ( EMTY ← 1) : Check if stack is empty               PUSH = Address 증가

                               FULL ← 0                          : Mark not full                                                    A d d re s s
                                                                                                            M e m o ry u n it
     Memory Stack : Fig. 8-4                                                           PC
                                                                                                                                       1000
                                                                                                               P ro g ra m
        PUSH : SP ← SP − 1                                                                                ( in s t ru c tio n s )

 * 초기 상태
                               M [ SP ] ← DR
                                                                                                                                       2000
  SP = 4001                                                                             AR
                    » The first item is stored at address 4000                                                  D a ta
                POP : DR ← M [ SP ]                                                                        (o p e ra n d s )

                      SP ← SP + 1                    * Error Condition
                                                                                                                                       3000
                                                    PUSH when FULL = 1
                                                                                                                S ta c k
     Stack Limits                                  POP when EMTY = 1

          Check for stack overflow(full)/underflow(empty)                                                                              3997
                                                                                        SP                                             3998
                    » Checked by using two register
                                                                                                                                       3999
                                 Upper Limit and Lower Limit Register                                                                  4000
                    » After PUSH Operation                                          Start Here                                         4001

                                 SP compared with the upper limit register
                    » After POP Operation
                                 SP compared with the lower limit register                                         DR



Computer System Architecture                           Chap. 8 Central Processing Unit               Dept. of Info. Of Computer
Stack Full and Empty Condition                                    8-9




    (a) Stack full with 64 items.
    (b) stack empty


Computer System Architecture            Chap. 8 Central Processing Unit   Dept. of Info. Of Computer
Evaluating Arithmetic Expressions                                                8-10

                                              Inpix Prepix Postpix notation
       RPN (Reverse Polish Notation)              StackArithmetic
           The common mathematical method of writing arithmetic expressions imposes
           difficulties when evaluated by a computer
           A stack organization is very effective for evaluating arithmetic expressions using
           Reverse Polish Notation in following manner
           A * B + C * D → AB * CD * +
                       » ( 3 * 4 ) + ( 5 * 6 ) → 34 * 56 * +

                                                                         6

                                       4                       5         5          30
                               3       3           12          12        12         12    42

                               3       4           *           5         6          *      +




Computer System Architecture                      Chap. 8 Central Processing Unit        Dept. of Info. Of Computer
Instruction Formats                                               8-11



    8-4 Instruction Formats
      Fields in Instruction Formats
           1) Operation Code Field : specify the operation to be performed
           2) Address Field : designate a memory address or a processor
           register
           3) Mode Field : specify the operand or the effective address
           (Addressing Mode)


                          There are 3 type of CPU organization
                          1) Single AC Organization :
                          2) General Register Organization. :
                          3) Stack Organization. :



Computer System Architecture            Chap. 8 Central Processing Unit   Dept. of Info. Of Computer
8-12



       3 types of CPU organizations                        X = Operand Address

            1) Single AC Org. : ADD X     AC ← AC + M [ X ]
            2) General Register Org. : ADD R1, R2, R3       R1 ← R 2 + R 3
            3) Stack Org. : PUSH X TOS ← M [ X ]
       The influence of the number of addresses on computer instruction we will
           evaluate with
          Three address instruction
           Two address instruction                                        R1 ← M [ A] + M [ B ]
          one address instruction                                         R 2 ← M [C ] + M [ D ]
          Zero address instruction                                        M [ X ] ← R1 ∗ R 2
                X = (A + B)*(C + D) using
                   - 4 arithmetic operations : ADD, SUB, MUL, DIV
                   - 1 transfer operation to and from memory and general register : MOV
                   - 2 transfer operation to and from memory and AC register : STORE, LOAD
                   - Operand memory addresses : A, B, C, D
                   - Result memory address : X



Computer System Architecture             Chap. 8 Central Processing Unit    Dept. of Info. Of Computer
Three Address Instruction                                       8-13




                                 X = (A + B)*(C + D)




Computer System Architecture          Chap. 8 Central Processing Unit   Dept. of Info. Of Computer
8-14



                   2) Two-Address Instruction
                        MOV       R1, A      R1 ← M [ A]
                        ADD       R1, B      R1 ← R1 + M [ B ]
                        MOV       R2, C      R 2 ← M [C ]
                        ADD       R2, D      R2 ← R2 + M [ D]
                        MUL       R1, R2     R1 ← R1 ∗ R 2
                        MOV       X, R1      M [ X ] ← R1
                       » The most common in commercial computers
                       » Each address fields specify either a processor register or a memory operand
                   3) One-Address Instruction
                        LOAD       A        AC ← M [ A]
                        ADD        B        AC ← A[C ] + M [ B ]
                        STORE      T        M [T ] ← AC
                        LOAD       C        AC ← M [C ]
                        ADD        D        AC ← AC + M [ D ]
                        MUL        T        AC ← AC ∗ M [T ]
                        STORE      X        M [ X ] ← AC

                       » All operations are done between the AC register and memory operand


Computer System Architecture                    Chap. 8 Central Processing Unit           Dept. of Info. Of Computer
8-15



                   4) Zero-Address Instruction
                        PUSH       A     TOS ← A
                        PUSH       B     TOS ← B
                        ADD              TOS ← ( A + B )
                        PUSH       C     TOS ← C
                        PUSH       D     TOS ← D
                        ADD              TOS ← (C + D )
                        MUL              TOS ← (C + D ) ∗ ( A + B )
                        POP        X     M [ X ] ← TOS
                       » Stack-organized computer does not use an address field for the instructions ADD, and
                         MUL
                       » PUSH, and POP instructions need an address field to specify the operand
                       » Zero-Address : absence of address ( ADD, MUL )




Computer System Architecture                    Chap. 8 Central Processing Unit           Dept. of Info. Of Computer
8-16



                   Program to evaluate X = ( A + B ) * ( C + D )
                        LOAD       R1, A                R1 ← M [ A]
                        LOAD       R2, B                R2 ← M [ B]
                        LOAD       R3, C                R3 ← M [C ]
                        LOAD       R4, D                R4 ← M [ D]
                        ADD        R1, R1, R2           R1 ← R1 + R 2
                        ADD        R3, R3, R4           R3 ← R3 + R 4
                        MUL        R1, R1, R3           R1 ← R1 ∗ R3
                        STORE      X, R1                M [ X ] ← R1

    8-5 Addressing Modes
       Addressing Mode 의 필요성
           1) To give programming versatility to the user
                       » pointers to memory, counters for loop control, indexing of data, ….
                   2) To reduce the number of bits in the addressing field of the instruction
       Instruction Cycle
            1) Fetch the instruction from memory and PC + 1
            2) Decode the instruction
            3) Execute the instruction
Computer System Architecture                     Chap. 8 Central Processing Unit               Dept. of Info. Of Computer
8-17



       Program Counter (PC)
           PC keeps track of the instructions in the program stored in memory
           PC holds the address of the instruction to be executed next
           PC is incremented each time an instruction is fetched from memory
       Addressing Mode of the Instruction
                   1) Distinct Binary Code
                       » Instruction Format 에 Opcode 와 같이 별도에 Addressing Mode Field 를 갖고 있음
                   2) Single Binary Code
                       » Instruction Format 에 Opcode 와 Addressing Mode Field 가 섞여 있음
       Instruction Format with mode field : Fig. 8-6

                       Opcode            Mode                         Address
       Implied Mode
           Operands are specified implicitly in definition of the instruction
           Examples
                       » COM : Complement Accumulator
                                Operand in AC is implied in the definition of the instruction
                       » PUSH : Stack push
                                Operand is implied to be on top of the stack

Computer System Architecture                         Chap. 8 Central Processing Unit            Dept. of Info. Of Computer
8-18



       Immediate Mode
           Operand field contains the actual operand
           Useful for initializing registers to a constant value
           Example : LD #NBR
       Register Mode
                   Operands are in registers
                   Register is selected from a register field in the instruction
                       » k-bit register field can specify any one of 2 k registers
                   Example : LD R1            AC ← R1            Implied Mode
       Register Indirect Mode
           Selected register contains the address of the operand rather than the operand
           itself
               Address field of the instruction uses fewer bits to select a memory address
                       » Register 를 select
                   Example : LD (R1)           AC ← M [R1]
       Autoincrement or Autodecrement Mode
           Similar to the register indirect mode except that
                       » the register is incremented after its value is used to access memory
                       » the register is decrement before its value is used to access memory
Computer System Architecture                       Chap. 8 Central Processing Unit          Dept. of Info. Of Computer
8-19



                   Example (Autoincrement) : LD (R1)+           AC ← M [ R1], R1 ← R1 + 1
       Direct Addressing Mode
            Effective address is equal to the address field of the instruction (Operand)
            Address field specifies the actual branch address in a branch-type instruction
            Example : LD ADR           AC ← M [ ADR ]
                                                            ADR = Address part of Instruction
       Indirect Addressing Mode
                   Address field of instruction gives the address where the effective address is
                   stored in memory
                   Example : LD @ADR AC ← M [ M [ ADR ]]
       Relative Addressing Mode
            PC is added to the address part of the instruction to obtain the effective address
            Example : LD $ADR         AC ← M [ PC + ADR ]
       Indexed Addressing Mode
                   XR (Index register) is added to the address part of the instruction to obtain the
                   effective address
                   Example : LD ADR(XR) AC ← M [ ADR + XR ]
       Base Register Addressing Mode            Not Here
           the content of a base register is added to the address part of the instruction to
           obtain the effective address
Computer System Architecture                 Chap. 8 Central Processing Unit          Dept. of Info. Of Computer
8-20



               Similar to the indexed addressing mode except that the register is now called a
               base register instead of an index register
                   » index register (XR) : LD ADR(XR)                      AC ← M [ ADR + XR ]                   ADR
                               index register hold an index number that is relative to the address part of the instruction
                   » base register (BR) : LD ADR(BR)                       AC ← M [ BR + ADR ]                        BR
                               base register hold a base address
                               the address field of the instruction gives a displacement relative to this base address
                                                                                                       A d d re s s           M e m o ry
   Numerical Example
                                                                                    PC = 200                 200      L o a d to A C          Mode
         Addressing Mode              Effective Address    Content of AC
                                                                                                             201       A d d re s s = 5 0 0
  Immediate Address Mode                     201               500
  Direct Address Mode                        500               800                   R1 = 400                202       N e x t in s tru c tio n
  Indirect Address Mode                      800               300
  Register Mode                                                400                  XR = 100
  Register Indirect Mode                    400                700
                                                                                                             399                450
  Relative Address Mode                     702                 325
  Indexed Address Mode                      600                900                     AC                    400                700
  Autoincrement Mode                        400                700
                                                                                                                               800
  Autodecrement Mode                        399                 450                                          500

                                                               R1 = 400
                                                                                                             600                900
                                                             500 + 202 (PC)
           R1 = 400 (after)                                                                                  702                325
                                                            500 + 100 (XR)
         R1 = 400 -1 (prior)
                                                                                                             800                300


Computer System Architecture                              Chap. 8 Central Processing Unit                       Dept. of Info. Of Computer

Más contenido relacionado

La actualidad más candente

I. Introduction to Microprocessor System.ppt
I. Introduction to Microprocessor System.pptI. Introduction to Microprocessor System.ppt
I. Introduction to Microprocessor System.ppt
HAriesOa1
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computers
Bảo Hoang
 
COMPUTER ORGANIZATION -Multiplexer,Demultiplexer, Encoder
COMPUTER ORGANIZATION -Multiplexer,Demultiplexer, EncoderCOMPUTER ORGANIZATION -Multiplexer,Demultiplexer, Encoder
COMPUTER ORGANIZATION -Multiplexer,Demultiplexer, Encoder
Vanitha Chandru
 
Hardware and Software parallelism
Hardware and Software parallelismHardware and Software parallelism
Hardware and Software parallelism
prashantdahake
 

La actualidad más candente (20)

I. Introduction to Microprocessor System.ppt
I. Introduction to Microprocessor System.pptI. Introduction to Microprocessor System.ppt
I. Introduction to Microprocessor System.ppt
 
Arithmetic logic shift unit
Arithmetic logic shift unitArithmetic logic shift unit
Arithmetic logic shift unit
 
Ch8 (1) morris mano
Ch8 (1) morris manoCh8 (1) morris mano
Ch8 (1) morris mano
 
8259 Programmable Interrupt Controller by vijay
8259 Programmable Interrupt Controller by vijay8259 Programmable Interrupt Controller by vijay
8259 Programmable Interrupt Controller by vijay
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Basic ops concept of comp
Basic ops  concept of compBasic ops  concept of comp
Basic ops concept of comp
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computers
 
System bus timing 8086
System bus timing 8086System bus timing 8086
System bus timing 8086
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Shifters
ShiftersShifters
Shifters
 
Hardwired control
Hardwired controlHardwired control
Hardwired control
 
Computer Arithmetic
Computer ArithmeticComputer Arithmetic
Computer Arithmetic
 
Interfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorInterfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessor
 
Types of operators in C
Types of operators in CTypes of operators in C
Types of operators in C
 
COMPUTER ORGANIZATION -Multiplexer,Demultiplexer, Encoder
COMPUTER ORGANIZATION -Multiplexer,Demultiplexer, EncoderCOMPUTER ORGANIZATION -Multiplexer,Demultiplexer, Encoder
COMPUTER ORGANIZATION -Multiplexer,Demultiplexer, Encoder
 
Segment registers
Segment registersSegment registers
Segment registers
 
Interrupt
InterruptInterrupt
Interrupt
 
Hardware and Software parallelism
Hardware and Software parallelismHardware and Software parallelism
Hardware and Software parallelism
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operations
 
Embedded c
Embedded cEmbedded c
Embedded c
 

Destacado

Register of 80386
Register of 80386Register of 80386
Register of 80386
aviban
 
Addressing modes (detailed data path)
Addressing modes (detailed data path)Addressing modes (detailed data path)
Addressing modes (detailed data path)
Mahesh Kumar Attri
 
Computer instructions
Computer instructionsComputer instructions
Computer instructions
Anuj Modi
 

Destacado (20)

Central Processing Unit
Central Processing UnitCentral Processing Unit
Central Processing Unit
 
Individualizing Programmed Materials
Individualizing Programmed MaterialsIndividualizing Programmed Materials
Individualizing Programmed Materials
 
CPU= Central Processing Unit
CPU= Central Processing UnitCPU= Central Processing Unit
CPU= Central Processing Unit
 
CO by Rakesh Roshan
CO by Rakesh RoshanCO by Rakesh Roshan
CO by Rakesh Roshan
 
ITFT_Risc
ITFT_RiscITFT_Risc
ITFT_Risc
 
overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...
 
Csa stack
Csa stackCsa stack
Csa stack
 
input output Organization
input output Organizationinput output Organization
input output Organization
 
Register of 80386
Register of 80386Register of 80386
Register of 80386
 
Computer Organisation Part 4
Computer Organisation Part 4Computer Organisation Part 4
Computer Organisation Part 4
 
Addressing modes (detailed data path)
Addressing modes (detailed data path)Addressing modes (detailed data path)
Addressing modes (detailed data path)
 
Memory reference instruction
Memory reference instructionMemory reference instruction
Memory reference instruction
 
Computer Systems
Computer SystemsComputer Systems
Computer Systems
 
Computer instruction
Computer instructionComputer instruction
Computer instruction
 
Instruction code
Instruction codeInstruction code
Instruction code
 
Micro Programmed Control Unit
Micro Programmed Control UnitMicro Programmed Control Unit
Micro Programmed Control Unit
 
Computer instructions
Computer instructionsComputer instructions
Computer instructions
 
Stack
StackStack
Stack
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructions
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
 

Similar a Central Processing Unit User View

Microprocessor and microcontroller
Microprocessor and microcontrollerMicroprocessor and microcontroller
Microprocessor and microcontroller
Ravinder Singla
 

Similar a Central Processing Unit User View (20)

basic computer programming and micro programmed control
basic computer programming and micro programmed controlbasic computer programming and micro programmed control
basic computer programming and micro programmed control
 
Bca 2nd sem-u-3-basic computer programming and micro programmed control
Bca 2nd sem-u-3-basic computer programming and micro programmed controlBca 2nd sem-u-3-basic computer programming and micro programmed control
Bca 2nd sem-u-3-basic computer programming and micro programmed control
 
B.sc cs-ii-u-3-basic computer programming and micro programmed control
B.sc cs-ii-u-3-basic computer programming and micro programmed controlB.sc cs-ii-u-3-basic computer programming and micro programmed control
B.sc cs-ii-u-3-basic computer programming and micro programmed control
 
assignment 1-MC.pdf
assignment 1-MC.pdfassignment 1-MC.pdf
assignment 1-MC.pdf
 
Computer engineering - overview of microprocessors
Computer engineering - overview of microprocessorsComputer engineering - overview of microprocessors
Computer engineering - overview of microprocessors
 
U proc ovw
U proc ovwU proc ovw
U proc ovw
 
MicroProcessors
MicroProcessors MicroProcessors
MicroProcessors
 
Chapter 1 microprocessor introduction
Chapter 1 microprocessor introductionChapter 1 microprocessor introduction
Chapter 1 microprocessor introduction
 
microprocessor8085pptcomplete-170518063501.pdf
microprocessor8085pptcomplete-170518063501.pdfmicroprocessor8085pptcomplete-170518063501.pdf
microprocessor8085pptcomplete-170518063501.pdf
 
Microprocessor 8085 complete
Microprocessor 8085 completeMicroprocessor 8085 complete
Microprocessor 8085 complete
 
microprocessor8085 power point presentation
microprocessor8085 power point presentationmicroprocessor8085 power point presentation
microprocessor8085 power point presentation
 
PIC Introduction and explained in detailed
PIC Introduction and explained in detailedPIC Introduction and explained in detailed
PIC Introduction and explained in detailed
 
Unit iii mca 1st year
Unit iii mca 1st yearUnit iii mca 1st year
Unit iii mca 1st year
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085
 
Microprocessor and microcontroller
Microprocessor and microcontrollerMicroprocessor and microcontroller
Microprocessor and microcontroller
 
8085 microprocessor Embedded system
8085 microprocessor  Embedded system8085 microprocessor  Embedded system
8085 microprocessor Embedded system
 
8085 intro
8085 intro8085 intro
8085 intro
 
unit 1ARM INTRODUCTION.pptx
unit 1ARM INTRODUCTION.pptxunit 1ARM INTRODUCTION.pptx
unit 1ARM INTRODUCTION.pptx
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessor
 

Más de Anuj Modi

Virtual memory
Virtual memoryVirtual memory
Virtual memory
Anuj Modi
 
Timing and-control-unit
Timing and-control-unitTiming and-control-unit
Timing and-control-unit
Anuj Modi
 
Synchronous and-asynchronous-data-transfer
Synchronous and-asynchronous-data-transferSynchronous and-asynchronous-data-transfer
Synchronous and-asynchronous-data-transfer
Anuj Modi
 
Registers and-common-bus
Registers and-common-busRegisters and-common-bus
Registers and-common-bus
Anuj Modi
 
Ram and-rom-chips
Ram and-rom-chipsRam and-rom-chips
Ram and-rom-chips
Anuj Modi
 
Cache memory
Cache memoryCache memory
Cache memory
Anuj Modi
 
HTML Lesson 5-insert-and-align-graphics
HTML Lesson 5-insert-and-align-graphicsHTML Lesson 5-insert-and-align-graphics
HTML Lesson 5-insert-and-align-graphics
Anuj Modi
 
HTML Lesson 2-format-pages-and-text
HTML Lesson 2-format-pages-and-textHTML Lesson 2-format-pages-and-text
HTML Lesson 2-format-pages-and-text
Anuj Modi
 
HTML Lesson 1-create-a-home-page
HTML Lesson 1-create-a-home-pageHTML Lesson 1-create-a-home-page
HTML Lesson 1-create-a-home-page
Anuj Modi
 
Introduction to-dbms
Introduction to-dbmsIntroduction to-dbms
Introduction to-dbms
Anuj Modi
 
Architecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceArchitecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independence
Anuj Modi
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
Anuj Modi
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
Anuj Modi
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data Structure
Anuj Modi
 

Más de Anuj Modi (18)

Android Technology
Android TechnologyAndroid Technology
Android Technology
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Timing and-control-unit
Timing and-control-unitTiming and-control-unit
Timing and-control-unit
 
Synchronous and-asynchronous-data-transfer
Synchronous and-asynchronous-data-transferSynchronous and-asynchronous-data-transfer
Synchronous and-asynchronous-data-transfer
 
Registers and-common-bus
Registers and-common-busRegisters and-common-bus
Registers and-common-bus
 
Ram and-rom-chips
Ram and-rom-chipsRam and-rom-chips
Ram and-rom-chips
 
Memory
MemoryMemory
Memory
 
Cache memory
Cache memoryCache memory
Cache memory
 
HTML Lesson 5-insert-and-align-graphics
HTML Lesson 5-insert-and-align-graphicsHTML Lesson 5-insert-and-align-graphics
HTML Lesson 5-insert-and-align-graphics
 
HTML Lesson 2-format-pages-and-text
HTML Lesson 2-format-pages-and-textHTML Lesson 2-format-pages-and-text
HTML Lesson 2-format-pages-and-text
 
HTML Lesson 1-create-a-home-page
HTML Lesson 1-create-a-home-pageHTML Lesson 1-create-a-home-page
HTML Lesson 1-create-a-home-page
 
Introduction to-dbms
Introduction to-dbmsIntroduction to-dbms
Introduction to-dbms
 
DBA
DBADBA
DBA
 
Data models
Data modelsData models
Data models
 
Architecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceArchitecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independence
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
 
Graphs In Data Structure
Graphs In Data StructureGraphs In Data Structure
Graphs In Data Structure
 
B trees in Data Structure
B trees in Data StructureB trees in Data Structure
B trees in Data Structure
 

Central Processing Unit User View

  • 1. Chap. 8 Central Processing Unit 8-1 8-1 Introduction  3 major parts of CPU : Fig. 8-1 1) Register Set 2) ALU 3) Control  Design Examples of simple CPU Hardwired Control : Chap. 5 Microprogrammed Control : Chap. 7  In this chapter : Chap. 8 Computer Architecture as seen by the programmer Describe the organization and architecture of the CPU with an emphasis on the user’s view of the computer by using two way General purpose organization Stack organization Addressing mode and instruction format Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 2. General Register Organization 8-2 8-2 General Register Organization External Input  The importance of register C lo c k In p u t Memory locations are needed for storing pointers, counters, return address, temporary R1 results, and partial products during multiplication R2 R3 Memory access is the most time-consuming R4 operation in a computer R5 R6 More convenient and efficient way is to store R7 intermediate values in processor registers Load  Bus organization for 7 CPU registers : Fig. 8-2 ( 7 lin e s ) SELA MUX MUX SELB 2 MUX : select one of 7 register or external data A bus B bus input by SELA and SELB 3× 8 decoder BUS A and BUS B : form the inputs to a common ALU SELD A r it h m e t ic lo g ic u n it OPR (A LU ) ALU : OPR determine the arithmetic or logic microoperation External Output » The result of the microoperation is available for O u tp u t external data output and also goes into the inputs ( a ) B lo c k d ia g ra m of all the registers 3 3 3 5 3 X 8 Decoder : select the register (by SELD) SELA SELB SELD OPR that receives the information from ALU ( b ) C o n tro l w o rd Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 3. 8-3 C lo c k In p u t R 1 R 2 R 3 R 4 R 5 R 6 R 7 L o a d (7 lin e s ) S E L A M U X M U X S E L B 3 × 8 A b u s B b u s d e c o d e r S E L D A r it h m e t ic lo g ic u n it O P R (A L U ) O u tp u t ( a ) B lo c k d ia g r a m 3 3 3 5 S E L A S E L B S E L D O P R ( b ) C o n tro l w o rd Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 4. 8-4  Binary selector input : R1 ← R 2 + R 3 1) MUX A selector (SELA) : to place the content of R2 into BUS A 2) MUX B selector (SELB) : to place the content of R3 into BUS B 3) ALU operation selector (OPR) : to provide the arithmetic addition R2 + R3 4) Decoder selector (SELD) : to transfer the content of the output bus into R1  Control Word 14 bit control word (4 fields) : Fig. 8-2(b) » SELA (3 bits) : select a source register for the A input of the ALU » SELB (3 bits) : select a source register for the B input of the ALU Tab. 8-1 » SELD (3 bits) : select a destination register using the 3 X 8 decoder » OPR (5 bits) : select one of the operations in the ALU Tab. 8-2 Encoding of Register Selection Fields : Tab. 8-1 » SELA or SELB = 000 (Input) : MUX selects the external input data » SELD = 000 (None) : no destination register is selected but the contents of the output bus are available in the external output Encoding of ALU Operation (OPR) : Tab. 8-2 Control Word, Control Memory Microprogrammed Control  Examples of Microoperations : Tab. 8-3 TSFA (Transfer A) : R7 ← R1, External Output ← R 2, External Output ← External Input XOR : R5 ← 0 ( XOR R5 ⊕ R5) Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 5. Design of control world 8-5 Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 6. question 8-6 (a) 32 multiplexers, each of size 16 × 1. (b) 4 inputs each, to select one of 16 registers. (c) 4-to-16 – line decoder (d) 32 + 32 + 1 = 65 data input lines 32 + 1 = 33 data output lines Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 7. 8-7 Stack Organization 8-3 Stack Organization  Stack or LIFO(Last-In, First-Out) A storage device that stores information » The item stored last is the first item retrieved = a stack of tray Stack Pointer (SP) » The register that holds the address for the stack » SP always points at the top item in the stack Two Operations of a stack : Insertion and Deletion of Items A d d re s s » PUSH : Push-Down = Insertion » POP : Pop-Up = Deletion 64 Stack » 1) Register Stack (Stack Depth) FU LL EM TY a finite number of memory words or register(stand alone) » 2) Memory Stack (Stack Depth) a portion of a large memory 4 SP C 3  Register Stack : Fig. 8-3 B 2 A 1 PUSH : SP ← SP + 1 : Increment SP Last Item 0 M [ SP ] ← DR : Write to the stack SP = 0, EMTY = 1, If ( SP = 0) then ( FULL ← 1) : Check if stack is full DR FULL = 0 EMTY ← 0 : Mark not empty Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 8. 8-8 POP :The first item is stored at address 1, and the last item is stored at address 0 DR ← M [ SP ] : Read item from the top of stack * Memory Stack PUSH = Address 감소 SP ← SP − 1 : Decrement Stack Pointer * Register Stack If ( SP = 0) then ( EMTY ← 1) : Check if stack is empty PUSH = Address 증가 FULL ← 0 : Mark not full A d d re s s M e m o ry u n it  Memory Stack : Fig. 8-4 PC 1000 P ro g ra m PUSH : SP ← SP − 1 ( in s t ru c tio n s ) * 초기 상태 M [ SP ] ← DR 2000 SP = 4001 AR » The first item is stored at address 4000 D a ta POP : DR ← M [ SP ] (o p e ra n d s ) SP ← SP + 1 * Error Condition 3000 PUSH when FULL = 1 S ta c k  Stack Limits POP when EMTY = 1 Check for stack overflow(full)/underflow(empty) 3997 SP 3998 » Checked by using two register 3999 Upper Limit and Lower Limit Register 4000 » After PUSH Operation Start Here 4001 SP compared with the upper limit register » After POP Operation SP compared with the lower limit register DR Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 9. Stack Full and Empty Condition 8-9 (a) Stack full with 64 items. (b) stack empty Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 10. Evaluating Arithmetic Expressions 8-10 Inpix Prepix Postpix notation  RPN (Reverse Polish Notation) StackArithmetic The common mathematical method of writing arithmetic expressions imposes difficulties when evaluated by a computer A stack organization is very effective for evaluating arithmetic expressions using Reverse Polish Notation in following manner A * B + C * D → AB * CD * + » ( 3 * 4 ) + ( 5 * 6 ) → 34 * 56 * + 6 4 5 5 30 3 3 12 12 12 12 42 3 4 * 5 6 * + Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 11. Instruction Formats 8-11 8-4 Instruction Formats  Fields in Instruction Formats 1) Operation Code Field : specify the operation to be performed 2) Address Field : designate a memory address or a processor register 3) Mode Field : specify the operand or the effective address (Addressing Mode) There are 3 type of CPU organization 1) Single AC Organization : 2) General Register Organization. : 3) Stack Organization. : Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 12. 8-12  3 types of CPU organizations X = Operand Address 1) Single AC Org. : ADD X AC ← AC + M [ X ] 2) General Register Org. : ADD R1, R2, R3 R1 ← R 2 + R 3 3) Stack Org. : PUSH X TOS ← M [ X ]  The influence of the number of addresses on computer instruction we will evaluate with  Three address instruction  Two address instruction R1 ← M [ A] + M [ B ]  one address instruction R 2 ← M [C ] + M [ D ]  Zero address instruction M [ X ] ← R1 ∗ R 2 X = (A + B)*(C + D) using - 4 arithmetic operations : ADD, SUB, MUL, DIV - 1 transfer operation to and from memory and general register : MOV - 2 transfer operation to and from memory and AC register : STORE, LOAD - Operand memory addresses : A, B, C, D - Result memory address : X Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 13. Three Address Instruction 8-13 X = (A + B)*(C + D) Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 14. 8-14 2) Two-Address Instruction MOV R1, A R1 ← M [ A] ADD R1, B R1 ← R1 + M [ B ] MOV R2, C R 2 ← M [C ] ADD R2, D R2 ← R2 + M [ D] MUL R1, R2 R1 ← R1 ∗ R 2 MOV X, R1 M [ X ] ← R1 » The most common in commercial computers » Each address fields specify either a processor register or a memory operand 3) One-Address Instruction LOAD A AC ← M [ A] ADD B AC ← A[C ] + M [ B ] STORE T M [T ] ← AC LOAD C AC ← M [C ] ADD D AC ← AC + M [ D ] MUL T AC ← AC ∗ M [T ] STORE X M [ X ] ← AC » All operations are done between the AC register and memory operand Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 15. 8-15 4) Zero-Address Instruction PUSH A TOS ← A PUSH B TOS ← B ADD TOS ← ( A + B ) PUSH C TOS ← C PUSH D TOS ← D ADD TOS ← (C + D ) MUL TOS ← (C + D ) ∗ ( A + B ) POP X M [ X ] ← TOS » Stack-organized computer does not use an address field for the instructions ADD, and MUL » PUSH, and POP instructions need an address field to specify the operand » Zero-Address : absence of address ( ADD, MUL ) Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 16. 8-16 Program to evaluate X = ( A + B ) * ( C + D ) LOAD R1, A R1 ← M [ A] LOAD R2, B R2 ← M [ B] LOAD R3, C R3 ← M [C ] LOAD R4, D R4 ← M [ D] ADD R1, R1, R2 R1 ← R1 + R 2 ADD R3, R3, R4 R3 ← R3 + R 4 MUL R1, R1, R3 R1 ← R1 ∗ R3 STORE X, R1 M [ X ] ← R1 8-5 Addressing Modes  Addressing Mode 의 필요성 1) To give programming versatility to the user » pointers to memory, counters for loop control, indexing of data, …. 2) To reduce the number of bits in the addressing field of the instruction  Instruction Cycle 1) Fetch the instruction from memory and PC + 1 2) Decode the instruction 3) Execute the instruction Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 17. 8-17  Program Counter (PC) PC keeps track of the instructions in the program stored in memory PC holds the address of the instruction to be executed next PC is incremented each time an instruction is fetched from memory  Addressing Mode of the Instruction 1) Distinct Binary Code » Instruction Format 에 Opcode 와 같이 별도에 Addressing Mode Field 를 갖고 있음 2) Single Binary Code » Instruction Format 에 Opcode 와 Addressing Mode Field 가 섞여 있음  Instruction Format with mode field : Fig. 8-6 Opcode Mode Address  Implied Mode Operands are specified implicitly in definition of the instruction Examples » COM : Complement Accumulator Operand in AC is implied in the definition of the instruction » PUSH : Stack push Operand is implied to be on top of the stack Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 18. 8-18  Immediate Mode Operand field contains the actual operand Useful for initializing registers to a constant value Example : LD #NBR  Register Mode Operands are in registers Register is selected from a register field in the instruction » k-bit register field can specify any one of 2 k registers Example : LD R1 AC ← R1 Implied Mode  Register Indirect Mode Selected register contains the address of the operand rather than the operand itself Address field of the instruction uses fewer bits to select a memory address » Register 를 select Example : LD (R1) AC ← M [R1]  Autoincrement or Autodecrement Mode Similar to the register indirect mode except that » the register is incremented after its value is used to access memory » the register is decrement before its value is used to access memory Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 19. 8-19 Example (Autoincrement) : LD (R1)+ AC ← M [ R1], R1 ← R1 + 1  Direct Addressing Mode Effective address is equal to the address field of the instruction (Operand) Address field specifies the actual branch address in a branch-type instruction Example : LD ADR AC ← M [ ADR ] ADR = Address part of Instruction  Indirect Addressing Mode Address field of instruction gives the address where the effective address is stored in memory Example : LD @ADR AC ← M [ M [ ADR ]]  Relative Addressing Mode PC is added to the address part of the instruction to obtain the effective address Example : LD $ADR AC ← M [ PC + ADR ]  Indexed Addressing Mode XR (Index register) is added to the address part of the instruction to obtain the effective address Example : LD ADR(XR) AC ← M [ ADR + XR ]  Base Register Addressing Mode Not Here the content of a base register is added to the address part of the instruction to obtain the effective address Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer
  • 20. 8-20 Similar to the indexed addressing mode except that the register is now called a base register instead of an index register » index register (XR) : LD ADR(XR) AC ← M [ ADR + XR ] ADR index register hold an index number that is relative to the address part of the instruction » base register (BR) : LD ADR(BR) AC ← M [ BR + ADR ] BR base register hold a base address the address field of the instruction gives a displacement relative to this base address A d d re s s M e m o ry  Numerical Example PC = 200 200 L o a d to A C Mode Addressing Mode Effective Address Content of AC 201 A d d re s s = 5 0 0 Immediate Address Mode 201 500 Direct Address Mode 500 800 R1 = 400 202 N e x t in s tru c tio n Indirect Address Mode 800 300 Register Mode 400 XR = 100 Register Indirect Mode 400 700 399 450 Relative Address Mode 702 325 Indexed Address Mode 600 900 AC 400 700 Autoincrement Mode 400 700  800 Autodecrement Mode 399 450 500 R1 = 400 600 900 500 + 202 (PC) R1 = 400 (after) 702 325 500 + 100 (XR) R1 = 400 -1 (prior) 800 300 Computer System Architecture Chap. 8 Central Processing Unit Dept. of Info. Of Computer