SlideShare une entreprise Scribd logo
1  sur  37
Er. Nawaraj Bhandari
Topic 8
CPU Structure and
Function
Computer
Architecture
PROCESSOR ORGANIZATION
 To understand the organization of the processor, let us consider the
requirements placed on the processor, the things that it must do:
 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.
PROCESSOR ORGANIZATION
 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.
 To do these things, it should be clear that the processor needs to
store some data temporarily. It must remember the location of the
last instruction so that it can know where to get the next instruction.
 It needs to store instructions and data temporarily while an
instruction is being executed. In other words, the processor needs a
small internal memory.
PROCESSOR ORGANIZATION
PROCESSOR ORGANIZATION
• Above figure is a simplified view of a processor, indicating its connection to
the rest of the system via the system bus
• The ALU does the actual computation or processing of data.
• The control unit controls the movement of data and instructions into and
out of the processor and controls the operation of the ALU.
• In addition, the figure shows a minimal internal memory, consisting of a set
of storage locations, called registers.
PROCESSOR ORGANIZATION
PROCESSOR ORGANIZATION
• Above Figure is a slightly more detailed view of the processor. The data
transfer and logic control paths are indicated, including an element labeled
internal processor bus.
• This element is needed to transfer data between the various registers and
the ALU because the ALU in fact operates only on data in the internal
processor memory. The figure also shows typical basic elements of the
ALU.
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: Enable the machine- or assembly language
programmer to minimize main memory references by optimizing use of
registers.
• Control and status registers: Used by the control unit to control the
operation
of the processor and by privileged, operating system programs to control
the
execution of programs.
User-Visible Registers
A user-visible register is one that may be referenced by means of the
machine language that the processor executes. We can characterize these
in the following categories:
• General purpose
• Data
• Address
• Condition codes
User-Visible Registers
• Any general-purpose register can contain the operand for any opcode.
• This provides true general-purpose register use. Often, however, there
are restrictions.
• For example, there may be dedicated registers for floating-point and
stack operations.
• In some cases, general-purpose registers can be used for addressing
functions (e.g., register indirect, displacement).
Data Registers
• Data registers may be used only to hold data and cannot be employed in
the calculation of an operand address.
Address registers
• Address registers may themselves be somewhat general purpose, or they
may be devoted to a particular addressing mode. Examples include the
following:
• Segment pointers: In a machine with segmented addressing a segment
register holds the address of the base of the segment.
There may be multiple registers: for example, one for the operating
system and one for the current process.
Address registers
• Index registers: These are used for indexed addressing and may
be auto indexed.
• Stack pointer: If there is user-visible stack addressing, then typically there
is a dedicated register that points to the top of the stack.
This allows implicit addressing; that is, push, pop, and other stack
instructions need not contain an explicit stack operand.
Control and Status Registers
• There are a variety of processor registers that are employed to control the
operation of the processor. Most of these, on most machines, are not
visible to the user. Some of them may be visible to machine instructions
executed in a control or operating system mode.
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.
Control and Status Registers
• Many processor designs include a register or set of registers, often known
as the program status word (PSW), that contain status information. The
PSW typically contains condition codes plus other status information.
Common fields or flags include the following:
• Sign: Contains the sign bit of the result of the last arithmetic operation.
• Zero: Set when the result is 0.
• Carry: Set if an operation resulted in a carry (addition) into or borrow
(subtraction) out of a high-order bit. Used for multiword arithmetic
operations.
• Equal: Set if a logical compare result is equality.
Control and Status Registers
• Overflow: Used to indicate arithmetic overflow.
• Interrupt Enable/Disable: Used to enable or disable interrupts.
• Supervisor: Indicates whether the processor is executing in supervisor or
user mode. Certain privileged instructions can be executed only in
supervisor mode, and certain areas of memory can be accessed only in
supervisor mode
INSTRUCTION CYCLE
Instruction cycle includes the following stages:
1. Fetch: Read the next instruction from memory into the processor.
2. Execute: Interpret the opcode and perform the indicated operation.
3. Interrupt: If interrupts are enabled and an interrupt has occurred, save
the current process state and service the interrupt.
INSTRUCTION CYCLE
Fetch Cycle Dataflow
1. During the fetch cycle, an instruction is read from
memory.
2. The PC contains the address of the next instruction to be
fetched.
3. This address is moved to the MAR and placed on the
address bus.
4. The control unit requests a memory read, and the result
is placed on the data bus and copied into the MBR and
then moved to the IR.
5. Meanwhile, the PC is incremented by 1, preparatory for the
next fetch.
Fetch Cycle Dataflow
Indirect cycle
1. Once the fetch cycle is over, the control unit examines the
contents of the IR to determine if it contains an operand
specified using indirect addressing.
2. If so, an indirect cycle is performed.
3. The right-most N bits of the MBR, which contain the
address reference, are transferred to the MAR.
4. Then the control unit requests a memory read, to get the
desired address of the operand into the MBR.
Indirect cycle
Execute Cycle
1. The execute cycle takes many forms; the form depends on which of
the various machine instructions is in the IR.
2. This cycle may involve transferring data among registers, read or
write from memory or I/O, and/or the invocation of the ALU.
Interrupt Cycle
1. Like the fetch and indirect cycles, the interrupt cycle is simple and
predictable.
2. The current contents of the PC must be saved so that the processor
can resume normal activity after the interrupt.
3. Thus, the contents of the PC are transferred to the MBR to be
written into memory. The special memory location reserved for this
purpose is loaded into the MAR from the control unit.
4. It might, for example, be a stack pointer. The PC is loaded with the
address of the interrupt routine.
5. As a result, the next instruction cycle will begin by fetching the
appropriate instruction.
Interrupt Cycle
What is Pipelining
 A technique used in advanced microprocessors where the microprocessor
