Understanding CPU Structure and Function in Computer Organization and Architecture

Slide Note
Embed
Share

Exploring the intricate details of CPU architecture, this content delves into the essential tasks of fetching, interpreting, processing, and writing data. It discusses the significance of registers, user-visible registers, general-purpose registers, and condition code registers in CPU operations. Additionally, it highlights the number of general-purpose registers, their size requirements, and the impact on memory references. The content provides valuable insights into designing efficient processor structures and the top-level memory hierarchy considerations.


Uploaded on Oct 05, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. William Stallings Computer Organization and Architecture 8thEdition Chapter 12 Processor Structure and Function

  2. CPU Structure CPU must: Fetch instructions Interpret instructions Fetch data Process data Write data

  3. CPU With Systems Bus

  4. CPU Internal Structure

  5. Registers CPU must have some working space (temporary storage) Called registers Number and function vary between processor designs One of the major design decisions Top level of memory hierarchy

  6. User Visible Registers General Purpose Data Address Condition Codes

  7. General Purpose Registers (1) May be true general purpose May be restricted May be used for data or addressing Data Accumulator Addressing Segment

  8. General Purpose Registers (2) Make them general purpose Increase flexibility and programmer options Increase instruction size & complexity Make them specialized Smaller (faster) instructions Less flexibility

  9. How Many GP Registers? Between 8 - 32 Fewer = more memory references More does not reduce memory references and takes up processor real estate See also RISC

  10. How big? Large enough to hold full address Large enough to hold full word Often possible to combine two data registers C programming double int a; long int a;

  11. Condition Code Registers Sets of individual bits e.g. result of last operation was zero Can be read (implicitly) by programs e.g. Jump if zero Can not (usually) be set by programs

  12. VonNeumann Architecture Control & Status Registers Program Counter Instruction Decoding Register Memory Address Register Memory Buffer Register Revision: what do these all do? Program Counter (PC) Holds address of next instruction to be fetched Memory Address Register (MAR) Connected to address bus Specifies address for read or write op Memory Buffer Register (MBR) Connected to data bus Holds data to write or last data read Instruction Register (IR) Holds last instruction fetched

  13. Program Status Word A set of bits Includes Condition Codes Sign of last result Zero Carry Equal Overflow Interrupt enable/disable Supervisor

  14. Other Registers May have registers pointing to: Process control blocks (see O/S) Interrupt Vectors (see O/S) N.B. CPU design and operating system design are closely linked

  15. Example Register Organizations: 8086 processor Case study Explain -8086 Architecture -Register organization

  16. Instruction Cycle Revision Stallings Chapter 3

  17. Indirect Cycle May require memory access to fetch operands Indirect addressing requires more memory accesses Can be thought of as additional instruction subcycle

  18. Instruction Cycle with Indirect

  19. Instruction Cycle State Diagram

  20. Data Flow (Instruction Fetch) Depends on CPU design In general: Fetch PC contains address of next instruction Address moved to MAR Address placed on address bus Control unit requests memory read Result placed on data bus, copied to MBR, then to IR Meanwhile PC incremented by 1

  21. Data Flow (Instruction Fetch Diagram) Fetch PC contains address of next instruction Address moved to MAR Address placed on address bus Control unit requests memory read Result placed on data bus, copied to MBR, then to IR Meanwhile PC incremented by 1

  22. Data Flow (Data Fetch) IR is examined If indirect addressing, indirect cycle is performed Right most N bits of MBR transferred to MAR Control unit requests memory read Result (address of operand) moved to MBR

  23. Data Flow (Indirect Diagram) IR is examined If indirect addressing, indirect cycle is performed Right most N bits of MBR transferred to MAR Control unit requests memory read Result (address of operand) moved to MBR

  24. Data Flow (Execute) May take many forms Depends on instruction being executed May include Memory read/write Input/Output Register transfers ALU operations

  25. Data Flow (Interrupt) Simple Predictable Current PC saved to allow resumption after interrupt Contents of PC copied to MBR Special memory location (e.g. stack pointer) loaded to MAR MBR written to memory PC loaded with address of interrupt handling routine Next instruction (first of interrupt handler) can be fetched

  26. Data Flow (Interrupt Diagram) Simple Predictable Current PC saved to allow resumption after interrupt Contents of PC copied to MBR Special memory location (e.g. stack pointer) loaded to MAR MBR written to memory PC loaded with address of interrupt handling routine Next instruction (first of interrupt handler) can be fetched

  27. Prefetch Fetch accessing main memory Execution usually does not access main memory Can fetch next instruction during execution of current instruction Called instruction prefetch

  28. Improved Performance But not doubled: Fetch usually shorter than execution Prefetch more than one instruction? Any jump or branch means that prefetched instructions are not the required instructions Add more stages to improve performance

  29. Pipelining Fetch instruction Decode instruction Calculate operands (i.e. EAs) Fetch operands Execute instructions Write result Overlap these operations

  30. Two Stage Instruction Pipeline

  31. Timing Diagram for Instruction Pipeline Operation

  32. The Effect of a Conditional Branch on Instruction Pipeline Operation

  33. Six Stage Instruction Pipeline

  34. Chapter 16 Control Unit Operation No HW problems on this chapter. It is important to understand this material on the architecture of computer control units, and microprogrammed control units.

  35. Basic Elements of Processor ALU Registers Internal data paths External data paths Control Unit

  36. A Simple Computer & its Control Unit

  37. Single Bus Organization of CPU All components of CPU connected to single internal bus Makes interconnection structure simple External bus is connected to CPU via MAR and MBR

  38. Instruction Micro-Operations A computer executes a program of instructions (or instruction cycles) Each instruction cycle has a number to steps or phases: Fetch, Indirect (if specified), Execute, Interrupt (if requested) These can be seen as micro-operations Each step does a modest amount of work Atomic operation of CPU

  39. Constituent Elements of its Program Execution Machine Instruction is executed by executing set of micro operations

  40. Types of Micro-operation Transfer data between registers Transfer data from register to external Transfer data from external to register Perform arithmetic or logical ops

  41. Control Signals Clock One micro-instruction (or set of parallel micro- instructions) per clock cycle Instruction register Op-code for current instruction Determines which micro-instructions are performed Flags State of CPU Results of previous operations From control bus Interrupts Acknowledgements

  42. Control Signals - output Within CPU Cause data movement Activate specific functions Via control bus To memory To I/O modules

  43. Flowchart for Instruction Cycle

  44. Fetch - 4 Control Registers Utilized Program Counter (PC) Holds address of next instruction to be fetched Memory Address Register (MAR) Connected to address bus Specifies address for read or write op Memory Buffer Register (MBR) Connected to data bus Holds data to write or last data read Instruction Register (IR) Holds last instruction fetched

  45. Fetch Cycle Address of next instruction is in PC Address (MAR) is placed on address bus t1: MAR (PC) Control unit issues READ command Result (data from memory) appears on data bus Data from data bus copied into MBR t2: MBR (memory) PC incremented by 1 (in parallel with data fetch from memory) PC (PC) +1 Data (instruction) moved from MBR to IR t3: IR (MBR) MBR is now free for further data fetches

  46. Fetch Cycle Fetch Cycle: t1: MAR (PC) t2: MBR (memory) PC (PC) +1 t3: IR (MBR)

  47. Fetch Cycle Let Tx be the time unit of the clock. Then: t1: MAR (PC) t2: MBR (memory) PC (PC) +1 t3: IR (MBR) Is this equally correct? Why? t1: MAR (PC) t2: MBR (memory) t3: PC (PC) +1 IR (MBR)

  48. Basic Rules for Clock Cycle Grouping Proper sequence must be followed MAR (PC) must precede MBR (memory) Conflicts must be avoided Must not read & write same register at same time MBR (memory) & IR (MBR) must not be in same cycle Also: PC (PC) +1 involves addition Use ALU ? May need additional micro-operations

  49. Indirect Cycle Indirect Cycle: t1: MAR (IRaddress) t2: MBR (memory) t3: IRaddress (MBRaddress) IR is now in same state as if direct addressing had been used (What does this say about IR size?)

  50. Interrupt Cycle Interrupt Cycle: t1: MBR t2: MAR PC t3: memory (MBR) This is a minimum. May be additional micro-ops to get addresses (PC) save-address routine-address N.B. saving context is done by interrupt handler routine, not micro- ops

Related