Controlling the Multicycle Implementation

Tom Kelliher, CS 240

Mar. 31, 2004

Administrivia

Announcements

Assignment

Read 5.5.

Problems due Friday.

From Last Time

Multicycle datapath.

Outline

  1. The complete multicycle datapath and control signals.

  2. Class exercise to design individual state machines to handle the following instructions: R-format, beq, lw, sw, jump.

  3. Development of the overall state machine.

Coming Up

Overview of microprogramming.

The Complete Datapath, Revisited

Control signals:

  1. IRWrite: Write a value from memory to the instruction register.

  2. RegDst, RegWrite.

  3. ALUSrcA: Choose between PC and Rs.

  4. MemRead, MemWrite, MemtoReg.

  5. IorD: Choose between PC and ALUOut for memory address.

  6. PCWrite: Load a new value into PC.

  7. PcWriteCond: Load a new value into PC if zero is active.

  8. ALUOp.

  9. ALUSrcB: Choose between Rt/Rd, 4, sign-extended immediate, sign-extended shifted immediate.

  10. PCSource: Choose between PC + 4, ALUOut (branch target address), jump address

The Instruction Cycle

  1. Steps: Fetch, decode, execution/completion.

  2. Instructions: R-format, memory reference, conditional branch, jump.

Fetch

Common to all instructions.

  1. Load IR.

  2. Increment PC.

Decode

Common to all instructions.

  1. Load A (rs field) and B (rt field) from register file.

  2. Load ALUOut with branch target.

These are ``optimistic'' optimizations which do no harm, even if they are not needed/do not make sense for the current instruction.

Execution, Memory Address Computation, Branch Completion

Instruction classes go their own way.

  1. R-format:
    1. Perform ALU operation, loading ALUOut.

  2. Memory reference:
    1. Use ALU to compute sum of base & offset, loading ALUOut.

  3. Conditional branch:
    1. If zero load PC with computed branch target in ALUOut.

    This instruction has completed.

  4. Jump:
    1. Load PC with jump address.

    This instruction has completed.

R-Format Completion, Memory Access

Just two instruction classes remaining.

  1. R-format:
    1. Load register file (rd field) from ALUOut.

    This instruction has completed.

  2. Memory reference:
    1. sw: Memory location specified by address in ALUout written with value stored in B.

      This instruction has completed.

    2. lw: MDR loaded from memory location specified by address in ALUOut.

LW completion

  1. Load register file (rt field) from MDR.

Designing the Control Unit

Design the state machine necessary for controlling the datapath.



Thomas P. Kelliher
Tue Mar 30 18:16:12 EST 2004
Tom Kelliher