begins executing a second instruction before the first has been completed.
- A Pipeline is a series of stages, where some work is done at each stage. The
work is not finished until it has passed through all stages.
 With pipelining, the computer architecture allows the next instructions to be
fetched while the processor is performing arithmetic operations, holding them
in a buffer close to the processor until each instruction operation can
performed.
How Pipelines Works
 The pipeline is divided into segments and each segment can execute it
operation concurrently with the other segments.
 Once a segment completes an operations, it passes the result to the next
segment in the pipeline and fetches the next operations from the preceding
segment.
Example
Instruction 1 Instruction 2
Instruction 3Instruction 4
X X
XX
Four sample instructions, executed linearly
Four Pipelined Instructions
IF
IF
IF
IF
ID
ID
ID
ID
EX
EX
EX
EX M
M
M
M
W
W
W
W
5
1
1
1
Instructions Fetch
 The instruction Fetch (IF) stage is responsible for obtaining the requested
instruction from memory.
 The instruction and the program counter (which is incremented to the next
instruction) are stored in the IF/ID pipeline register as temporary storage so
that may be used in the next stage at the start of the next clock cycle.
Instruction Decode
 The Instruction Decode (ID) stage is responsible for decoding the instruction
and sending out the various control lines to the other parts of the processor.
The instruction is sent to the control unit where it is decoded and the
registers are fetched from the register file.
Execution
 The Execution (EX) stage is where any calculations are performed. The main
component in this stage is the ALU. The ALU is made up of arithmetic, logic
and capabilities.
Memory and IO
 The Memory and IO (MEM) stage is responsible for storing and loading values
to and from memory. It also responsible for input or output from the
processor. If the current instruction is not of Memory or IO type than the
result from the ALU is passed through to the write back stage.
Write Back
 The Write Back (WB) stage is responsible for writing the result of a
calculation, memory access or input into the register file.
Operation Timings
 Estimated timings for each of the stages:
Instruction
Fetch
2ns
Instruction
Decode
1ns
Execution 2ns
Memory and
IO
2ns
Write Back 1ns
Advantages/Disadvantages
Advantages:
 More efficient use of processor
 Quicker time of execution of large number of
instructions
Disadvantages:
 Pipelining involves adding hardware to the chip
 Inability to continuously run the pipeline
at full speed because of pipeline hazards
which disrupt the smooth execution of the
pipeline.
ANY QUESTIONS?

Contenu connexe

Tendances

Memory & the fetch decode-execute cycle
Memory & the fetch decode-execute cycleMemory & the fetch decode-execute cycle
Memory & the fetch decode-execute cycle
chantellemallia
 

Tendances (20)

Cache memory
Cache memoryCache memory
Cache memory
 
Centralized shared memory architectures
Centralized shared memory architecturesCentralized shared memory architectures
Centralized shared memory architectures
 
Basic computer organization and design
Basic computer organization and designBasic computer organization and design
Basic computer organization and design
 
Bus aribration
Bus aribrationBus aribration
Bus aribration
 
Assembly 8086
Assembly 8086Assembly 8086
Assembly 8086
 
Memory management ppt coa
Memory management ppt coaMemory management ppt coa
Memory management ppt coa
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
 
Multiprocessor
MultiprocessorMultiprocessor
Multiprocessor
 
3.programmable interrupt controller 8259
3.programmable interrupt controller 82593.programmable interrupt controller 8259
3.programmable interrupt controller 8259
 
