SlideShare uma empresa Scribd logo
1 de 58
William Stallings
Computer Organization
and Architecture
7th
Edition
Chapter 12
CPU Structure and Function
CPU Structure
• CPU must:
—Fetch instructions
—Interpret instructions
—Fetch data
—Process data
—Write data
CPU With Systems Bus
CPU Internal Structure
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
User Visible Registers
• General Purpose
• Data
• Address
• Condition Codes
General Purpose Registers (1)
• May be true general purpose
• May be restricted
• May be used for data or addressing
• Data
—Accumulator
• Addressing
—Segment
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
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
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;
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
Control & Status Registers
• Program Counter
• Instruction Decoding Register
• Memory Address Register
• Memory Buffer Register
• Revision: what do these all do?
Program Status Word
• A set of bits
• Includes Condition Codes
• Sign of last result
• Zero
• Carry
• Equal
• Overflow
• Interrupt enable/disable
• Supervisor
Supervisor Mode
• Intel ring zero
• Kernel mode
• Allows privileged instructions to execute
• Used by operating system
• Not available to user programs
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
Example Register Organizations
Instruction Cycle
• Revision
• Stallings Chapter 3
Indirect Cycle
• May require memory access to fetch operands
• Indirect addressing requires more memory
accesses
• Can be thought of as additional instruction
subcycle
Instruction Cycle with Indirect
Instruction Cycle State Diagram
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
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
Data Flow (Fetch Diagram)
Data Flow (Indirect Diagram)
Data Flow (Execute)
• May take many forms
• Depends on instruction being executed
• May include
—Memory read/write
—Input/Output
—Register transfers
—ALU operations
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
Data Flow (Interrupt Diagram)
Prefetch
• Fetch accessing main memory
• Execution usually does not access main
memory
• Can fetch next instruction during execution of
current instruction
• Called instruction prefetch
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
Pipelining
• Fetch instruction
• Decode instruction
• Calculate operands (i.e. EAs)
• Fetch operands
• Execute instructions
• Write result
• Overlap these operations
Two Stage Instruction Pipeline
Timing Diagram for
Instruction Pipeline Operation
The Effect of a Conditional Branch on
Instruction Pipeline Operation
Six Stage
Instruction Pipeline
Alternative Pipeline Depiction
Speedup Factors
with Instruction
Pipelining
Dealing with Branches
• Multiple Streams
• Prefetch Branch Target
• Loop buffer
• Branch prediction
• Delayed branching
Multiple Streams
• Have two pipelines
• Prefetch each branch into a separate pipeline
• Use appropriate pipeline
• Leads to bus & register contention
• Multiple branches lead to further pipelines being
needed
Prefetch Branch Target
• Target of branch is prefetched in addition to
instructions following branch
• Keep target until branch is executed
• Used by IBM 360/91
Loop Buffer
• Very fast memory
• Maintained by fetch stage of pipeline
• Check buffer before fetching from memory
• Very good for small loops or jumps
• c.f. cache
• Used by CRAY-1
Loop Buffer Diagram
Branch Prediction (1)
• Predict never taken
—Assume that jump will not happen
—Always fetch next instruction
—68020 & VAX 11/780
—VAX will not prefetch after branch if a page fault
would result (O/S v CPU design)
• Predict always taken
—Assume that jump will happen
—Always fetch target instruction
Branch Prediction (2)
• Predict by Opcode
—Some instructions are more likely to result in a jump
than thers
—Can get up to 75% success
• Taken/Not taken switch
—Based on previous history
—Good for loops
Branch Prediction (3)
• Delayed Branch
—Do not take jump until you have to
—Rearrange instructions
Branch Prediction Flowchart
Branch Prediction State Diagram
Dealing With
Branches
Intel 80486 Pipelining
• Fetch
— From cache or external memory
— Put in one of two 16-byte prefetch buffers
— Fill buffer with new data as soon as old data consumed
— Average 5 instructions fetched per load
— Independent of other stages to keep buffers full
• Decode stage 1
— Opcode & address-mode info
— At most first 3 bytes of instruction
— Can direct D2 stage to get rest of instruction
• Decode stage 2
— Expand opcode into control signals
— Computation of complex address modes
• Execute
— ALU operations, cache access, register update
• Writeback
— Update registers & flags
— Results sent to cache & bus interface write buffers
80486 Instruction Pipeline Examples
Pentium 4 Registers
EFLAGS Register
Control Registers
MMX Register Mapping
• MMX uses several 64 bit data types
• Use 3 bit register address fields
—8 registers
• No MMX specific registers
—Aliasing to lower 64 bits of existing floating point
registers
Mapping of MMX Registers to
Floating-Point Registers
Pentium Interrupt Processing
• Interrupts
—Maskable
—Nonmaskable
• Exceptions
—Processor detected
—Programmed
• Interrupt vector table
—Each interrupt type assigned a number
—Index to vector table
—256 * 32 bit interrupt vectors
• 5 priority classes
PowerPC User Visible Registers
PowerPC Register Formats
Foreground Reading
• Processor examples
• Stallings Chapter 12
• Manufacturer web sites & specs

