edited by
10,811 views
14 14 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$

6 Answers

Best answer
44 44 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
6 6 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
5 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....
2 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.
0 0 votes
All operations are performed with an implied accumulator register. The instruction format in this type of computer uses one address field. For example, the instruction that specifies an arithmetic addition is defined by an assembly language instruction as ADD.
Given instruction is
Instruction-1: Load the value “M” into accumulator
Instruction-2:Add the “N” value to M and store result into accumulator register
Instruction-3:Multiply “O” with the accumulator register value and store in to accumulator register
instruction-4: Store that result into Memory
Instruction-5:Load/store the value “P” into accumulator register
instruction-6:Multiply “Q” with the accumulator register value and store in to accumulator
instruction-7:Divide the memory value with the accumulator register value and store in to accumulator
Instruction-8: Store the accumulator value in the memory location.
0 0 votes

in one address instruction , we must explictly mention one address field and other field could be from accumulator. ( in accumulator we do not store address rather we store actual data value)


LOAD ACC,N ( we are moving N which is an explicit address to the accumulator)

MUL ACC,O ( since we have stored the value of N in the acc we can perform one address instruction operation, AFTER performing the operation we are storing it in the acc)

ADD ACC,M

STORE T1,acc(we are storing the result in the memory field)

now denominator 

LOAD ACC,P

MUL ACC Q

DIV [T1]/acc( here we are dividing the contents of the T1 with the acc, in the acc we have the value of denominator)

STORE [X]

 

Answer:
Position:
Show:

Related questions

35 35 votes
7 answers 7 answers
25.8k
25.8k views
Kathleen asked Sep 22, 2014
25,813 views
How many $32K \times 1$ RAM chips are needed to provide a memory capacity of $ 256K$ bytes?$8$$32$$64$$128$
6 6 votes
3 answers 3 answers
8.1k
8.1k views
ajit asked Oct 12, 2015
8,095 views
The minimum time delay between the initiation of two independent memory operations is calledAccess timeCycle timeRotational timeLatency time
4 4 votes
5 answers 5 answers
13.3k
13.3k views
kvkumar asked May 17, 2016
13,268 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{...
20 20 votes
2 answers 2 answers
9.1k
9.1k views
go_editor asked Jun 21, 2016
9,082 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...