Write a program to evaluate the following expression using an accumulator machine: A = B + C * D * E + F 7m jun2006

By | February 8, 2015

Write a program to evaluate the following expression using an accumulator machine: A = B + C * D * E + F     7m jun2006

 

Accumulator Architecture:

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

 

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

 

Accum_001