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.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

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

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?


+ 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)


Views: 9143

Attachments:

Replies to This Discussion

                  Question 2 (b)

     Answer:

          CPI = clock cycle for each type of instruction / IC

Code Sequence 1

                       
                Clock cycle for each type of instruction = 51

                  Instruction count (IC) = 10+5+8 =23

                CPI= 51/23 

                    = 2.217 

       

Code Sequence 2

 

                         

   
                Clock cycle for each type of instruction = 42

                  Instruction count (IC) = 6+4+9  =19

                CPI= 42/19

                    = 2.210

Q=1 IDEA FOR SOLUTION

DEAR FRIENDS YE ADDRESSING MODE KA METHOD HE

Q=1 IDEA SOLUTION FOR  Write assembly language instructions  

Identify the addressing modes of the following instructions:

  1. a.      ldr R1, 14
  1. ld R3, 6(R2)
  2. Stop
  3. str R7, 32
  4. addi R3, R4, 25
  5. nop
  6. ori R2, R4, 56
  7. lar R3, 48

Answer:

  1. a.            Relative addressing mode
  2. b.            Displacement addressing mode
  3. c.             None
  4. d.            Register relative addressing mode
  5. e.             Immediate addressing mode
  6. f.              None
  7. g.            Immediate addressing mode
  8. h.            Register relative addressing mode

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

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

0 Address

push B

push C

mul

push D

div

push A

Add

Push E

sub

pop F

Kya ye thek hai????? kindly tel me

3_ Address..............

mul F,B,C

div F,F,D

Add F,F,A

Sub F,F,E

cs 501 Assignment...... ideal solution

Attachments:

Question 2 (b)
Answer:
CPI = clock cycle for each type of instruction / IC

Code Sequence 1

Clock cycle for each type of instruction = 51
Instruction count (IC) = 10+5+8 =23
CPI= 51/23 
= 2.217 

Code Sequence 2



Clock cycle for each type of instruction = 42
Instruction count (IC) = 6+4+9 =19
CPI= 42/19

3 addressing instruction

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

A = r1, B = r2, C = r3, D = r4, E = r5, F = r6

mul r6, r2, r3
div r6, r6, r4
add r6, r6, r1
sub r6, r6, r5

brother i have a question that the percedance of the divide is high so that it is nt possible to do divide first and then multiple. in mahematics we use DMAS rule in which divide comes first , plz give me suggestion regarding to my question bcoz discussion is the best of study

kia 1st quest ma phly div ni krn gy?

on 3 address mode

3-address 

div F,C,D

mult F,F,B

Add F,F,A

Sub F,F,E

  any one guid me for this me solv it in this way

RSS

Looking For Something? Search Here

HELP SUPPORT

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

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

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

.