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

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: 3109

.

+ 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

any one have idea about it?

i just viewed the assignment let me study it.
can you have the reference book for this subject. not handouts

no i have only handouts i am also studying.if you complete it first then please share

Well Handouts page no. 36 study karo :-D

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>

 

Note:-

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

Or visit this link 

Click Here For Detail.

&

.•°How to Download past papers from study groups°•.

 

Please Click on the below link to see…

.... How to Find Your Subject Study Group & Join .... 

 

P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

Dear Admin can you provide ebook for this subject not handouts 

QUESTION#1

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
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#01 Solution 

See the attached file 

CS501 Assignment#01 Solution 

See the attached file 

Attachments:

thanks M.Tariq Bhai.

kia is m explanation bh dyni zaror hy ya phr direct code bh dy skty hn?

2nd q smajh nahi aa raha please explain

RSS

Latest Activity

Sheraz Ali posted a discussion
21 minutes ago
Imran Khan replied to +¢αяєℓєѕѕ gιяℓ's discussion CS506 - Web Design and Development Assignment No.1 Due Date Nov 15, 2019 in the group CS506 Web Design and Development
1 hour ago
Imran Khan joined + M.Tariq Malik's group
1 hour ago
+ ! ! ! ! Mehαr Mαh꧂ liked + M.Tariq Malik's discussion PSC401 Final Term Papers Spring 2019 (24 August ~ 04 September 2019) & All Solved Past Papers, Solved MCQs & Helping Material
1 hour ago
Hamza Hameed replied to + M.Tariq Malik's discussion CS611 Software Quality Engineering Assignment No 01 Fall 2019 Solution & Discussion Due Date: 15-11-2019 in the group CS611 Software Quality Engineering
2 hours ago
+Umar Amin+ replied to + M.Tariq Malik's discussion Criteria Required for Award Badges, Featured Members & Moderators
2 hours ago
+ !! SARAH replied to MIT's discussion Operating Systems(CS604) Assignment # 01 Deadline Date 16-11-2019 in the group CS604 Operating Systems
2 hours ago
+ !! SARAH joined + M.Tariq Malik's group
2 hours ago
November 2019 replied to + M.Tariq Malik's discussion CS401 Assignment No 01 Fall 2019 Solution & Discussion in the group CS401 Computer Architecture and Assembly Language Programming
3 hours ago
Hamza Hameed updated their profile
3 hours ago
Profile IconHamza Hameed, +.Ãŋɠɜʆḁ.+ and Aijaz khan joined + M.Tariq Malik's group
3 hours ago
Profile IconHamza Hameed and Purple Work joined + M.Tariq Malik's group
3 hours ago
Hamza Hameed joined + M.Tariq Malik's group
3 hours ago
Hamza Hameed joined + M.Tariq Malik's group
3 hours ago
Arham Shah replied to + M.Tariq Malik's discussion CS401 Assignment No 01 Fall 2019 Solution & Discussion in the group CS401 Computer Architecture and Assembly Language Programming
3 hours ago
Arham Shah joined + M.Tariq Malik's group
3 hours ago
khurram us salam replied to + M.Tariq Malik's discussion MGT402 Cost & Management Accounting Online Quiz No 01 Fall 2019 Solution Discussion in the group MGT402 Cost & Management Accounting
3 hours ago
khurram us salam joined + M.Tariq Malik's group
3 hours ago
+ ! ! ! ! ! ! ! ! ! AG liked + ! ! ! ! ! MySterIouS's blog post + Beginning +
3 hours ago
+ ! ! ! ! ! ! ! ! ! AG liked Mani Siddiqui BS VIII's discussion Kash Main Doure Payamber
3 hours ago

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

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