Programmer's Model: Thorne: Chapter 2 (Irvine, Edition IV: Chapter 2)
Programmer's Model: Thorne: Chapter 2 (Irvine, Edition IV: Chapter 2)
Thorne : Chapter 2
(Irvine, Edition IV : Chapter 2)
SYSC3006 1
Programmers Model
All modern microprocessors are based on the van Neumann model
System Bus (address, data, & control)
Bus
Interface
Unit (BIU)
Execution
Unit (EU)
Memory
Program
Storage
Output
Units
Input
Units
Central
Processing Unit
Unit (EU)
Storage
Data
Storage
SYSC3006 2
(CPU)
StoredProgramConcept >InstructionExecutionCycle Stored Program Concept -> Instruction Execution Cycle
Before Van Neumann : Program was stored externally, on tape or cards
A fundamental consequence of the Van NeumannModel:
Memorycontainsbothinstructionsanddata Memory contains both instructions and data
Instructions ARE data : Can be manipulated
Instructions must be read, executed; called the instruction execution cycle
Requires a unit to control the instruction execution cycle : CPU =control equ es u oco o e s uc o e ecu o cyc e: C U co o
unit
Briefly (for now) the instruction execution cycle is a sequence of operations
required to execute a single instruction. The control unit under a clock
commands commands
Control Unit (CU or BIU) to fetchthe next instruction from memory
BIU to decodethe fetched instruction
The execution unit (EU or ALU) to executethe instruction ( )
Execution of the instruction may require further fetches of data from
memory and/or storage of data to memory (ie. involvement of the
BIU)
What isreq iredtos pport theinstr ctione ec tionc cle?
SYSC3006 3
What is required to support the instruction execution cycle ?
Registers
Thorne: Registersareplaceswheredatacanbeprocessedparticularly Thorne: Registers are places where data can be processed particularly
quickly
Registers are internal storage places (ie. memory) connected to the
internal components of the CPU (eg. BIU, ALU)
Control Unit (CU)
Bus
Interface
System Bus (address, data, & control)
internal components of the CPU (eg. BIU, ALU)
Address
Fetch
Interface
Unit
(BIU)
PC
Register
Segment
Fetch
Decoder
Execution Unit (EU)
Memory
Program
Storage
Output
Units
Input
Units
Instruction Register (IR)
Status
Register
Segment
Registers
l i i ( )
Data
Storage
Working
Registers
Register
Arithmetic
Logic Unit
(ALU)
Clock
Unit
SYSC3006 4
Central Processing Unit (CPU)
*PC: Program Counter
(Instruction Pointer: IP)
Instructions
All activity within the microprocessor is initiated by the microprocessor
Includes all transfers to/from memory/input/output.
In the 8086 family: All activity must go through the microprocessors. y y g g p
Cant go from input directly to memory.
Cant go directly from one memory location to another memory location.
Two major categories of instructions j g
Register-memory instructions : Transfer information between
programmers registers and memory
Reads so that data can be used as inputs to the ALU in subsequent
instruction(s)
Writes so that results of ALU can be stored persistently
Register-to-Register
Typically to fetch two operands from the programmers registers to
be used as the two ALU inputs and storing the ALU output back in
one of the registers
Eg addition boolean
SYSC3006 5
Eg. addition, boolean
Defines what the computer can do
InstructionExecutionCycle InDetail Instruction Execution Cycle In Detail
For each machine instruction, the control unit uses the program
t (PC) ( l k i t ti i t IP) di t ti counter (PC) (also known as instruction pointer: IP) and instruction
queue (6 bytes) to do the following
Short name : Fetch-Execute Cycle
1 Fetch Phase : Readmemoryat theaddressgiveninthePC tocopythe 1. Fetch Phase : Read memory at the address given in the PC to copy the
instruction into the internal instruction queue.
2. Decode Phase: Determine the type of instruction and the
number/location of 0..2 operands. p
3. Execute Phase :
1. Fetch Operands : [If needed] Read memory to copy the data into an input
working register
2. Instruction Execution : Signal the ALU to perform the operation and
sends its data to its output working register and set the status flags
3. Store output operand: [If needed] Write to memory to store the data from
theALU output register.
SYSC3006 6
the ALU output register.
InstructionExecutionCycle Instruction Execution Cycle
The instruction execution cycle is the heartbeat of the computer.
It is all synchronized on the CPU clock.
Fetch Decode Fetch Execute Store Fetch Decode Fetch Execute Store
Execution Cycle
Instr Instr Operand Instr Result Instr Instr Operand Instr Result