Mais conteúdo relacionado

Mais procurados

Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentationRanjeet Kumar
 
Memory organization
Memory organizationMemory organization
Memory organizationAL- AMIN
 
Computer architecture memory system
Computer architecture memory systemComputer architecture memory system
Computer architecture memory systemMazin Alwaaly
 
Moving to PCI Express based SSD with NVM Express
Moving to PCI Express based SSD with NVM ExpressMoving to PCI Express based SSD with NVM Express
Moving to PCI Express based SSD with NVM ExpressOdinot Stanislas
 
04 cache memory.ppt 1
04 cache memory.ppt 104 cache memory.ppt 1
04 cache memory.ppt 1Anwal Mirza
 
Architecture of 80286 microprocessor
Architecture of 80286 microprocessorArchitecture of 80286 microprocessor
Architecture of 80286 microprocessorSyed Ahmed Zaki
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OSC.U
 
02 Computer Evolution And Performance
02  Computer  Evolution And  Performance02  Computer  Evolution And  Performance
02 Computer Evolution And PerformanceJeanie Delos Arcos
 
Arm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_armArm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_armPrashant Ahire
 
Raid (Redundant Array of Inexpensive Disks) in Computer Architecture
Raid (Redundant Array of Inexpensive Disks) in Computer ArchitectureRaid (Redundant Array of Inexpensive Disks) in Computer Architecture
Raid (Redundant Array of Inexpensive Disks) in Computer ArchitectureAiman Hafeez
 
x86 architecture
x86 architecturex86 architecture
x86 architecturei i
 
80286 microprocessor
80286 microprocessor80286 microprocessor
80286 microprocessorAvin Mathew
 
SCSI(small computer system interface)
SCSI(small computer system interface)SCSI(small computer system interface)
SCSI(small computer system interface)Niraj Lamichhane
 
Multi core-architecture
Multi core-architectureMulti core-architecture
Multi core-architecturePiyush Mittal
 
top level view of computer function and interconnection
top level view of computer function and interconnectiontop level view of computer function and interconnection
top level view of computer function and interconnectionSajid Marwat
 

Mais procurados (20)

Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
 
Memory organization
Memory organizationMemory organization
Memory organization
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Computer architecture memory system
Computer architecture memory systemComputer architecture memory system
Computer architecture memory system
 
Moving to PCI Express based SSD with NVM Express
Moving to PCI Express based SSD with NVM ExpressMoving to PCI Express based SSD with NVM Express
Moving to PCI Express based SSD with NVM Express
 
04 cache memory.ppt 1
04 cache memory.ppt 104 cache memory.ppt 1
04 cache memory.ppt 1
 
Architecture of 80286 microprocessor
Architecture of 80286 microprocessorArchitecture of 80286 microprocessor
Architecture of 80286 microprocessor
 
Memory management
Memory managementMemory management
Memory management
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OS
 
Intel IA 64
Intel IA 64Intel IA 64
Intel IA 64
 
02 Computer Evolution And Performance
02  Computer  Evolution And  Performance02  Computer  Evolution And  Performance
02 Computer Evolution And Performance
 
Arm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_armArm cortex-m3 by-joe_bungo_arm
Arm cortex-m3 by-joe_bungo_arm
 
