search
Log In
5 votes
848 views

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.

  1. $5$
  2. $6$
  3. $7$
  4. $8$
in CO and Architecture
edited by
848 views
0
option B ) 6 cycles xy+xyz+yz = y(x+xz+z)

1 Answer

8 votes
 
Best answer
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

selected by
0
Would the answer be different if the CPU was pipelined?
0
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.
Answer:

Related questions

4 votes
4 answers
1
1.5k views
Consider a $5$- segment pipeline with a clock cycle time $20$ ns in each sub operation. Find out the approximate speed-up ratio between pipelined and non-pipelined system to execute $100$ instructions. (if an average, every five cycles, a bubble due to data hazard has to be introduced in the pipeline) $5$ $4.03$ $4.81$ $4.17$
asked Jan 13, 2020 in CO and Architecture Satbir 1.5k views
3 votes
3 answers
2
881 views
A computer which issues instructions in order, has only $2$ registers and $3$ opcodes $\text{ADD, SUB}$ and $\text{MOV}$. Consider $2$ ... and by how many $\text{MOV}$ instructions? $\text{Case 2,2}$ $\text{Case 2,3}$ $\text{Case 1,2}$ $\text{Case 1,3}$
asked Jan 13, 2020 in CO and Architecture Satbir 881 views
2 votes
4 answers
3
1k views
A stack organized computer is characterised by instructions with indirect addressing direct addressing zero addressing index addressing
asked Jan 13, 2020 in CO and Architecture Satbir 1k views
4 votes
4 answers
4
791 views
An array of $2$ ...
asked Jan 13, 2020 in CO and Architecture Satbir 791 views
...