###### SQL

August 17, 2023###### NIC-NIELIT Scientist-B 2020

August 18, 2023# ISRO CS 2020

Question 2 |

A non-pipelined CPU has 12 general purpose registers(R0, R1, R2,……..R12). Following operations are supported

ADD Ra, Rb, Rr Add Ra to Rb and store the result in Rr

MUL Ra, Rb, Rr Multiply Ra to Rb and store the result in Rr

MUL operations takes two clock cycles, ADD takes one clock cycle.

Calculate the minimum number of clock cycles required to compute the value of the expression XY+XYZ+YZ. The variables X, Y, Z are initially available in registers R0, R1 and R2 contents of these registers must not be modified.

ADD Ra, Rb, Rr Add Ra to Rb and store the result in Rr

MUL Ra, Rb, Rr Multiply Ra to Rb and store the result in Rr

MUL operations takes two clock cycles, ADD takes one clock cycle.

Calculate the minimum number of clock cycles required to compute the value of the expression XY+XYZ+YZ. The variables X, Y, Z are initially available in registers R0, R1 and R2 contents of these registers must not be modified.

5 | |

6 | |

7 | |

8 |

Question 2 Explanation:

To calculate XY+XYZ+YZ, we need at least 3 multiplication operations and 2 ADD operations.

Assuming R0 = X, R1 = Y, R2 = Z.

MUL R3, R0, R1

MUL R4, R3, R2

ADD R5, R4, R3

MUL R6, R1, R2

ADD R7, R5, R6

Total we need 3 multiplication operations and 2 add operations.

Total cycles needed = 3*2+2 = 8

Correct Answer: D

Question 2 Explanation:

To calculate XY+XYZ+YZ, we need at least 3 multiplication operations and 2 ADD operations.

Assuming R0 = X, R1 = Y, R2 = Z.

MUL R3, R0, R1

MUL R4, R3, R2

ADD R5, R4, R3

MUL R6, R1, R2

ADD R7, R5, R6

Total we need 3 multiplication operations and 2 add operations.

Total cycles needed = 3*2+2 = 8

What is the correct answer since in the video explanation it’s different. And option is option B) 6 in the video

Yes. The correct answer is 6 only. Please follow video explanation.