ISRO Scientist/Engineer CSE 2020Computer Organization and Architecture › Pipelining
ISRO Scientist/Engineer CSE 2020 PYQ: A non-pipelined CPU has 12 general purpose registers $(R0,R1,R2, \dots ,R12)$. Following operations are…
A non-pipelined CPU has 12 general purpose registers $(R0,R1,R2, \dots ,R12)$. Following operations are supported
- $\begin{array}{ll} \text{ADD Ra, Rb, Rr} & \text{Add Ra to Rb and store the result in Rr} \end{array}$
- $\begin{array}{ll} \text{MUL Ra, Rb, Rr} & \text{Multiply Ra to Rb and store the result in Rr} \end{array}$
$\text{MUL}$ operation takes two clock cycles, $\text{ADD}$ takes one clock cycle.
Calculate minimum number of clock cycles required to compute the value of the expression $XY+XYZ+YZ$. The variable $X,Y,Z$ are initially available in registers $R0,R1$ and $R2$ and contents of these registers must not be modified.
- A5
- B6Correct answer
- C7
- D8
Answer
(B) $6$
Approach
The expression $XY + XYZ + YZ$ can be factored as $Y(X + Z + XZ)$. Since the CPU is non-pipelined, the total execution time is the sum of the latencies of all instructions. We need to find a sequence of ADD (1 cycle) and MUL (2 cycles) instructions that computes this value using the available registers without modifying the initial values of $X, Y, Z$ (stored in $R0, R1, R2$ respectively).
Reviewed by ISRO IQ Editorial Team.