edited by
7,080 views
13 votes
13 votes

In $\text{X = (M + N }\times \text{O)/(P} \times \text{Q})$, how many one-address instructions are required to evaluate it?

  1. $4$
  2. $6$
  3. $8$
  4. $10$
edited by

5 Answers

Best answer
38 votes
38 votes

Accumulator CPU is example of One Address Instruction:

In Acc. CPU first alu operand is always required in the accumulator but second alu operand can be in the register or memory because of the the availability of the one address along with the opcode.

Load and Store is One address Instruction

X= (M + N x O)/(P x Q)

I1: Load P : ACC<--M[P]                      //Load the P value from memory  to ACCUMULATOR

I2: Mul Q: ACC<--ACC*M[Q]           //Second alu operand is in memory and destination is Register

I3: Store T: M[T]<--ACC                   //Store the Value in memory

I4: Load N : ACC<--M[N]                 

I5: Mul O :  ACC<--ACC*M[O]

I6: Add M:  ACC<--ACC+M[M]

I7: Div T:    ACC<--ACC/M[T]

I8: Store X: M[X]<--ACC                //Finally store in value in memory

TOTAL 8 1 ADDRESS INSTRUCTION  REQUIRED.

edited by
5 votes
5 votes
1. LDA P ; AC<----M[P]

2. MUL Q ; AC<----AC*M[Q]

3. STA Y ; M[Y]<----AC

4. LDA N ; AC<----M[N]

5. MUL O ; AC<----AC*M[O]

6. ADD M ; AC<----AC+M[M]

7. DIV Y ; AC<----AC/M[Y]

8. STA X ; M[X]<----AC

Hence it will require minimum 8 instructions to evaluate....
4 votes
4 votes

Is this answer Correct? pls correct if any mistakes
 Zero Address

  1. PUSH P
  2. PUSH Q
  3. MUL
  4. PUSH O
  5. PUSH N
  6. MUL
  7. PUSH M
  8. ADD
  9. DIV
  10. POP X

One Address

  1. LOAD P
  2. MUL Q
  3. STORE T
  4. LOAD O
  5. MUL N
  6. ADD M
  7. DIV T
  8. STORE X

Two Address

  1. MOV R1,N
  2. MUL R1,0
  3. ADD R1 ,M
  4. MOV R2,Q
  5. MUL R2,P
  6. DIV R1,R2
  7. MOC X,R1

Three Address

  1. ADD R1,P,Q
  2. MUL R2,N,O
  3. ADD R2,R2,M
  4. DIV X,R2,R1
edited by
2 votes
2 votes
Answer should be 6

1. Load O in accumulator(acc)

2. Multiply N to acc

3. Add M to acc

4. Divide acc by P

5. Divide acc by Q

6. Store acc to X

All arithmatic operation's results are stored in acc itself.
Answer:

Related questions

24 votes
24 votes
6 answers
1
Kathleen asked Sep 22, 2014
17,587 views
How many $32K \times 1$ RAM chips are needed to provide a memory capacity of $ 256K$ bytes?$8$$32$$64$$128$
7 votes
7 votes
3 answers
2
ajit asked Oct 12, 2015
6,805 views
The minimum time delay between the initiation of two independent memory operations is calledAccess timeCycle timeRotational timeLatency time
4 votes
4 votes
5 answers
3
kvkumar asked May 17, 2016
10,208 views
The contents of the flag register after execution of the following program by $8085$ microprocessor will be$\textbf{Program}$$\textsf{SUB A}$$\textsf{MVI B,(01)}_\textsf{...
19 votes
19 votes
2 answers
4
go_editor asked Jun 21, 2016
7,218 views
Consider the following code fragmentvoid foo(int x, int y) { x+=y; y+=x; } main() { int x=5.5; foo(x,x); }What is the final value of $\textsf{x}$ in both call by value an...