The GATE Grind

GATE 2011 CS (CS1) – Question 46

Computer Organization and Architecture · ALU and Control Unit Design · 2 marks · Multiple choice

Evaluate the shown expression tree on a load-store machine: memory holds a,b,c,d,e; binary operations use register operands and produce register results. No intermediate may be stored to memory. What is the minimum register count?

Diagram for GATE 2011 CS (CS1) question 46
  1. 2
  2. 9
  3. 5
  4. 3

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (D) 3

Explanation

The expression is (a−b)+(e−(c+d)). A pair of leaves needs two registers; the right subtree needs two by evaluating c+d first and then loading e. Hold one subtree result while evaluating the other, requiring three. Two cannot retain one result while computing the other two-register subtree. Thus three, D.

More ALU and Control Unit Design questions

All ALU and Control Unit Design questions →