CS274: Computer Architecture - The MIPS Multi Cycle Design

Activity Goals

The goals of this activity are:
  1. To extend the single cycle datapath into a multicycle approach
  2. To express the control of the datapath as a finite state machine over each instruction stage (cycle) rather than a simple single cycle table
  3. To describe the timing benefits of a multicycle design
  4. To calculate the average cycles per instruction for a given program on the MIPS multicycle datapath

The Activity

Directions

Consider the activity models and answer the questions provided. First reflect on these questions on your own briefly, before discussing and comparing your thoughts with your group. Appoint one member of your group to discuss your findings with the class, and the rest of the group should help that member prepare their response. Answer each question individually from the activity, and compare with your group to prepare for our whole-class discussion. After class, think about the questions in the reflective prompt and respond to those individually in your notebook. Report out on areas of disagreement or items for which you and your group identified alternative approaches. Write down and report out questions you encountered along the way for group discussion.

Model 1: A Multicycle Datapath Design for MIPS

An abstract block diagram for a multi cycle MIPS architecture

Questions

  1. Notice the inputs to the ALU: there are several of them. What are they, and how can we choose between them?

Model 2: Augmenting the Single Cycle MIPS Datapath to Consolidate the ALUs

Consolidating the ALUs from the Single Cycle Datapath, since a single ALU can be used during each instruction step for a different purpose

Questions

  1. Why does the multicycle approach use only a single ALU? Why was this impossible with the single cycle design?
  2. How does an add instruction execute through this datapath? Hint: it requires multiple steps through the datapath now!

Model 3: Modifying the Control Unit to Output Specialized Control Signals at Each Instruction Stage via a Finite State Machine

Block Diagram of a Finite State Machine
Fetch Decode ALU Memory Access Writeback
IR = Mem[PC] A = Reg[rs] lw/sw: ALUOut = A+immediate (IR[15:0]) lw: MDR = Mem[ALUOut] lw/sw: Reg[rt] = MDR
ALUOut = PC + 4 B = Reg[rt] R type: ALUOut = func sw: Mem[ALUOut] = B R-type: Reg[rd] = ALUOut
PC += 4 ALUOut = immediate (IR[15:0]) <<2
sign extended to 32 bits
beq: ALUOut = A - B; if zero, PC = ALUOut R-type: skip to writeback
j: PC = jump target

Modifying the Control Unit to Output Specialized Control Signals at Each Instruction Stage

Questions

  1. Describe the functionality of each control signal in this datapath, for each instruction cycle stage.
  2. How does the conditional and boolean logic of the multi-cycle control unit differ from that of the single cycle control? In other words, what additional input(s) are needed to the control unit to determine the output control bits, beyond merely the opcode and function code?

Model 4: The MIPS Multicycle Datapath

The MIPS Multi Cycle Datapath

Questions

  1. Trace an add, beq, and j instruction through this datapath.
  2. Add an instruction to the datapath and control finite state machine flowchart to support blez: branch if less than or equal to 0.

Model 5: Calculating Performance via Cycles Per Instruction (CPI)

Opcode Instruction Fetch Regiter Read ALU Memory Register Writeback Total Time (ps)
R 200 50 100 0 50 400
lw 200 50 100 200 50 600
sw 200 50 100 200 0 550
beq 200 50 100 0 0 350
j 200 0 0 0 0 200

Questions

  1. How many cycles are required for each instruction above? Hint: use the control unit finite state machine and count the length of each path.
  2. Suppose a program has 25% loads, 10% stores, 52% ALU instructions, 11% branches, and 2% jumps. What is the average number of cycles per instruction?
  3. The average cycles per instruction for the single cycle datapath is always 1. Why is this an improvement? Hint: consider the timing length of each cycle for single cycle and for multi cycle.

Submission

I encourage you to submit your answers to the questions (and ask your own questions!) using the Class Activity Questions discussion board. You may also respond to questions or comments made by others, or ask follow-up questions there. Answer any reflective prompt questions in the Reflective Journal section of your OneNote Classroom personal section. You can find the link to the class notebook on the syllabus.