Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Scenario A) I was wondering if someone could work out the scenario A portion of

ID: 3540279 • Letter: #

Question

(Scenario A)

I was wondering if someone could work out the scenario A portion of this problem dealing with Expression Computation. I posted the screen shot below and on wikisend in case the image below is unclear. http://wikisend.com/download/151550/1A.png

I posted the other two scenerios as well if you are interested.


Jul 30, 2013 kid darl 3:50 Log 0 Vid CMIS CMIS 0 H 0-Add Expected Forma Valid 0-addr Add Expected Forma Valid ddr 2-Address Expected Forma Valid 2-addr 3-Add Expected Forma Valid 3-addr ssignment #6 CPU: Advanced Concepts Due date: 04-Aug-2013 1 2 3 4 5 6 7 All Instructions Question Expression Computation Modified from S gs 12.0 Tab for 4 diffe h 0 d 3- addr Tab 2 p ch of the 4 machines, using memory location T put 1.2 Tabl Sampl putati 1.1 C (A Tabl ti O Address 1 Address 2 Address 3 Address D Add 1 Address 2 Address 3 Add Mov x, Y Mov X, Y PUSH C LOAD A Mov T, A SUB T, A, B PUSH M LOAD M POP M STORE M ADD x, Y ADD X, Y, Z PUSH A SUB B SUB T, B DIV R, C, T ADD ADD M SUB X, Y SUB X, Y, Z PUSH B STORE T Mov R, C SUB SUB M MUL X, Y MUL X, Y. Z SUB LOAD C DIVR, T Tab d Z ME, Y. d for PUSH he destination operand for POP or STORE LOAD he fi d (X) is the d For 2 died he Addre g h th y be des problem, immediate dat mme d, but d imply difi f th f. Exp difying code d difficul d th prohibited By th y, the IAS studied in Chap 2 did difying code h the Address Modify instruct Table 2 f y book ither immediate int Based he di he p d f his prob d dest A, B, C, D, T R). A 2-addr SUB A, B perf 3-addr SUB A, B, C perfo Tab 3 th h of the f 4B 9A ur ma ugg ght, befo The 3-addre machine is probably movinR on to thc n gh The 0-addre probably hest. Use as many instructions as necessary to perform t put ided are sufficient ou enter legal instructio he sl Mak hat y bed. Tab each machine h h p of th ks by h. th king the "Step" but xperimen. g any progr to step through y k the PC f app sponding column Tab AC progr program counter d R, he stack (if app Check y sult R f progr memory Varia beled Tab 4. Click R he progr d oth Click f the Sc but h a diffe Mak sure A-C) y y progr pty f you do deducted f failed. fied h y pt. O get p ults, k the 'Grade Work' but Click the fi he 'Sc progr entry for any ma he bo f the p Unlike other q h individ graded, b h of the 4 prog graded k the "Grade Work" b think y king prog Table 1.3 Computation of Table 1 Stat Program Status St PC C) (D 9A 4B dy AC Scenarios: emory variable O Address 1 Address 2 Address 3 Address PC Stop Step Step I Step 1848 32 29 Addi al N All numeric values are in decimal forma t modify memory l A, B, C ded, porary ble f dified ded. d of y progr Sult is in memory he 0-addr st 2 op 10 x,-). ek befo perf g a b y op h of the 4 for perf th 11 rming h the f st p imputation Correc 12 d 18 for 3-. 2 7,9 instructions (I ge 13 0-addre 14 15 16 17 18 19 20

Explanation / Answer

For 0-address architecture:


push 4

push b

mul

push c

sub

push d

push 9

push a

mul

add

pop t

push t

push t

push t

mul

mul

div

pop r


P.S: All letters in capital





For 1-address architecture :


LOAD 4

MUL B

SUB C

STORE R

LOAD 9

MUL A

ADD D

STORE T

LOAD T

MUL T

MUL T

STORE T

LOAD R

DIV T

STORE R


For 2-address architecture :


MOV T,4

MUL T,B

SUB T, C

MOV R,9

MUL R,A

ADD R,D

DIV T,R

MUL R,R

DIV T,R

MOV R,T


For 3-address architecture :


MUL T,4,B

SUB T,T,C

MUL R,9,A

ADD R,D,R

DIV T,T,R

MUL R,R,R

DIV R,T,R