edited by
3,109 views
2 votes
2 votes

A data driven machine is one that executes an instruction if the needed data is available. The physical ordering of the code listing does not dictate the course of execution. Consider the following pseudo-code:

  1.  Multiply $E$ by $0.5$ to get $F$
  2. Add $A$ and $B$ to get $E$
  3. Add $B$ with $0.5$ to get $D$
  4. Add $E$ and $F$ to get $G$
  5. Add $A$ with $10.5$ to get $C$

Assume $A, B, C $ are already assigned values and the desired output is $G$. Which of the following sequence of execution is valid?

  1. B, C, D, A, E
  2. C, B, E, A, D
  3. A, B, C, D, E
  4. E, D, C, B, A
edited by

3 Answers

4 votes
4 votes

We can give data dependency as follows with each node being the corresponding instruction.

So, instruction A cannot happen before instruction B and also instruction D cannot happen before either instruction A or instruction B. Only option satisfying this is option B. 

3 votes
3 votes

the desired output is $G$.

$G$ should be produced at last.

$G$ is produced only by instruction $D$ so $D$ should be at last in sequence.

Hence $b.$ is correct choice.

0 votes
0 votes
writing pseudo-code:-

A. F=0.5*E

B.E=A+B

C.D=0.5+B

D.G=E+F

E.C=A+10.5

A,B,C are already assigned by value and data driven going to execute next instruction only if data available.

options:-

A.=>> B,C,D

      B= > E=A+B we can execute it as A,B are already assigned

      C=> D=0.5+B we can execute since B is already assigned.

      D=>> G=E+F we cannot execute it since F=E*0.5 and it is not computed yet.

Option B:-  

    Execute C:- D=B+0.5 , can execute as B is assigned

    Execute B:- E=A+B.can execute as A,B is assigned

     Execute E:- C=A+10.5,can execute as A is assigned

     Execute A:- F=E*0.5, can execute as E is already computed by B.

   Execute D:- G=E+F, can execute as BOTH E,F are already computed
Answer:

Related questions

2 votes
2 votes
5 answers
1
Arjun asked Apr 22, 2018
4,044 views
A byte addressable computer has a memory capacity of $2$$^{m}$$KB$ ($k$ bytes) and can perform $2$$^{n}$ operations. An instruction involving $3$ operands and one operato...
3 votes
3 votes
4 answers
2
Arjun asked Apr 22, 2018
2,524 views
Micro program is:the name of a source program in micro computersset of microinstructions that defines the individual operations in response to a machine-language instruct...