August 17, 2023
August 18, 2023
August 17, 2023
###### NIC-NIELIT Scientist-B 2020
August 18, 2023
 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.
 A 5 B 6 C 7 D 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
MUL R6, R1, R2

Total we need 3 multiplication operations and 2 add operations.
Total cycles needed = 3*2+2 = 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
MUL R6, R1, R2

Total we need 3 multiplication operations and 2 add operations.
Total cycles needed = 3*2+2 = 8