Computer Organization and Architecture Micro-Operations
Computer Organization and Architecture Micro-Operations
Micro-Operations Execution of an instruction (the instruction cycle) has a number of smaller units
Fetch, indirect, execute, interrupt, etc
Each part of the cycle has a number of smaller steps called micro-operations
Discussed extensive in pipelining
Fetch example
Fetch Sequence (symbolic) t1: MAR <- (PC) t2: MBR <- (memory) PC <- (PC) +1 t3: IR <- (MBR) (tx = time unit/clock cycle) or t1: MAR <- (PC) t2: MBR <- (memory) t3: PC <- (PC) +1 IR <- (MBR)
or
t1: t2: t3:
Indirect Cycle Once the instruction has been fetched we need to fetch source operands.
Assume one-address instruction format with direct and indirect addressing allowed Indirect cycle (memory at addr contains address of operand):
t1: MAR <- (IRaddress) - address field of IR t2: MBR <- (memory) t3: IRaddress <- (MBRaddress)
IR is updated with direct address of operand IR is now in same state as if direct addressing had been used
Interrupt Cycle At end of execute cycle, processor tests interrupt signal. If set, an interrupt cycle occurs
t1: t2: t3: MBR <-(PC) MAR <- save-address PC <- routine-address memory <- (MBR)
Execute Cycle (ADD) Fetch, Indirect and Interrupt cycles are simple and predictable Execute cycle is different for each instruction Well look at several examples ADD R1,X - add the contents of location X to Register 1 , result in R1
t1: MAR <- (IRaddress) t2: MBR <- (memory) t3: R1 <- R1 + (MBR)
Example is simplified. We may need additional micro-ops to get register reference from IR or stage ALU input or output in an intermediate register
Execute Cycle (ISZ) ISZ X - increment and skip if zero Contents of location X are incremented by 1; if the result is 0 the next instruction is skipped
t1: t2: t3: t4: MAR <- (IRaddress) MBR <- (memory) MBR <- (MBR) + 1 memory <- (MBR) if (MBR) == 0 then PC <- (PC) + 1
Notes:
Conditional action (test and increment if 0) is a single micro-op Can be performed in same time unit as store to memory
Instruction Cycle Each phase is decomposed into a sequence of elementary micro-ops We have one sequence for fetch, indirect, and interrupt cycles, but execute cycle has one sequence of micro-operations for each opcode To complete the picture we need to tie sequences together into the instruction cycle
Assume new 2-bit register; the instruction cycle code (ICC) designates which part of cycle processor is in
00: Fetch 01: Indirect 10: Execute 11: Interrupt
Functions of Control Unit Control Unit performs two basic tasks Sequencing
Causing the CPU to step through a series of microoperations
Execution
Causing the performance of each micro-op
Instruction register
Contains op-code for current instruction Determines which micro-ops are performed
Flags
Determine state of CPU and results of previous operations
To control bus
Control signals to memory Control signals t o I/O modules
After this is complete the control unit examines IR to determine whether to perform an indirect cycle or an execute cycle
Control Signals Example This model is a simple processor that has one register AC (accumulator) Diagram indicates data paths between elements
Terminations of control signals are labeled Cn and indicated by a circle Inputs are clock, flags, IR
With each clock cycle the control unit reads all of its inputs and emits a set of control signals
ALU
Signals activate various logic circuits in ALU
System Bus
Control signals such as memory read or write
Internal Organization Control signals diagram shows a variety of data paths in a very simple processor
Complexity would be to high in any real processor to have hardwired data paths Usually a single internal bus is used Gates control movement of data onto and off the bus
Control signals control data transfer to and from external systems bus
The Intel 8085 An 8-bit microprocessor produced in 1977 Some key components that may not be obvious:
Incrementer/Decrementer address latch: add or subtract 1 from SP or PC. Saves time by not using ALU Interrupt Control: handles multiple levels or interrupt signals Serial I/O control: interface for serial devices (1 bit at a time)
External Control Signals Examples Instruction is OUT byte (output to IO device); 3 machine cycles
1. Instruction opcode is fetched 2. 2nd half of instruction is fetched with I/O address 3. Contents of AC written out to device over data bus
Timing state T2 the memory module places contents of memory location on addr/data bus
Control unit sets RD signal to indicate a read but waits until T3 to copy the data Gives memory module time to put the data on the bus and stabilize signal levels
State T3 is bus idle state during which processor decodes the instruction
In a hardwired implementation the control unit is a state machine Input logic signals are transformed into output signals (control signals)
Boolean expression for C5 The following expression defines C5 for fetch and indirect
C5 = (~P ^ ~Q ^ T2) | (~P ^ Q ^ T2)
For execute, we need a control signal for each instruction Assume we have three instructions that read from memory (LDA, ADD, AND)
C5 = (~P^~Q^T2) | (~P^Q^T2) | (P^~Q^(LDA | ADD | AND)^T2)
Repeat this process for each control signal Result is a set of Boolean equations that define the behavior of the control and therefore the processor
Problems With Hard Wired Designs Complex sequencing & micro-operation logic Difficult to design and test
With modern processors the number of Boolean equations is huge and implementation of combinatorial circuit is very difficult
Inflexible design
Difficult to add new instructions