Computer architecture cache memory
Computer architecture cache memoryComputer architecture cache memory
Computer architecture cache memory
 
Interfacing of io device to 8085
Interfacing of io device to 8085Interfacing of io device to 8085
Interfacing of io device to 8085
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
 
Input Output - Computer Architecture
Input Output - Computer ArchitectureInput Output - Computer Architecture
Input Output - Computer Architecture
 
DMA and DMA controller
DMA and DMA controllerDMA and DMA controller
DMA and DMA controller
 
Pic microcontroller architecture
Pic microcontroller architecturePic microcontroller architecture
Pic microcontroller architecture
 
Memory & the fetch decode-execute cycle
Memory & the fetch decode-execute cycleMemory & the fetch decode-execute cycle
Memory & the fetch decode-execute cycle
 
Direct memory access
Direct memory accessDirect memory access
Direct memory access
 
Memory management
Memory managementMemory management
Memory management
 
Computer Organization
Computer OrganizationComputer Organization
Computer Organization
 
Computer registers
Computer registersComputer registers
Computer registers
 

Similaire à Chapter 8

1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
aniyathikitchen
 
the-cpu-design-central-processing-unit-design-1
the-cpu-design-central-processing-unit-design-1the-cpu-design-central-processing-unit-design-1
the-cpu-design-central-processing-unit-design-1
Basel Mansour
 

Similaire à Chapter 8 (20)

Processor organization & register organization
Processor organization & register organizationProcessor organization & register organization
Processor organization & register organization
 
Bca examination 2015 csa
Bca examination 2015 csaBca examination 2015 csa
Bca examination 2015 csa
 
Ch 01 os8e
Ch 01  os8eCh 01  os8e
Ch 01 os8e
 
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
1.CPU INSTRUCTION AND EXECUTION CYCLEThe primary function of the .pdf
 
Co notes3 sem
Co notes3 semCo notes3 sem
Co notes3 sem
 
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
 
Bc0040
Bc0040Bc0040
Bc0040
 
the-cpu-design-central-processing-unit-design-1
the-cpu-design-central-processing-unit-design-1the-cpu-design-central-processing-unit-design-1
the-cpu-design-central-processing-unit-design-1
 
Operating system
Operating systemOperating system
Operating system
 
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
 
Chapter01 (1).ppt
Chapter01 (1).pptChapter01 (1).ppt
Chapter01 (1).ppt
 
CSA PPT UNIT 1.pptx
CSA PPT UNIT 1.pptxCSA PPT UNIT 1.pptx
CSA PPT UNIT 1.pptx
 
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
 
Computer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organizationComputer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organization
 
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS1:002
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS1:002HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS1:002
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS1:002
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
Presentation1
Presentation1Presentation1
Presentation1
 
Bindura university of science education
Bindura university of science educationBindura university of science education
Bindura university of science education
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
 
Microprocessor
MicroprocessorMicroprocessor
Microprocessor
 

Plus de Er. Nawaraj Bhandari

Plus de Er. Nawaraj Bhandari (20)

Data mining approaches and methods
Data mining approaches and methodsData mining approaches and methods
Data mining approaches and methods
 
Research trends in data warehousing and data mining
Research trends in data warehousing and data miningResearch trends in data warehousing and data mining
Research trends in data warehousing and data mining
 
Mining Association Rules in Large Database
Mining Association Rules in Large DatabaseMining Association Rules in Large Database
Mining Association Rules in Large Database
 
Introduction to data mining and data warehousing
Introduction to data mining and data warehousingIntroduction to data mining and data warehousing
Introduction to data mining and data warehousing
 
Data warehouse testing
Data warehouse testingData warehouse testing
Data warehouse testing
 
Data warehouse physical design
Data warehouse physical designData warehouse physical design
Data warehouse physical design
 
Data warehouse logical design
Data warehouse logical designData warehouse logical design
Data warehouse logical design
 
Classification and prediction in data mining
Classification and prediction in data miningClassification and prediction in data mining
Classification and prediction in data mining
 
Chapter 3: Simplification of Boolean Function
Chapter 3: Simplification of Boolean FunctionChapter 3: Simplification of Boolean Function
Chapter 3: Simplification of Boolean Function
 
Chapter 6: Sequential Logic
Chapter 6: Sequential LogicChapter 6: Sequential Logic
Chapter 6: Sequential Logic
 
Chapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSIChapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSI
 
Chapter 4: Combinational Logic
Chapter 4: Combinational LogicChapter 4: Combinational Logic
Chapter 4: Combinational Logic
 
