The Gateway to Computer Science Excellence
+1 vote
307 views

The following program fragment was written in an assembly language for a single address computer with one accumulator register:

LOAD	B
MULT	C
STORE	T1
ADD	A
STORE	T2
MULT	T2
ADD	T1
STORE	Z

Give the arithmetic expression implemented by the fragment.

in CO and Architecture by
retagged by | 307 views
+2

[A+(B*C)]2 + (B*C)

3 Answers

+6 votes
Best answer
$Z=[BC+A]^2+(BC)$
by
selected by
0
Kindly explain also
+4 votes

$LOAD\ B : ACC \leftarrow M[B]: ACC=B$

$MULT\ C: ACC \leftarrow ACC\times M[C]:ACC=BC$

$STORE\ T1 :M[T1] \leftarrow ACC: M[T1]=BC$

$ADD\ A : ACC \leftarrow ACC+M[A]: ACC=BC+A$

$STORE\ T2 :M[T2] \leftarrow ACC: M[T2]=BC+A$

$MULT\ T2: ACC \leftarrow ACC\times M[T2]:ACC=(BC+A)^2$

$ADD\ T1 : ACC \leftarrow ACC+M[T1]:ACC=(BC+A)^2+BC$

$STORE\ Z: M[Z] \leftarrow ACC:M[Z]=(BC+A)^2+BC$


$Z=(BC+A)^2+BC$

by
0 votes
ACC <-  B

ACC <- C * ACC

M[T1] <- ACC         // T1= B*C

ACC<- A+ ACC

M[T2] <- ACC         // T2 = A+ (B+C)

ACC <- T2 * ACC

ACC <- T1+ ACC

Z<- ACC                // Z=$[A+(B*C)]^{2}$+ (B+C)
ago by

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,345 questions
60,513 answers
201,931 comments
95,357 users