Processor Organization
Processor Organization
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
Data Registers Can hold data and cannot used for calculation purpose.
Address Registers may be devoted to a particular addressing mode Segment registers holds the address of the base segment. There may be multiple registers ex: one for the operating system and one for the process Index Registers used for indexed addressing
Stack pointer : That point to the top of the stack
Condition codes - Flags Conditions codes are bits set by the processor hardware as the result of operation. ex : Arithmetic operation may produce negative, Zero or overflow results
Control & Status Registers Program Counter Contains the address of an instruction to be executed. Instruction Register : Contain the instruction most recently fetched Memory Address Register : Contain the address of a location in main memory Memory Buffer Register : Contains a word of data to be written or the most recently used
N.B. CPU design and operating system design are closely linked
Indirect Cycle
May require memory access to fetch operands Indirect addressing requires more memory accesses Can be thought of as additional instruction subcycle
Prefetch Fetch accessing main memory Execution usually does not access main memory Can fetch next instruction during execution of current instruction Called instruction prefetch
Any jump or branch means that prefetched instructions are not the required instructions
Pipelining Fetch instruction Decode instruction Calculate operands (i.e. EAs) Fetch operands Execute instructions Write result
Dealing with Branches Multiple Streams Prefetch Branch Target Loop buffer Branch prediction Delayed branching
Multiple Streams Have two pipelines Prefetch each branch into a separate pipeline Use appropriate pipeline Leads to bus & register contention Multiple branches lead to further pipelines being needed
Prefetch Branch Target Target of branch is prefetched in addition to instructions following branch Keep target until branch is executed Used by IBM 360/91
Loop Buffer Very fast memory Maintained by fetch stage of pipeline Check buffer before fetching from memory Very good for small loops or jumps c.f. cache Used by CRAY-1
Decode stage 1
Opcode & address-mode info At most first 3 bytes of instruction Can direct D2 stage to get rest of instruction
Decode stage 2
Expand opcode into control signals Computation of complex address modes
Execute
ALU operations, cache access, register update
Writeback
Update registers & flags Results sent to cache & bus interface write buffers
Pentium 4 Registers
EFLAGS Register
Control Registers
Exceptions
Processor detected Programmed
5 priority classes
Foreground Reading Processor examples Stallings Chapter 12 Manufacturer web sites & specs