Computer Science, asked by 8851598303, 1 year ago

A machine uses evaluation stack

architecture. Write a program for

evaluation of the following expression :

A=B*(C+D)*E

MCS-012 1​

Answers

Answered by vaishaligrace2
2

Answer:

An accumulator is a specially designated register that supplies one instruction operand and receives the result. The instructions in such machines are normally one-address instructions. The popular architectures were IBM 7090, DEC PDP-8 etc.

Accumulator Architecture: Pros and Cons

Implicit use of accumulator saves instruction bits.

Result is ready for immediate reuse, but has to be saved in memory.

More memory accesses required than stack.

 

Consider a program to do the expression:

A = B + C * D * E + F

Explanation:

Programs    Comments

LOAD C Load C in AC

MULT D Multiply D in AC  (i.e C * D)

MULT E Multiply E in AC  (i.e C * D * E)

ADD B Add B in AC (i.e B + C * D * E)

ADD F Add F in AC (i.e B + C * D * E +F)

STORE A Store Result in A

                 Comments  

LOAD C Load C in AC

MULT D Multiply D in AC  (i.e C * D)

MULT E Multiply E in AC  (i.e C * D * E)

ADD B Add B in AC (i.e B + C * D * E)

ADD F Add F in AC (i.e B + C * D * E +F)

STORE A Store Result in A

Attachments:
Similar questions