Upload
api-3801329
View
4.505
Download
0
Embed Size (px)
Citation preview
Computer Organization Computer Organization and Architectureand Architecture
Lecture 2Lecture 2
Structure of modern computer Structure of modern computer --Top LevelTop Level
Computer
Main Memory
InputOutput
SystemsInterconnection
Peripherals
Communicationlines
CentralProcessing Unit
Computer
Structure of modern computer Structure of modern computer --Top LevelTop Level
Computer Arithmeticand Login Unit
ControlUnit
Internal CPUInterconnection
Registers
CPU
I/O
Memory
SystemBus
CPU
What is a program?What is a program?
A sequence of stepsA sequence of stepsFor each step, an arithmetic or For each step, an arithmetic or logical operation is donelogical operation is doneFor each operation, a different set of For each operation, a different set of control signals is neededcontrol signals is needed
Computer Components:Computer Components:Top Level ViewTop Level View
Instruction CycleInstruction Cycle
Two steps:Two steps:•• FetchFetch•• ExecuteExecute
Fetch CycleFetch CycleProgram Counter (PC) holds address of Program Counter (PC) holds address of next instruction to fetchnext instruction to fetchProcessor fetches instruction from Processor fetches instruction from memory location pointed to by PCmemory location pointed to by PCIncrement PCIncrement PC•• Unless told otherwiseUnless told otherwise
Instruction loaded into Instruction Instruction loaded into Instruction Register (IR)Register (IR)Processor interprets instruction and Processor interprets instruction and performs required actionsperforms required actions
Execute CycleExecute CycleProcessorProcessor--memorymemory•• data transfer between CPU and main memorydata transfer between CPU and main memory
Processor I/OProcessor I/O•• Data transfer between CPU and I/O moduleData transfer between CPU and I/O module
Data processingData processing•• Some arithmetic or logical operation on dataSome arithmetic or logical operation on data
ControlControl•• Alteration of sequence of operationsAlteration of sequence of operations•• e.g. jumpe.g. jump
Combination of aboveCombination of above
Example of Program ExecutionExample of Program Execution
InterruptsInterrupts
Mechanism by which other modules (e.g. Mechanism by which other modules (e.g. I/O) may interrupt normal sequence of I/O) may interrupt normal sequence of processingprocessing
Program Flow ControlProgram Flow Control
Interrupt CycleInterrupt Cycle
Added to instruction cycleAdded to instruction cycleProcessor checks for interruptProcessor checks for interrupt•• Indicated by an interrupt signalIndicated by an interrupt signal
If no interrupt, fetch next instructionIf no interrupt, fetch next instructionIf interrupt pending:If interrupt pending:•• Suspend execution of current program Suspend execution of current program •• Save statusSave status•• Set PC to start address of interrupt handler routineSet PC to start address of interrupt handler routine•• Process interruptProcess interrupt•• Restore status and continue interrupted programRestore status and continue interrupted program
Transfer of Control via Transfer of Control via InterruptsInterrupts
Program TimingProgram TimingShort I/O WaitShort I/O Wait
Program TimingProgram TimingLong I/O WaitLong I/O Wait
Multiple InterruptsMultiple InterruptsDisable interruptsDisable interrupts•• Processor will ignore further interrupts while Processor will ignore further interrupts while
processing one interruptprocessing one interrupt•• Interrupts remain pending and are checked Interrupts remain pending and are checked
after first interrupt has been processedafter first interrupt has been processed•• Interrupts handled in sequence as they occurInterrupts handled in sequence as they occurDefine prioritiesDefine priorities•• Low priority interrupts can be interrupted by Low priority interrupts can be interrupted by
higher priority interruptshigher priority interrupts•• When higher priority interrupt has been When higher priority interrupt has been
processed, processor returns to previous processed, processor returns to previous interruptinterrupt
Multiple Interrupts Multiple Interrupts -- SequentialSequential
Time Sequence of Multiple Time Sequence of Multiple InterruptsInterrupts