- Processor
- Fetches instructions from memory, decodes and executes them
 
- Set of instructions is processor specific
 
- Instructions include:
- load value from memory into register
 
- combine operands from registers or memory
 
- branch
 
 
- All CPU's have registers to store
- key variables and temporary results
 
- information related to control program execution
 
 
 
- Processor Registers
- Data and address registers
- Hold operands of most native machine instructions
 
- Enable programmer to minimize main-memory references by optimizing  register use
 
- user-visible
 
 
- Control and status registers
- Used by processor to control operating of the processor
 
- Used by operating-system routines to control the execution of programs
 
- Sometimes not accessible by user (architecture dependent)
 
 
 
- User-Visible Registers
- May be referenced by machine language instructions
 
- Available to all programs - application programs and system  programs
 
- Types of registers
- Data
 
- Address
- Index
 
- Segment pointer
 
- Stack pointer
 
 
- Many architectures do not distinguish different types
 
 
 
- Control and Status Registers
- Program Counter (PC),  Contains the address of an instruction to be fetched
 
- Instruction Register (IR), Contains the instruction most recently fetched
 
- Processor Status Word (PSW)
- condition codes
 
- interrupt enable/disable
 
- supervisor/user mode
 
 
- Condition Codes or Flags
- Bits set by the processor hardware as a result of operations
 
- Can be accessed by a program but not altered
 
- Examples: positive/negative result, zero, overflow
 
 
 
- Instruction Fetch and Execute
- Program counter (PC) holds address of the instruction to be fetched next
 
- The processor fetches the instruction from memory
 
- Program counter is incremented after each fetch
 
- Overlapped on modern architectures (pipelining)
 
 
- Instruction Register
- Fetched instruction is placed in the instruction register
 
- Types of instructions
- Processor-memory, transfer data between processor and memory
 
- Processor-I/O, data transferred to or from a peripheral device
 
- Data processing, arithmetic or logic operation on data
 
- Control, alter sequence of execution
 
 
 
Figure 5:
Fetch and Execute
| 
 | 
 
Cem Ozdogan
2004-03-06