18
Computer Organization Computer Organization and Architecture and Architecture Lecture 2 Lecture 2

Computer Structure and Components

Embed Size (px)

Citation preview

Page 1: Computer Structure and Components

Computer Organization Computer Organization and Architectureand Architecture

Lecture 2Lecture 2

Page 2: Computer Structure and Components

Structure of modern computer Structure of modern computer --Top LevelTop Level

Computer

Main Memory

InputOutput

SystemsInterconnection

Peripherals

Communicationlines

CentralProcessing Unit

Computer

Page 3: Computer Structure and Components

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

Page 4: Computer Structure and Components

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

Page 5: Computer Structure and Components

Computer Components:Computer Components:Top Level ViewTop Level View

Page 6: Computer Structure and Components

Instruction CycleInstruction Cycle

Two steps:Two steps:•• FetchFetch•• ExecuteExecute

Page 7: Computer Structure and Components

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

Page 8: Computer Structure and Components

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

Page 9: Computer Structure and Components

Example of Program ExecutionExample of Program Execution

Page 10: Computer Structure and Components

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

Page 11: Computer Structure and Components

Program Flow ControlProgram Flow Control

Page 12: Computer Structure and Components

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

Page 13: Computer Structure and Components

Transfer of Control via Transfer of Control via InterruptsInterrupts

Page 14: Computer Structure and Components

Program TimingProgram TimingShort I/O WaitShort I/O Wait

Page 15: Computer Structure and Components

Program TimingProgram TimingLong I/O WaitLong I/O Wait

Page 16: Computer Structure and Components

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

Page 17: Computer Structure and Components

Multiple Interrupts Multiple Interrupts -- SequentialSequential

Page 18: Computer Structure and Components

Time Sequence of Multiple Time Sequence of Multiple InterruptsInterrupts