Slides12 04
Slides12 04
Slides12 04
No HW problems on this chapter. It is important to understand this material on the architecture of computer control units, and microprogrammed control units.
Basic Elements of Processor ALU Registers Internal data pahs External data paths Control Unit
Instruction Micro-Operations A computer executes a program of instructions (or instruction cycles) Each instruction cycle has a number to steps or phases:
Fetch, Indirect (if specified), Execute, Interrupt (if requested)
Types of Micro-operation Transfer data between registers Transfer data from register to external Transfer data from external to register Perform arithmetic or logical ops
Control Signals
Clock
One micro-instruction (or set of parallel microinstructions) per clock cycle
Instruction register
Op-code for current instruction Determines which micro-instructions are performed
Flags
State of CPU Results of previous operations
Fetch Cycle
Address of next instruction is in PC Address (MAR) is placed on address bus t1: MAR (PC) Control unit issues READ command Result (data from memory) appears on data bus Data from data bus copied into MBR t2: MBR (memory) PC incremented by 1 (in parallel with data fetch from memory) PC (PC) +1 Data (instruction) moved from MBR to IR t3: IR (MBR) MBR is now free for further data fetches
Fetch Cycle
Fetch Cycle: t1: MAR (PC) t2: MBR (memory) PC (PC) +1 t3: IR (MBR)
Fetch Cycle Let Tx be the time unit of the clock. Then: t1: MAR (PC) t2: MBR (memory) PC (PC) +1 t3: IR (MBR)
Is this equally correct? t1: t2: t3: Why?
Basic Rules for Clock Cycle Grouping Proper sequence must be followed
MAR (PC) must precede MBR (memory)
Indirect Cycle
Indirect Cycle: t1: MAR (IRaddress) t2: MBR (memory) t3: IRaddress (MBRaddress)
IR is now in same state as if direct addressing had been used (What does this say about IR size?)
Interrupt Cycle
Interrupt Cycle: t1: t2: MBR MAR PC t3: memory (PC) save-address routine-address (MBR)
This is a minimum. May be additional micro-ops to get addresses N.B. saving context is done by interrupt handler routine, not microops
Execute Cycle: ADD R1, X t1: t2: t3: MAR (IRaddress) MBR (memory) R1 R1 + (MBR)
MAR (IRaddress) MBR (memory) MBR (MBR) + 1 memory (MBR) if (MBR) == 0 then PC (PC) + 1
Notes:
if is a single micro-operation Micro-operations done during t4
MAR (IRaddress) MBR (PC) t2: PC (IRaddress) memory (MBR) t3: PC (PC) + 1
Control Signals
Internal Organization Usually a single internal bus Gates control movement of data onto and off the bus Control signals control data transfer to and from external systems bus Temporary registers needed for proper operation of ALU
Hard Wired Control Unit The Cycles (Fetch, Indirect, Execute, Interrupt) are constructed as a State Machine The Individual instruction executions can be constructed as State Machines
Common sections can be shared. There is a lot of similarity
State Machine
Combinational logic
Determine outputs at each state. Determine next state.
Storage elements
Maintain state representation.
State Machine
Inputs
Outputs
Clock
State Diagram
Shows states and actions that cause transitions between states.
Outputs
Next States
Master-slave flipflops
Problems With Hard Wired Designs Sequencing & micro-operation logic gets complex Difficult to design, prototype, and test Resultant design is inflexible, and difficult to build upon (Pipeline, multiple computation units, etc.) Adding new instructions requires major design and adds complexity quickly.
May be expected to complete instruction execution in 1 clock cycle. How is this possible?
Recall: Micro-sequencing
Vertical Microprogrammed
Packed Soft Indirect
Horizontal Micro-programming
Wide control memory word High degree of parallel operations possible Little encoding of control information Fast
Vertical Micro-programming
Width can be much narrower Control signals encoded into function codes need to be decoded More complex, more complicated to program, less flexibility More difficult to modify Slower
Next Address Decision Depending on ALU flags and control buffer register:
Get next instruction
Add 1 to control address register
Disadvantage: Slower
Address Generation
Explicit Two-field Unconditional Branch Conditional branch Mapping Addition Residual control Implicit