MID-II CA Spring 2025 Solution
MID-II CA Spring 2025 Solution
Karachi Campus
Computer Architecture (EE-3009) Sessional-II Exam
Date: April 10th 2025
Total Time (Hrs): 1
Course Instructor(s)
Total Marks: 30
Mr. Aashir Mahboob, Dr. Nausheen , Mr. Kashan ,
Total Questions: 3
Mr. Shoaib Rauf
a. In load –store Architecture, what is the maximum number of operands allowed in an instruction?
Does it support memory addressing?
3 operands allowed in an instruction. No it does not support memory addressing.
b. In RISC-V ISA, which encoding format is used for ALU operations and for branches?
R – Type for ALU operations (R-R) , I- Type for ALU immediate.
S/B- Type for Branches.
CLO # 3 Solution
Q2: You are given a non-pipelined processor design which has a 5 GHz clock and it uses 3 cycles for
ALU operations, 2 cycles for branch operations and 4 cycles for memory operations. Assume that the
relative frequencies of these operations are 40%, 20%, and 40%, respectively. [ 3x3=09 Marks]
a. What is the best speedup you can get by pipelining it into 5 stages?
CLO # 3 Solution
Q3: Consider the following code sequences,
Identify the type of Dependencies (Hazards).
Suggest a possible solution to resolve the hazard.
Draw Pipeline diagram for each case to support your answer.
[3.5x4=15 Marks]
A) B)
ld x1,45(x2) ld x1,45(x2)
add x5,x1,x7 add x5,x6,x7
sub x8,x6,x7 sub x8,x1,x7
or x9,x6,x7 or x9,x6,x7
C) D)
ld x1,45(x2) Ld x1,0(x4)
add x5,x6,x7 Ld x2,4(x4)
sub x8,x6,x7 add x3,x2,x1
or x9,x1,x7 sd x3,8(x4)
addi x4,x4,4