Module 5_Processor Structure and Function
Module 5_Processor Structure and Function
Function
CPE131-1: Computer Architecture and Organization
William Stallings
Computer Organization
and Architecture
8th Edition
CPU Structure
¤ CPU must:
▪ Fetch instructions
▪ Interpret instructions
▪ Fetch data
▪ Process data
▪ Write data
CPU With Systems Bus
CPU Internal Structure
Registers
¤ CPU must have some working space (temporary storage)
¤ Called registers
¤ Number and function vary between processor designs
¤ One of the major design decisions
¤ Top level of memory hierarchy
User Visible Registers
¤ General Purpose
¤ Data
¤ Address
¤ Condition Codes
General Purpose Registers
¤ May be true general purpose
¤ May be restricted
¤ May be used for data or addressing
¤ Data
▪ Accumulator
¤ Addressing
▪ Segment
General Purpose Registers
¤ Make them general purpose
▪ Increase flexibility and programmer options
▪ Increase instruction size & complexity
¤ Make them specialized
▪ Smaller (faster) instructions
▪ Less flexibility
How Many GP Registers?
¤ Between 8 - 32
¤ Fewer = more memory references
¤ More does not reduce memory references and takes up processor
real estate
How big?
¤ Large enough to hold full address
¤ Large enough to hold full word
¤ Often possible to combine two data registers
▪ C programming
▪ double int a;
▪ long int a;
Condition Code Registers
¤ Also called Status register or flag register
¤ Sets of individual bits
▪ e.g. result of last operation was zero
¤ Can be read (implicitly) by programs
▪ e.g. Jump if zero
¤ Can not (usually) be set by programs
Control & Status Registers
¤ Program Counter
¤ Instruction Decoding Register
¤ Memory Address Register
¤ Memory Buffer Register
¤ Note: CPU design and operating system design are closely linked
Example Register Organizations
Instruction Cycle
¤ In a basic computer, each instruction cycle consists of the following
phases:
1. Fetch instruction from memory.
2. Decode the instruction.
3. Read the effective address from memory.
4. Execute the instruction.
Image from:
https://www.javatpoint.com/instruction-cycle
Indirect Cycle
¤ May require memory access to fetch operands
¤ Indirect addressing requires more memory accesses
¤ Can be thought of as additional instruction subcycle
Instruction Cycle with Indirect
Instruction Cycle State Diagram
Data Flow (Instruction Fetch)
Sample MARIE program:
Input
Store X
¤ Depends on CPU design Input
Store Y
¤ In general:
Add X
Output
Halt
¤ Fetch
▪ PC contains address of next instruction X, DEC 0
▪ Address moved to MAR Y, DEC 0
Privileged modes
Exception modes