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

2020

A non-pipelined CPU has 12 general purpose registers (R0, R1, R2, ..... R12). Following operation 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 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 and contents of these registers must not be modified.

  1. A.

    5

  2. B.

    6

  3. C.

    7

  4. D.

    8

Attempted by 20 students.

Show answer & explanation

Correct answer: B

The minimum number of clock cycles required to compute XY + XYZ + YZ is 6. MUL operations take 2 cycles, ADD takes 1 cycle. Calculations: XY (2), YZ (2), XYZ using XY and Z (2). Total 6 cycles.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro