We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

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.

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 3117

.

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

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

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

See the attached file 

Attachments:

3-address machine

2-address machine

1-address machine

0-address machine

Sub    x,b,c

Sub   Y,d,45

Mul    r,y,15

Add   A,x,r

Load     x,b

Sub       x,c

Load     r,b

Sub       r,45

Mul       r,15

Add      x,r

Store     x.A

Ida             d

Sub a         45

Mul a         15

St a             r

Id a            b

Sub a         c

St a            a

Push            d

Push            45

Sub

Push            15

Mul

Push             b

Push             c

Sub

Pop               A

0-address k last m add bh to aye ga q k expression m last m addition krhy hn???

or kia A B C jo expression m hen usko code m capital m likh skty hn??

sub x,B,C.....???? is it right?

plz koi guide krdyen.

Advanced Computer Architecture (CS501)
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
ANSWER:
Assume that you have addition (ADD), subtraction (SUB), multiplication (MPY), and data movement (MOV, LOAD, STORE, PUSH, and POP) instructions available to you in each of the relevant types of machines. Recall that an n-address machine will specify n operand addresses in the instruction. So, a 3-address machine has instructions like ADD X, Y, Z. This instruction will perform M[X] ← M[Y] + M[Z]. In words, this takes the content of the memory location specified by the address Y, adds it to the content of the memory location specified by the address Z, and places the result in the memory location specified by the address X. Also, keep in mind that 1-address machines use an accumulator to hold one source operand and the destination operand, and 0- address machines use a stack to store both source operands and destination operands. Finally, you may assume that a memory location can be both a source and a destination.
The table below shows the four programs that are needed to answer this question.

3-Address Machine 2-Address Machine 1-Address Machine 0-Address
Sub x,b,c
Sub y,d,45
Mul r,y,15
Add A,x,r Load x,b
Sub x,c
Load r,d
Sub r,45
Mul r,15
Add x,r
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.
Answer:
Make sure that you understand that all instructions are in memory and must be fetched from memory. Also, make sure that you understand that all data values are in memory and must be fetched from memory. So, an instruction like SUB A, B, C requires 1 byte for the opcode, 3 bytes for address A, 3 bytes for address B, and 3 bytes for address C for a total of 10 bytes just to represent the instruction. These 10 bytes must be fetched from memory in order to bring the instruction into the processor for decoding and execution. The data at each address (A, B, and C) in memory is 3 bytes each. So, fetching the SUB A, B, C instruction requires reading 10 bytes from memory. During execution you must read 3 bytes for B, read 3 bytes for C, and then write 3 bytes for A. So, you have a total of 19 bytes that must go to or from memory to fetch and execute this one instruction. The same thought process applied to the other instructions as well.
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 traffic is 11 bytes. The LOAD B instruction requires 1 byte for opcode and 3 bytes for address B. Fetching and executing LOAD B requires 7 bytes of memory traffic. An instruction like SUB only requires 1 bytes of memory traffic because all data operations are performed internal to the computer using the internal stack. So,
The total memory traffic is:
3-Address Machine: ( ) bytes
2-Address Machine: () bytes
1-Address Machine: () bytes
0-Address Machine: () bytes

CS501 Assignment#1 Complete Solution 

Attachments:

2nd question ka answer bta dyn.?

2nd question ka solution bthn

sth yh explanation likhne hy

CS501 Complete solution with detail from handouts.

https://youtu.be/bj0zB_PyLOY

Attachments:

RSS

Latest Activity

afaq posted a discussion
3 hours ago
+ ! ! ! ! ! ! ! ! ! ! dReAm gIrL replied to Zain Kazimi's discussion Self Poetry Dedicated to Nasir Kazimi
3 hours ago
Zain Kazimi posted a discussion
4 hours ago
Azhar Sagar replied to Azhar Sagar's discussion use case diagrams of 4 projects
4 hours ago
+ ! ! ! ! ! ! ! ! STUDENTs +++ liked ♦_"Tooba"_♦'s discussion QUIZ NO 1
4 hours ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion EDU401 Current Mid Term Papers Fall 2019 (14 to 26 December 2019) & All Solved Past Papers, Solved MCQs & Helping Material in the group EDU401 Contemporary Issues and Trends in Education
4 hours ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion EDU401 Current Mid Term Papers Fall 2019 (14 to 26 December 2019) & All Solved Past Papers, Solved MCQs & Helping Material
4 hours ago
+ M.Tariq Malik's 17 discussions were featured
4 hours ago
+ M.Tariq Malik added a discussion to the group EDU401 Contemporary Issues and Trends in Education
4 hours ago
+ M.Tariq Malik liked Zari's discussion cs502 important topics for mid
4 hours ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion EDU305 Current Mid Term Papers Fall 2019 (14 to 26 December 2019) & All Solved Past Papers, Solved MCQs & Helping Material in the group EDU305 Classroom Management
4 hours ago
Isha Chuhdary and Areeha Chuhdary are now friends
4 hours ago

Today Top Members 

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.