Raid (Redundant Array of Inexpensive Disks) in Computer Architecture
Raid (Redundant Array of Inexpensive Disks) in Computer ArchitectureRaid (Redundant Array of Inexpensive Disks) in Computer Architecture
Raid (Redundant Array of Inexpensive Disks) in Computer Architecture
 
x86 architecture
x86 architecturex86 architecture
x86 architecture
 
80286 microprocessor
80286 microprocessor80286 microprocessor
80286 microprocessor
 
SCSI(small computer system interface)
SCSI(small computer system interface)SCSI(small computer system interface)
SCSI(small computer system interface)
 
VIRTUAL MEMORY
VIRTUAL MEMORYVIRTUAL MEMORY
VIRTUAL MEMORY
 
Multi core-architecture
Multi core-architectureMulti core-architecture
Multi core-architecture
 
top level view of computer function and interconnection
top level view of computer function and interconnectiontop level view of computer function and interconnection
top level view of computer function and interconnection
 
Superscalar Processor
Superscalar ProcessorSuperscalar Processor
Superscalar Processor
 

Semelhante a 12 processor structure and function

IT209 Cpu Structure Report
IT209 Cpu Structure ReportIT209 Cpu Structure Report
IT209 Cpu Structure ReportBis Aquino
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and functionSher Shah Merkhel
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and functionAnwal Mirza
 
pipeline and pipeline hazards
pipeline and pipeline hazards pipeline and pipeline hazards
pipeline and pipeline hazards Bharti Khemani
 
Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with PipeliningAneesh Raveendran
 
Computer Organization: Introduction to Microprocessor and Microcontroller
Computer Organization: Introduction to Microprocessor and MicrocontrollerComputer Organization: Introduction to Microprocessor and Microcontroller
Computer Organization: Introduction to Microprocessor and MicrocontrollerAmrutaMehata
 
03_top-level-view-of-computer-function-and-interconnection.ppt
03_top-level-view-of-computer-function-and-interconnection.ppt03_top-level-view-of-computer-function-and-interconnection.ppt
03_top-level-view-of-computer-function-and-interconnection.pptAmirZaman21
 
Motivation for multithreaded architectures
Motivation for multithreaded architecturesMotivation for multithreaded architectures
Motivation for multithreaded architecturesYoung Alista
 
Pipelining
PipeliningPipelining
PipeliningAJAL A J
 
03 top level view of computer function and interconnection
03 top level view of computer function and interconnection03 top level view of computer function and interconnection
03 top level view of computer function and interconnectionSher Shah Merkhel
 
Computer_Organization and architecture _unit 1.pptx
Computer_Organization and architecture _unit 1.pptxComputer_Organization and architecture _unit 1.pptx
Computer_Organization and architecture _unit 1.pptxManimegalaM3
 
03 top level view of computer function and interconnection.ppt.enc
03 top level view of computer function and interconnection.ppt.enc03 top level view of computer function and interconnection.ppt.enc
03 top level view of computer function and interconnection.ppt.encAnwal Mirza
 

Semelhante a 12 processor structure and function (20)

IT209 Cpu Structure Report
IT209 Cpu Structure ReportIT209 Cpu Structure Report
IT209 Cpu Structure Report
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and function
 
12 processor structure and function
12 processor structure and function12 processor structure and function
12 processor structure and function
 
cs-procstruc.ppt
cs-procstruc.pptcs-procstruc.ppt
cs-procstruc.ppt
 
pipeline and pipeline hazards
pipeline and pipeline hazards pipeline and pipeline hazards
pipeline and pipeline hazards
 
03_Buses (1).ppt
03_Buses (1).ppt03_Buses (1).ppt
03_Buses (1).ppt
 
Cs intro-ca
Cs intro-caCs intro-ca
Cs intro-ca
 
Performance Enhancement with Pipelining
Performance Enhancement with PipeliningPerformance Enhancement with Pipelining
Performance Enhancement with Pipelining
 
RISC.ppt
RISC.pptRISC.ppt
RISC.ppt
 
13 risc
13 risc13 risc
13 risc
 
Computer Organization: Introduction to Microprocessor and Microcontroller
Computer Organization: Introduction to Microprocessor and MicrocontrollerComputer Organization: Introduction to Microprocessor and Microcontroller
Computer Organization: Introduction to Microprocessor and Microcontroller
 
