edited by
3,406 views
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.

  1. $5$
  2. $6$
  3. $7$
  4. $8$
edited by

1 Answer

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
selected by
Answer:

Related questions

6 votes
6 votes
5 answers
2
Satbir asked Jan 13, 2020
4,444 views
A computer which issues instructions in order, has only $2$ registers and $3$ opcodes $\text{ADD, SUB}$ and $\text{MOV}$. Consider $2$ different implementations of the fo...
4 votes
4 votes
5 answers
3
Satbir asked Jan 13, 2020
4,262 views
A stack organized computer is characterised by instructions withindirect addressingdirect addressingzero addressingindex addressing
8 votes
8 votes
4 answers
4
Satbir asked Jan 13, 2020
3,736 views
An array of $2$ two byte integers is stored in big endian machine in byte addresses as shown below. What will be its storage pattern in little endian machine ?$$\begin{ar...