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.

Please carefully read the following instructions before attempting assignment.

 

Rules for Marking

It should be clear that your assignment would not get any credit if:

 

  • The assignment is submitted after the due date.
  • The submitted assignment does not open or file is corrupt.
  • Strict action will be taken if submitted solution is copied from any other student or from the internet.

 

 

1)      You should concern recommended books to clarify your concepts as handouts are not sufficient.

2)      You are supposed to submit your assignment in .doc format. Any other formats like scan images, PDF, zip, rar, bmp etc will not be accepted.

 

 

Note: 

 

No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date.

 

For any query, feel free to email at:

cs501@vu.edu.pk

 

 

 

 

Question No. 1                                                                                                                 10 Marks

Write assembly language instructions to execute the following expression on 0-address and 3-address machines.

F = A + (B × C / D) – E

 

 

 

 

Question No. 2                                                                                                                  10 Marks

A compiler designer is trying to decide between two code sequences for a particular machine. The hardware designers have supplied the following facts:

 

 

Instruction Class

CPI required for each class

A

2

B

3

C

2

 

 

The compiler designer intends to write two code sequences to achieve a task. Both code sequences are required the following instruction count.

 

 

Code Sequence

Instruction Count for each sequence

A

B

C

1

10

5

8

2

6

4

9

 

 

a)      Which code sequence will execute faster? Justify your answer on the basis of CPU clock cycles calculations.

                                          

b)     What is the CPI for each code sequence?

+ 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: 9123

.

+ 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

Question#01

F=A+(BXC/D)-E

Solution:

O-address:

Push C
Push D
Mul
Push B
Div
Push A
Add
Push E
Sub
Pop F

3-address:

Div F: C: D
Mul F: F: B
Add F: F: A
Sub F: F: E
Pop F

Question 2

CPU Clock Cycle 01 (for each time of instruction) = 1ox2 + 5x3 + 8x2 Q
=20+ 15+ 16:51
CPU Clock Cycle 02 = 6x2 + 4x3 + 9x2
=12+12+18=42
Thus: in this CPU cycle Sequence 02 will execute faster.
a) What is the CPI for each code sequence?
For Code Sequence 01:
Clock cycle for each type of instructiw»
Instruction count (1%
CPI= clock cycle for each type of instruction 1 IC
V CPI= 51/23
x p ' CPI = 2.217
For Code Sequence 02: 4
Clock cycle f each type of instruction = 42
Ins ct1 unt (IC) = 19
CPI= clock cycle for each type of instruction / IC
CPI = 2.210

Solution File is up loaded

0-Address

3-Address

Push C

Div x, C, D

Push D

Mul y, B, x

Div

Add z, A, y

Push B

Sub F, z, E

Mul

 

Push A

 

Add

 

Push E

 

Sub

 

Pop F

 

 

a)      Which code sequence will execute faster? Justify your answer on the basis of CPU clock cycles calculations.

 

Solution:

 

CPU clock cycles for sequence 1         =

 

                                                             = (10 x 2) + (5 x 3) + (8 x 2)

                                     = 20 + 15 + 16

                                                             = 51 clock cycles

 

CPU clock cycles for sequence 2         =

 

                                                              = (6 x 2) + (4 x 3) + (9 x 2)

                                                              = 12 + 12 + 18

                                                              =   42 clock cycles              

 

Since sequence 2 takes lesser clock cycles therefore sequence 2 is faster as compared to sequence 1.

a)      What is the CPI for each code sequence?

 

Solution:

 

As we know that

Therefore,

CPI for code sequence 1         = 51/23

                                                                                    = 2.21 CPI

 

                                    CPI for code sequence 2         = 42/19

                                                                                    = 2.21 CPI      

RSS

Today Top Members 

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

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

.