William Stallings Computer Organization and Architecture 10Th

William Stallings Computer Organization and Architecture 10Th

+ William Stallings Computer Organization and Architecture 10 th Edition © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. + Chapter 14 Processor Structure and Function © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. + Processor Organization Processor Requirements: Fetch instruction The processor reads an instruction from memory (register, cache, main memory) Interpret instruction The instruction is decoded to determine what action is required Fetch data The execution of an instruction may require reading data from memory or an I/O module Process data The execution of an instruction may require performing some arithmetic or logical operation on data Write data The results of an execution may require writing data to memory or an I/O module In order to do these things the processor needs to store some data temporarily and therefore needs a small internal memory © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Registers ALU Control Unit Control Data Address Bus Bus Bus System Bus Figure 14.1 The CPU with the System Bus © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Arithmetic and Logic Unit Status Flags Registers Shifter Complementer InternalCPU Bus Arithmetic and Boolean Logic Control Unit Control Paths Figure 14.2 Internal Structure of the CPU © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. + Register Organization Within the processor there is a set of registers that function as a level of memory above main memory and cache in the hierarchy The registers in the processor perform two roles: User-Visible Registers Control and Status Registers Enable the machine or Used by the control unit to assembly language control the operation of the programmer to minimize main processor and by privileged memory references by operating system programs to optimizing use of registers control the execution of programs © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. User-Visible Registers Categories: Referenced by means of • General purpose the machine language • Can be assigned to a variety of functions by the programmer that the processor • Data executes • May be used only to hold data and cannot be employed in the calculation of an operand address • Address • May be somewhat general purpose or may be devoted to a particular addressing mode • Examples: segment pointers, index registers, stack pointer • Condition codes • Also referred to as flags • Bits set by the processor hardware as the result of operations © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Table 14.1 Condition Codes Advan tage s Disad van tage s 1. Because condition codes are set by normal 1. Condition codes add complexity, both to arithmetic and data movement instructions, the hardware and software. Condition code they should reduce the number of bits are often modified in different ways COMPARE and TEST instructions needed. by different instructions, making life more 2. Conditional instructions, such as BRANCH difficult for both the microprogrammer are simplified relative to composite and compiler writer. instructions, such as TEST AND 2. Condition codes are irregular; they are BRANCH. typically not part of the main data path, so 3. Condition codes facilitate multiway they require extra hardware connections. branches. For example, a TEST instruction 3. Often condition code machines must add can be followed by two branches, one on special non-condition-code instructions for less than or equal to zero and one on special situations anyway, such as bit greater than zero. checking, loop control, and atomic semaphore operations. 4. Condition codes can be saved on the stack 4. In a pipelined implementation, condition during subroutine calls along with other codes require special synchronization to register information. avoid conflicts. © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. + Control and Status Registers Four registers are essential to instruction execution: Program counter (PC) Contains the address of an instruction to be fetched Instruction register (IR) Contains the instruction most recently fetched Memory address register (MAR) Contains the address of a location in memory Memory buffer register (MBR) Contains a word of data to be written to memory or the word most recently read © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. + Program Status Word (PSW) Register or set of registers that contain status information Common fields or flags include: • Sign • Zero • Carry • Equal • Overflow • Interrupt Enable/Disable • Supervisor © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Data registers General registers General Registers D0 AX Accumulator EAX AX D1 BX Base EBX BX D2 CX Count ECX CX D3 DX Data EDX DX D4 D5 Pointers & index ESP SP D6 SP Stack ptr EBP BP D7 BP Base ptr ESI SI SI Source index EDI DI Address registers DI Dest index A0 Program Status A1 Segment FLAGS Register A2 CS Code Instruction Pointer A3 DS Data A4 SS Stack (c) 80386 - Pentium 4 A5 ES Extrat A6 A7´ Program status Flags Instr ptr Program status Program counter (b) 8086 Status register (a) MC68000 Figure 14.3 Example Microprocessor Register Organizations © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Includes the following Instruction stages: Cycle Fetch Execute Interrupt If interrupts are enabled Read the next and an interrupt has Interpret the opcode instruction from occurred, save the and perform the memory into the current process state indicated operation processor and service the interrupt © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Fetch Interrupt Indirect Execute Figure 14.4 The Instruction Cycle © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Indirection Indirection Instruction Operand Operand fetch fetch store Multiple Multiple operands results Instruction Instruction Operand Operand Data address operation address address Operation calculation decoding calculation calculation Instruction complete, Return for string fetch next instruction or vector data No interrupt Interrupt check Interrupt Interrupt Figure 14.5 Instruction Cycle State Diagram © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. CPU PC MAR Memory Control Unit IR MBR Address Data Control Bus Bus Bus MBR = Memory buffer register MAR = Memory address register IR = Instruction register PC = Program counter Figure 14.6 Data Flow, Fetch Cycle © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. CPU MAR Memory Control Unit MBR Address Data Control Bus Bus Bus Figure 14.7 Data Flow, Indirect Cycle © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. CPU PC MAR Memory Control Unit MBR Address Data Control Bus Bus Bus Figure 14.8 Data Flow, Interrupt Cycle © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Pipelining Strategy To apply this concept to instruction execution we must Similar to the use of recognize that an an assembly line in a instruction has a manufacturing plant number of stages New inputs are accepted at one end before previously accepted inputs appear as outputs at the other end © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Instruction Instruction Result Fetch Execute (a) Simplified view WaitNew address Wait Instruction Instruction Result Fetch Execute Discard (b) Expanded view Figure 14.9 Two-Stage Instruction Pipeline © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. + Additional Stages Fetch instruction (FI) Read the next expected Fetch operands (FO) instruction into a buffer Fetch each operand from memory Decode instruction (DI) Operands in registers need Determine the opcode and not be fetched the operand specifiers Execute instruction (EI) Calculate operands (CO) Perform the indicated Calculate the effective operation and store the address of each source result, if any, in the specified operand destination operand location This may involve displacement, register Write operand (WO) indirect, indirect, or other Store the result in memory forms of address calculation © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Time 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Instruction 1 FI DI CO FO EI WO Instruction 2 FI DI CO FO EI WO Instruction 3 FI DI CO FO EI WO Instruction 4 FI DI CO FO EI WO Instruction 5 FI DI CO FO EI WO Instruction 6 FI DI CO FO EI WO Instruction 7 FI DI CO FO EI WO Instruction 8 FI DI CO FO EI WO Instruction 9 FI DI CO FO EI WO Figure 14.10 Timing Diagram for Instruction Pipeline Operation © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Time Branch Penalty 1 2 3 4 5 6 7 8 910 11 12 13 14 Instruction 1 FI DI CO FO EI WO Instruction 2 FI DI CO FO EI WO Instruction 3 FI DI CO FO EI WO Instruction 4 FI DI CO FO Instruction 5 FI DI CO Instruction 6 FI DI Instruction 7 FI Instruction 15 FI DI CO FO EI WO Instruction 16 FI DI CO FO EI WO Figure 14.11 The Effect of a Conditional Branch on Instruction Pipeline Operation © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. Fetch Instruction FI Decode DI Instruction Calculate CO Operands Yes Uncon- ditional Branch? No Fetch FO Operands Execute EI Instruction Update Write PC WO Operands Empty Pipe Yes Branch No or Inter -rupt? Figure 14.12 Six-Stage Instruction Pipeline © 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. FI DI CO FO EI WO FI DI CO FO EI WO 1 I1 1 I1 2 I2 I1 2 I2 I1 3 I3 I2 I1 3 I3 I2 I1 4 I4 I3 I2 I1 4 I4 I3 I2 I1 5 I5 I4 I3 I2 I1 5 I5 I4 I3 I2 I1 6 I6 I5 I4 I3 I2 I1 6 I6 I5 I4 I3 I2 I1 Time 7 I7 I6 I5 I4 I3 I2 7 I7 I6 I5 I4 I3 I2 8 I8 I7 I6 I5 I4 I3 8 I15 I3 9 I9 I8 I7 I6 I5 I4 9 I16 I15 10 I9 I8 I7 I6 I5 10 I16 I15 11 I9 I8 I7 I6 11 I16 I15 12 I9 I8 I7 12 I16 I15 13 I9 I8 13 I16 I15 14 I9 14 I16 (a) No branches (b) With conditional branch Figure 14.13 An Alternative Pipeline Depiction © 2016 Pearson Education, Inc., Hoboken, NJ.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    54 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us