Assignment 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

COMP 452 – Computer Architecture

Assignment 2

Deadline: Tuesday, 23rd May (In class)

Name: ___________________________ Roll No.____________________________

1. Show complete working of your solution.


2. You are supposed to submit the handwritten solution. You can take print out of this
document and solve the assignment on that print out.

Q1: (1 point) Execute the following assembly code on a MC FP MIPS pipeline and complete the
table with stall detection and with data forwarding. This version uses ROB, instruction queue, and
memory enhancement (i.e., only integer unit goes through memory stage). Observe the following
lengths of execution stage for different FUs.

FP ADD/SUB: 2 CC FP MUL: 10 CC FP DIV: 20 CC LD/SD: 1 CC

IF ID EXE MEM WB Comments (Mention different hazards


stalling the pipeline)
LD F4, 0(R2)
DIV.D F5, F4, F2
S.D F2, 20(R2)
MUL.D F2, F5, F0
SUB.D F0, F4, F6
ADD.D F0, F0, F2

Q2: (1 point) Execute the following assembly code on a MIPS with a scoreboard and complete the
table. Observe the following lengths for execution stage.

FP ADD/SUB: 2 CC FP MUL: 10 CC FP DIV: 20 CC INT: 1 CC

There are 2 MUL units, 1 FP DIV unit, 1 FP ADD unit, and 1 INT unit. L.D/S.D will be executed on INT
unit.

IS RO EX WR Comments (Mention different hazards


stalling the pipeline)
LD F4, 0(R2)
DIV.D F5, F4, F2
S.D F2, 20(R2)
MUL.D F2, F5, F0
SUB.D F0, F4, F6
ADD.D F0, F0, F2
Q3 (1.5 points): Complete the following table for two iterations of a loop using Tomasulo’s algorithm.
Assume that there is no inter-loop dependence of instructions but we must wait for the outcome of
first loop branch condition (i.e., non speculative execution) before issuing the first instruction of
second loop. Register all stalls in the comments column. Assume we have infinite no. of reservation
stations available with us. Observe the following lengths for execution stage.

3. FP ADD/SUB/L.D/S.D: 2 CC FP MUL: 10 CC FP DIV: 20 CC INT/Branch:


1 CC

Iteration# Instructions IS EX WR Comments (Mention different hazards


stalling the pipeline)
1 DIV.D F5, F2, F4
1 L.D F5, 0(R3)
1 MUL.D F2, F4, F5
1 ADD.D F4, F5, F3
1 DADDI R3, R3, -8
1 BNEZ R3, Loop

2 DIV.D F5, F2, F4


2 L.D F5, 0(R3)
2 MUL.D F2, F4, F5
2 ADD.D F4, F5, F3
2 DADDI R3, R3, -8
2 BNEZ R3, Loop

Q4 (1.5 points): Complete the following table for two iterations of a loop using Tomasulo’s algorithm.
Assume that there is no inter-loop dependence of instructions and we can do speculative execution
with ROB. Register all stalls in the comments column. Assume we have infinite no. of reservation
stations available with us. Observe the following lengths for execution stage.

1. FP ADD/SUB/L.D/S.D: 2 CC FP MUL: 10 CC FP DIV: 20 CC INT/Branch:


1 CC

Iteration# Instructions IS EX WR Commit Comments (Mention different


hazards stalling the pipeline)
1 DIV.D F5, F2, F4
1 L.D F5, 0(R3)
1 MUL.D F2, F4, F5
1 ADD.D F4, F5, F3
1 DADDI R3, R3, -8
1 BNEZ R3, Loop

2 DIV.D F5, F2, F4


2 L.D F5, 0(R3)
2 MUL.D F2, F4, F5
2 ADD.D F4, F5, F3
2 DADDI R3, R3, -8
2 BNEZ R3, Loop

You might also like