VUsolutions Transferred to AchiKhasi.com

From December 2011, this blog www.VUsolutions.blogspot.com is transferred to http://achikhasi.com/vu/ . So, you may visit http://achikhasi.com/vu/ for latest study related help.

Back to home VUsolutions

VUsolutions Fans Club [join us for MORE solutions]

VUsolutions on Facebook

CS501 Assignment No. 1 Fall 2011 Solution

Friday, October 28, 2011 Posted In Edit This
Assignment No. 01
Semester Fall 2011
Advance Computer Architecture - CS501
Total Marks: 20

Due Date: 31/10/2011

Question No 1 Marks: 5+5+5+5 = 20  

Write the code to implement the expression A = (B+C) * (D + E) for 

1) 3-address instructions
2) 2-address instructions
3) 1-address instructions
4) 0-address instructions

In accordance with programming language practice, computing the expression should not change the values of its operands.




Question # 3
Evaluate the expression a=(c+4)*15-b for the 3, 2, 1, and 0-address machines

Solution
3-address
2-address
1-address
0-address
Add a,c,4
mpy a,a,15
sub a,a,b

Load a,c
Add a,4
Mpy a,15
Sub a,b
Lda c
Add 4
Mpy 15
Sub b
Sta a
Push c
Push 4
Add
Push 15
Mpy
Push b
Sub
Pop a 

3-ADDRESS
INSTRUCTIONS

2-ADDRESS
INSTRUCTIONS

1-ADDRESS
INSTRUCTIONS

0-ADDRESS
INSTRUCTIONS

add x,b,c
load y,b

ida d
push d
add y,d,e

add y,c

adda e
push e
mul a,x,y
load r,d

sta s
add

add r, e
ida b
push b

mul y,r
adda c
push c

store a,y
mula s
add


sta z
mul



pop a

Back to home VUsolutions

Shaadi.com: Just create ur account & find ur partner or EARN money, its reall & EASY

VUsolutions Followers (Join NOW and Get Extra Benefits)

Install LATEST toolbar having lot of features - GET solutions on Desktop

toolbar powered by Conduit
Caliplus 300x250 NoFlam VitoLiv 468x60 GlucoLo