9 votes 9 votes 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. $5$ $6$ $7$ $8$ CO and Architecture isro-2020 co-and-architecture pipelining normal + – Satbir asked Jan 13, 2020 edited Apr 9, 2020 by go_editor Satbir 3.4k views answer comment Share Follow See 1 comment See all 1 1 comment reply Sanandan commented Sep 7, 2020 reply Follow Share option B ) 6 cycles xy+xyz+yz = y(x+xz+z) 0 votes 0 votes Please log in or register to add a comment.
Best answer 11 votes 11 votes Let's first rewrite the expression as: y*(x + z + x*z) the instructions are: ADD R0, R1, R3 MUL R0, R1, R4 ADD R3, R4, R3 MUL R2, R3, R3 Since it is a non-pipelined processor it will take 2*2 + 2*1 = 6 cycles venkatesh pagadala answered Jan 14, 2020 selected Jan 14, 2020 by Shaik Masthan venkatesh pagadala comment Share Follow See all 4 Comments See all 4 4 Comments reply habedo007 commented Feb 15, 2020 reply Follow Share Would the answer be different if the CPU was pipelined? 0 votes 0 votes DIBAKAR MAJEE commented May 1, 2020 reply Follow Share let us rewrite the equation as Y(X+Z+X*Z) Let us consider the following instruction ADD R0, R2, R3 MUL R0, R2, R4 ADD R3, R4, R3 MUL R1, R3, R3 So tye nos of clock cycle will be 1+2+1+2=6 clock cycles. 0 votes 0 votes taurus05 commented Oct 5, 2021 reply Follow Share Is it allowed to optimze the instruction to determine minimum number of clock cycle needed? 0 votes 0 votes samratchakraborty commented Oct 29, 2023 reply Follow Share got it now 0 votes 0 votes Please log in or register to add a comment.