We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

# www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

CS501 Assignment No 01 Solution & Discussion Due Date: 09-11-2017

Questions No 01 Marks (12)
Write the code/instructions to implement the expression A = (B – C) + 15(D - 45) on 3, 2, 1, and 0-address machines.

Questions No 02 Marks (08)
Compute the total memory traffic in bytes for both instruction fetch and instruction execution for the code that implements the expression evaluation for the four machines in question # 1.

Note:
Assume opcodes occupy one byte, addresses occupy three bytes, and data values also occupy three bytes. Don’t mix it with code size of instruction.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Views: 3172

Attachments:

### Replies to This Discussion

BC150401472

ARSLAN

Assignment no 1:

Due date: 9 Nov 2017:

Q-1)

Solution:

 3-Address Machine 2-Address Machine 1-Address Machine 0-Address Machine Subtract x,b,c   Subtract y,d,45   Multiply r,y,15   Add A,x,r Load x,b   Subtract x,c   Load r,d   Subtract r,45   Multiply r,15   Add x,r   Store x,A Load d   Subtract 45   Multiply 15   Store r   Load b   Subtract c   Store a Push d   Push 45   Subtract   Push 15   Multiply   Push b   Push c   Subtract   Pop A

Q-2)

Solution:

0-Address Machine = 45 bytes                  (instruction fetch=27, instruction execution=18)

1-Address Machine = 49 bytes                  (instruction fetch=28, instruction execution=21)

2-Address Machine = 91 bytes                  (instruction fetch=49, instruction execution=42)

3-Address Machine = 76 bytes                  (instruction fetch=40, instruction execution=36)

Mя Hөиєү  thanks for sharing Note for All Members: You don’t need to go any other site for this assignment/GDB/Online Quiz solution, Because All discussed data of our members in this discussion are going from here to other sites. You can judge this at other sites yourself. So don’t waste your precious time with different links.

total memory traffic is

Assignment # 01
VU ID: MC160400478
QUESTION#1
Write the code/instructions to implement the expression A = (B – C) + 15(D - 45) on 3, 2, 1, and 0-address machines

.

Sub x,b,c
Sub y,d,45
Mul r,y,15
Sub x,c
Sub r,45
Mul r,15
Store x,A
ida d
suba 45
mula 15
sta r
Ida b
suba c
Sta a Push d
Push 45
Sub
Push 15
Mul
Push b
Push c
Sub
Pop A

QUESTION NO. 2
Compute the total memory traffic in bytes for both instruction fetch and instruction execution for the code that implements the expression evaluation for the four machines in question # 1.

Note:
Assume opcodes occupy one byte, addresses occupy three bytes, and data values also occupy three bytes. Don’t mix it with code size of instruction.
For example
Load x, b, b requires 7 bytes to represent the instruction (1 byte for the opcode, 3 bytes for address x, and 3 bytes for address b). Fetching and executing requires reading 7 bytes of instruction, reading 3 bytes for B, and then writing 3 bytes for into x.
The total memory traffic is:

CS501 Assignment#01 Solution

Attachments:

how to solve question#2?

1-address=if execution 18, then how fetch 27 ?

0-address=how 28fetch, 21 exe........why not 32fetch, 24exe?? what term to eliminate ??

koi plz ya bta do capital letter us kr skty hn ya nh...A = (B – C) + 15(D - 45)
is expression ki instruction ma..eg sub A,B,C like this..is it right???
plz fast

jo expression hai wohi use kro means capital

One mistake in zero address correct it, you all miss Add before pop A ??

2nd question ma bot confusion ho ri koi 2nd ka correct ans ya do ka procedure bata do kasy karna

## HELP SUPPORT

This is a member-supported website. Your contribution is greatly appreciated!

.