03_top-level-view-of-computer-function-and-interconnection.ppt
03_top-level-view-of-computer-function-and-interconnection.ppt03_top-level-view-of-computer-function-and-interconnection.ppt
03_top-level-view-of-computer-function-and-interconnection.ppt
 
Motivation for multithreaded architectures
Motivation for multithreaded architecturesMotivation for multithreaded architectures
Motivation for multithreaded architectures
 
Pipelining
PipeliningPipelining
Pipelining
 
03 top level view of computer function and interconnection
03 top level view of computer function and interconnection03 top level view of computer function and interconnection
03 top level view of computer function and interconnection
 
Ch8 main memory
Ch8   main memoryCh8   main memory
Ch8 main memory
 
13 risc
13 risc13 risc
13 risc
 
14 superscalar
14 superscalar14 superscalar
14 superscalar
 
Computer_Organization and architecture _unit 1.pptx
Computer_Organization and architecture _unit 1.pptxComputer_Organization and architecture _unit 1.pptx
Computer_Organization and architecture _unit 1.pptx
 
03 top level view of computer function and interconnection.ppt.enc
03 top level view of computer function and interconnection.ppt.enc03 top level view of computer function and interconnection.ppt.enc
03 top level view of computer function and interconnection.ppt.enc
 

Mais de dilip kumar

18 parallel processing
18 parallel processing18 parallel processing
18 parallel processingdilip kumar
 
17 micro programmed control
17 micro programmed control17 micro programmed control
17 micro programmed controldilip kumar
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes dilip kumar
 
10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristicsdilip kumar
 
08 operating system support
08 operating system support08 operating system support
08 operating system supportdilip kumar
 
06 external memory
06 external memory06 external memory
06 external memorydilip kumar
 
05 internal memory
05 internal memory05 internal memory
05 internal memorydilip kumar
 
02 computer evolution and performance
02 computer evolution and performance02 computer evolution and performance
02 computer evolution and performancedilip kumar
 

Mais de dilip kumar (17)

FLAT Notes
FLAT NotesFLAT Notes
FLAT Notes
 
18 parallel processing
18 parallel processing18 parallel processing
18 parallel processing
 
17 micro programmed control
17 micro programmed control17 micro programmed control
17 micro programmed control
 
16 control unit
16 control unit16 control unit
16 control unit
 
15 ia64
15 ia6415 ia64
15 ia64
 
14 superscalar
14 superscalar14 superscalar
14 superscalar
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes
 
10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristics
 
09 arithmetic
09 arithmetic09 arithmetic
09 arithmetic
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
07 input output
07 input output07 input output
07 input output
 
06 external memory
06 external memory06 external memory
06 external memory
 
05 internal memory
05 internal memory05 internal memory
05 internal memory
 
04 cache memory
04 cache memory04 cache memory
04 cache memory
 
03 buses
03 buses03 buses
03 buses
 
02 computer evolution and performance
02 computer evolution and performance02 computer evolution and performance
02 computer evolution and performance
 
01 introduction
01 introduction01 introduction
01 introduction
 

Último

70 POWER PLANT IAE V2500 technical training
70 POWER PLANT IAE V2500 technical training70 POWER PLANT IAE V2500 technical training
70 POWER PLANT IAE V2500 technical trainingGladiatorsKasper
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Theory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdfTheory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdfShreyas Pandit
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptJohnWilliam111370
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organizationchnrketan
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfBalamuruganV28
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork
 
Secure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech LabsSecure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech Labsamber724300
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodManicka Mamallan Andavar
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书rnrncn29
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxRomil Mishra
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 

Último (20)

70 POWER PLANT IAE V2500 technical training
70 POWER PLANT IAE V2500 technical training70 POWER PLANT IAE V2500 technical training
70 POWER PLANT IAE V2500 technical training
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Theory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdfTheory of Machine Notes / Lecture Material .pdf
Theory of Machine Notes / Lecture Material .pdf
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
 
priority interrupt computer organization
priority interrupt computer organizationpriority interrupt computer organization
priority interrupt computer organization
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdf
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
 
Secure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech LabsSecure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech Labs
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument method
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 