Chapter 2: Boolean Algebra and Logic Gates
Chapter 2: Boolean Algebra and Logic GatesChapter 2: Boolean Algebra and Logic Gates
Chapter 2: Boolean Algebra and Logic Gates
 
Chapter 1: Binary System
 Chapter 1: Binary System Chapter 1: Binary System
Chapter 1: Binary System
 
Introduction to Electronic Commerce
Introduction to Electronic CommerceIntroduction to Electronic Commerce
Introduction to Electronic Commerce
 
Evaluating software development
Evaluating software developmentEvaluating software development
Evaluating software development
 
Using macros in microsoft excel part 2
Using macros in microsoft excel   part 2Using macros in microsoft excel   part 2
Using macros in microsoft excel part 2
 
Using macros in microsoft excel part 1
Using macros in microsoft excel   part 1Using macros in microsoft excel   part 1
Using macros in microsoft excel part 1
 
Using macros in microsoft access
Using macros in microsoft accessUsing macros in microsoft access
Using macros in microsoft access
 
Testing software development
Testing software developmentTesting software development
Testing software development
 

Dernier

Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 

Dernier (20)

Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 

Chapter 8

  • 1. Er. Nawaraj Bhandari Topic 8 CPU Structure and Function Computer Architecture
  • 2. PROCESSOR ORGANIZATION  To understand the organization of the processor, let us consider the requirements placed on the processor, the things that it must do:  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.
  • 3. PROCESSOR ORGANIZATION  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.  To do these things, it should be clear that the processor needs to store some data temporarily. It must remember the location of the last instruction so that it can know where to get the next instruction.  It needs to store instructions and data temporarily while an instruction is being executed. In other words, the processor needs a small internal memory.
  • 5. PROCESSOR ORGANIZATION • Above figure is a simplified view of a processor, indicating its connection to the rest of the system via the system bus • The ALU does the actual computation or processing of data. • The control unit controls the movement of data and instructions into and out of the processor and controls the operation of the ALU. • In addition, the figure shows a minimal internal memory, consisting of a set of storage locations, called registers.
  • 7. PROCESSOR ORGANIZATION • Above Figure is a slightly more detailed view of the processor. The data transfer and logic control paths are indicated, including an element labeled internal processor bus. • This element is needed to transfer data between the various registers and the ALU because the ALU in fact operates only on data in the internal processor memory. The figure also shows typical basic elements of the ALU.
  • 8. 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: Enable the machine- or assembly language programmer to minimize main memory references by optimizing use of registers. • Control and status registers: Used by the control unit to control the operation of the processor and by privileged, operating system programs to control the execution of programs.
  • 9. User-Visible Registers A user-visible register is one that may be referenced by means of the machine language that the processor executes. We can characterize these in the following categories: • General purpose • Data • Address • Condition codes
  • 10. User-Visible Registers • Any general-purpose register can contain the operand for any opcode. • This provides true general-purpose register use. Often, however, there are restrictions. • For example, there may be dedicated registers for floating-point and stack operations. • In some cases, general-purpose registers can be used for addressing functions (e.g., register indirect, displacement).
  • 11. Data Registers • Data registers may be used only to hold data and cannot be employed in the calculation of an operand address.
  • 12. Address registers • Address registers may themselves be somewhat general purpose, or they may be devoted to a particular addressing mode. Examples include the following: • Segment pointers: In a machine with segmented addressing a segment register holds the address of the base of the segment. There may be multiple registers: for example, one for the operating system and one for the current process.
  • 13. Address registers • Index registers: These are used for indexed addressing and may be auto indexed. • Stack pointer: If there is user-visible stack addressing, then typically there is a dedicated register that points to the top of the stack. This allows implicit addressing; that is, push, pop, and other stack instructions need not contain an explicit stack operand.
  • 14. Control and Status Registers • There are a variety of processor registers that are employed to control the operation of the processor. Most of these, on most machines, are not visible to the user. Some of them may be visible to machine instructions executed in a control or operating system mode. 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.
  • 15. Control and Status Registers • Many processor designs include a register or set of registers, often known as the program status word (PSW), that contain status information. The PSW typically contains condition codes plus other status information. Common fields or flags include the following: • Sign: Contains the sign bit of the result of the last arithmetic operation. • Zero: Set when the result is 0. • Carry: Set if an operation resulted in a carry (addition) into or borrow (subtraction) out of a high-order bit. Used for multiword arithmetic operations. • Equal: Set if a logical compare result is equality.
  • 16. Control and Status Registers • Overflow: Used to indicate arithmetic overflow. • Interrupt Enable/Disable: Used to enable or disable interrupts. • Supervisor: Indicates whether the processor is executing in supervisor or user mode. Certain privileged instructions can be executed only in supervisor mode, and certain areas of memory can be accessed only in supervisor mode
  • 17. INSTRUCTION CYCLE Instruction cycle includes the following stages: 1. Fetch: Read the next instruction from memory into the processor. 2. Execute: Interpret the opcode and perform the indicated operation. 3. Interrupt: If interrupts are enabled and an interrupt has occurred, save the current process state and service the interrupt.
  • 19. Fetch Cycle Dataflow 1. During the fetch cycle, an instruction is read from memory. 2. The PC contains the address of the next instruction to be fetched. 3. This address is moved to the MAR and placed on the address bus. 4. The control unit requests a memory read, and the result is placed on the data bus and copied into the MBR and then moved to the IR. 5. Meanwhile, the PC is incremented by 1, preparatory for the next fetch.
  • 21. Indirect cycle 1. Once the fetch cycle is over, the control unit examines the contents of the IR to determine if it contains an operand specified using indirect addressing. 2. If so, an indirect cycle is performed. 3. The right-most N bits of the MBR, which contain the address reference, are transferred to the MAR. 4. Then the control unit requests a memory read, to get the desired address of the operand into the MBR.
  • 23. Execute Cycle 1. The execute cycle takes many forms; the form depends on which of the various machine instructions is in the IR. 2. This cycle may involve transferring data among registers, read or write from memory or I/O, and/or the invocation of the ALU.
  • 24. Interrupt Cycle 1. Like the fetch and indirect cycles, the interrupt cycle is simple and predictable. 2. The current contents of the PC must be saved so that the processor can resume normal activity after the interrupt. 3. Thus, the contents of the PC are transferred to the MBR to be written into memory. The special memory location reserved for this purpose is loaded into the MAR from the control unit. 4. It might, for example, be a stack pointer. The PC is loaded with the address of the interrupt routine. 5. As a result, the next instruction cycle will begin by fetching the appropriate instruction.
  • 26. What is Pipelining  A technique used in advanced microprocessors where the microprocessor begins executing a second instruction before the first has been completed. - A Pipeline is a series of stages, where some work is done at each stage. The work is not finished until it has passed through all stages.  With pipelining, the computer architecture allows the next instructions to be fetched while the processor is performing arithmetic operations, holding them in a buffer close to the processor until each instruction operation can performed.
  • 27. How Pipelines Works  The pipeline is divided into segments and each segment can execute it operation concurrently with the other segments.  Once a segment completes an operations, it passes the result to the next segment in the pipeline and fetches the next operations from the preceding segment.
  • 28. Example Instruction 1 Instruction 2 Instruction 3Instruction 4 X X XX Four sample instructions, executed linearly
  • 30. Instructions Fetch  The instruction Fetch (IF) stage is responsible for obtaining the requested instruction from memory.  The instruction and the program counter (which is incremented to the next instruction) are stored in the IF/ID pipeline register as temporary storage so that may be used in the next stage at the start of the next clock cycle.
  • 31. Instruction Decode  The Instruction Decode (ID) stage is responsible for decoding the instruction and sending out the various control lines to the other parts of the processor. The instruction is sent to the control unit where it is decoded and the registers are fetched from the register file.
  • 32. Execution  The Execution (EX) stage is where any calculations are performed. The main component in this stage is the ALU. The ALU is made up of arithmetic, logic and capabilities.
  • 33. Memory and IO  The Memory and IO (MEM) stage is responsible for storing and loading values to and from memory. It also responsible for input or output from the processor. If the current instruction is not of Memory or IO type than the result from the ALU is passed through to the write back stage.
  • 34. Write Back  The Write Back (WB) stage is responsible for writing the result of a calculation, memory access or input into the register file.
  • 35. Operation Timings  Estimated timings for each of the stages: Instruction Fetch 2ns Instruction Decode 1ns Execution 2ns Memory and IO 2ns Write Back 1ns
  • 36. Advantages/Disadvantages Advantages:  More efficient use of processor  Quicker time of execution of large number of instructions Disadvantages:  Pipelining involves adding hardware to the chip  Inability to continuously run the pipeline at full speed because of pipeline hazards which disrupt the smooth execution of the pipeline.

Notes de l'éditeur

  1. 2
  2. 2
  3. 2
  4. 2
  5. 2
  6. 2
  7. 2
  8. 2
  9. 2
  10. 2
  11. 2
  12. 2
  13. 2
  14. 2
  15. 2
  16. 2
  17. 2
  18. 2
  19. 2
  20. 2
  21. 2
  22. 2
  23. 2
  24. 2