Download presentation
Presentation is loading. Please wait.
Published byDarrius Halley Modified over 9 years ago
1
CIS 314 Fall 2005 MIPS Datapath (Single Cycle and Multi-Cycle)
2
CIS 314 Fall 2005 Basic MIPS Implementation For a limited subset of the MIPS instructions –Memory reference: LW and SW –Arithmetic-logical: add, sub, and, or, slt –Branch: beq Hardware components: PC, registers, memory units, ALU, multiplexors, decoders
3
CIS 314 Fall 2005 Single Cycle v. Multi-Cycle Single cycle is not realistic - just for understanding of the implementation. Single cycle: one (long) clock cycle to process each instruction Multi-cycle: divide the processing of each instruction into 5 stages and allocate one clock cycle per stage
4
CIS 314 Fall 2005 Major Functional Units
5
CIS 314 Fall 2005 Functional Units and Control Lines
6
CIS 314 Fall 2005 Fetch instruction and increment PC
7
CIS 314 Fall 2005 Memory transfer -- R-type instructions
8
CIS 314 Fall 2005 Computing branch condition and target address
9
CIS 314 Fall 2005 Single cycle and control unit
10
CIS 314 Fall 2005 Single cycle plus jump
11
CIS 314 Fall 2005 1 0 0 0 10 0 0 1 Example of execution 4000 11111111111111111 000000000100000 4004 00101 00001 00110 0 4004 0 0 x x 00110 xxxxxxx 0 0 10 0 11111111111111111 00000000010000000 4004 XXXX 000000 00101 01111 10000 00000 100000 1000000000100000 10000 01111 00101 000000 100000 Instr: add $s0, $a1, $t7 Field: op rs rt rd shamt funct M. Code: 000000 00101 01111 10000 00000 100000 PC: 0 x 4000 1 10000
12
CIS 314 Fall 2005 You’d better do this Repeat the example of execution for: –lw $t3, 16($t2) –sw $t3, 16($t2) –addi $t1, $s2, $v0 –beq $t3, $s0, gothere –jmp gothere –jr $ra (aka Suggested Exercises)
13
CIS 314 Fall 2005 Multicycle Datapath Break the operations on an instruction into a series of 5 steps. One clock cycle per step Instruction Fetch (IF) Instruction Decode (ID) Execute (EX) Memory Access (MEM) Write Back (WB)
14
CIS 314 Fall 2005 Multicycle Datapath HW changes: –Single memory unit for both instructions and data –Single ALU for all arithmetic operations –Extra registers needed to hold values between each steps Instruction Register (IR) holds the instruction Memory Data Register (MDR) holds the data coming from memory A, B hold operand data coming from the registers ALUOut holds output coming out of the ALU
15
CIS 314 Fall 2005 Extra hardware for multicycle datapath
16
CIS 314 Fall 2005 Multicycle datapath
17
CIS 314 Fall 2005 Complete multicycle datapath
18
CIS 314 Fall 2005 Multicycle Datapath: the 5 steps Step NameR-TypeMemory ReferenceBranchesJumps Instruction Fetch IR <= Memory[PC] PC <= PC + 4 Instruction Decode Register Fetch A <= Reg[IR[25:21]] B <= Reg[IR[20:16]] ALUOut <= PC + (sign-extend(IR[15:0]) << 2) Execution Address Computation Branch/Jump Completion ALUOut <= A op B ALUOut <= A +……………. sign-extend(IR[15:0]) If (A==B) PC <= ALUOut PC <= ………… {PC[31:28],... …IR[25:0], 00} Memory Access R-type completion Reg[IR[15:11]] <= ALUOut Load: MDR <= Memory[ALUOut ] Store: Memory[ALUOut ] <= B Memory Read Completion Load: Reg[IR[20:16]] <= MDR
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.