12 processor structure and function

  • 1. William Stallings Computer Organization and Architecture 7th Edition Chapter 12 CPU Structure and Function
  • 2. CPU Structure • CPU must: —Fetch instructions —Interpret instructions —Fetch data —Process data —Write data
  • 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. Control & Status Registers • Program Counter • Instruction Decoding Register • Memory Address Register • Memory Buffer Register • Revision: what do these all do?
  • 13. Program Status Word • A set of bits • Includes Condition Codes • Sign of last result • Zero • Carry • Equal • Overflow • Interrupt enable/disable • Supervisor
  • 14. Supervisor Mode • Intel ring zero • Kernel mode • Allows privileged instructions to execute • Used by operating system • Not available to user programs
  • 15. 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
  • 17. Instruction Cycle • Revision • Stallings Chapter 3
  • 18. Indirect Cycle • May require memory access to fetch operands • Indirect addressing requires more memory accesses • Can be thought of as additional instruction subcycle
  • 21. 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
  • 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 (Fetch Diagram)
  • 25. Data Flow (Execute) • May take many forms • Depends on instruction being executed • May include —Memory read/write —Input/Output —Register transfers —ALU operations
  • 26. 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
  • 28. Prefetch • Fetch accessing main memory • Execution usually does not access main memory • Can fetch next instruction during execution of current instruction • Called instruction prefetch
  • 29. 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
  • 30. Pipelining • Fetch instruction • Decode instruction • Calculate operands (i.e. EAs) • Fetch operands • Execute instructions • Write result • Overlap these operations
  • 32. Timing Diagram for Instruction Pipeline Operation
  • 33. The Effect of a Conditional Branch on Instruction Pipeline Operation
  • 37. Dealing with Branches • Multiple Streams • Prefetch Branch Target • Loop buffer • Branch prediction • Delayed branching
  • 38. Multiple Streams • Have two pipelines • Prefetch each branch into a separate pipeline • Use appropriate pipeline • Leads to bus & register contention • Multiple branches lead to further pipelines being needed
  • 39. Prefetch Branch Target • Target of branch is prefetched in addition to instructions following branch • Keep target until branch is executed • Used by IBM 360/91
  • 40. Loop Buffer • Very fast memory • Maintained by fetch stage of pipeline • Check buffer before fetching from memory • Very good for small loops or jumps • c.f. cache • Used by CRAY-1
  • 42. Branch Prediction (1) • Predict never taken —Assume that jump will not happen —Always fetch next instruction —68020 & VAX 11/780 —VAX will not prefetch after branch if a page fault would result (O/S v CPU design) • Predict always taken —Assume that jump will happen —Always fetch target instruction
  • 43. Branch Prediction (2) • Predict by Opcode —Some instructions are more likely to result in a jump than thers —Can get up to 75% success • Taken/Not taken switch —Based on previous history —Good for loops
  • 44. Branch Prediction (3) • Delayed Branch —Do not take jump until you have to —Rearrange instructions
  • 48. Intel 80486 Pipelining • Fetch — From cache or external memory — Put in one of two 16-byte prefetch buffers — Fill buffer with new data as soon as old data consumed — Average 5 instructions fetched per load — Independent of other stages to keep buffers full • Decode stage 1 — Opcode & address-mode info — At most first 3 bytes of instruction — Can direct D2 stage to get rest of instruction • Decode stage 2 — Expand opcode into control signals — Computation of complex address modes • Execute — ALU operations, cache access, register update • Writeback — Update registers & flags — Results sent to cache & bus interface write buffers
  • 53. MMX Register Mapping • MMX uses several 64 bit data types • Use 3 bit register address fields —8 registers • No MMX specific registers —Aliasing to lower 64 bits of existing floating point registers
  • 54. Mapping of MMX Registers to Floating-Point Registers
  • 55. Pentium Interrupt Processing • Interrupts —Maskable —Nonmaskable • Exceptions —Processor detected —Programmed • Interrupt vector table —Each interrupt type assigned a number —Index to vector table —256 * 32 bit interrupt vectors • 5 priority classes
  • 56. PowerPC User Visible Registers
  • 58. Foreground Reading • Processor examples • Stallings Chapter 12 • Manufacturer web sites & specs