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

No Description


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

Replies to This Discussion

Cs501 question no 1 solution

#cs501assignment1solution2020
cs501 Assignment 1 SOLUTION Spring 2020 complete correct solved

Watch video and solve CS501 Assignment 1 Complete Solution Spring 2020,CS501 Assignment 1 Complete Solution,CS501 Assignment 1,CS501,CS501 assignment 1 solution,CS501 assignment spring 2020,CS501 assignment solution spring 2020,CS501 assignment, assignment 1 CS501 solution, solution CS501 assignment 1, Cs501 assignment 1 solution 2020,Cs501 assignment solution 2020,Cs501 assignment 1,Cs501 assignment 1 solution spring 2020,Cs501 assignment no 1 solution spring 2020,Cs501 assignment no 1 solution 2020,Cs501 1st assignment solution 2020,Cs501 1st assignment solution,Cs501 1st assignment solution spring 2020,assignment solution spring 2020,CS501 Assignment 1 Complete Solution Spring 2020,CS501 Assignment 1 Complete Solution,CS501 Assignment 1,CS501,CS501 assignment 1 solution,CS501 assignment spring 2020,CS501 assignment solution spring 2020,CS501 assignment, assignment 1 CS501 solution, solution CS501 assignment 1

#cs501assignment1solution2020

#CS501AssignmentNo1Spring2020 #CS501 #CS501assignment1
CS 501 Assignment No 1 Solution Spring 2020 | Virtual University |

CS 501 Assignment No 1 Solution Spring 2020 Virtual University of Pakistan

Question 1:
Write assembly code for 2-address and 3-address machines to evaluate the given expression: z = x 2 - 3xy + 2(x/y) + y 2
Note: x, y and z are memory locations.

Question 2:
For the above given expression, calculate the time required to execute the code for 2-address and 3-address machines by considering the following parameters:

Machine Type Average CPI Processor Frequency
2-address 3 200 MHz
3-address 5 250 MHz

#CS501AssignmentNo1Spring2020
#CS501
#CS501assignment1
#FASTScienceAcademy
#FASTAcademy
#FASTIAN
#This_is_for_you

CS501 ASSIGNMENT NO 1 SPRING 2020
CS 501 ASSIGNMENT NO1
CS 501 ASSIGNMENT 1 SOLUTION SPRING 2020
CS 501 ASSIGNMENT 1 SOLUTION
CS 501 ASSIGNMENT SOLUTION
VIRTUAL UNIVERSITY OF PAKISTAN
VU OF PAKISTAN

CS501 Advance Computer Architecture Assignment 1 Solution & Discussion Spring 2020


Solution Idea CS501:

Question No - 1                                                                    12 marks

Write assembly code for 2-address and 3-address machines to evaluate the given expression:

z = x2 - 3xy + 2(x/y) + y2

Note: x, y and z are memory locations

 

 

Solution:

3-Address

2-Address

mul a, x, x

load z, x

mul b, x, y

mul z, x

mul c, b, 3

load a, x

sub d, a, c

mul a, y

div r, x, y

mul a, 3

mul s, r, 2

sub z, a

add t d, s

load c, x

mul e, y, y

div c, y

add z, t, e

mul c, 2

 

add z, c

 

load d, y

 

mul d, y

 

add z, d

   

 

 

Question No - 2                                                              8 marks

For the above given expression, calculate the time required to execute the code for 2-address and 3-address machines by considering the following parameters:

 

SOLUTION:

 

 

Machine Type

 

 

 

 

Average CPI

Processor Frequency

Clock Period

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2-address

 

 

 

 

3

 

200 MHz

5ns

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3-address

 

 

 

 

5

 

250 MHz

4ns

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

When Program execute on 2-address machine:

 

 

Instruction count (IC) = 13.0

 

 

 

 

 

 

 

 

Clock Per Instruction (CPI)

= 3

 

 

 

 

 

 

Clock Period (T)

=

 

 

 

1/(200*106) = 0.000000005 = 5 ns

 

 

 

Execution time (ET)

= ?

 

 

 

 

 

 

 

 

 

 

 

We Know that

 

ET

=

IC*CPI*T

 

=

13*3*5

ET

=

195 ns

This means that address-2 will take 195 ns to execute program.

 

When Program execute on 3-address machine:

Instruction count (IC) = 9.0

Clock Per Instruction (CPI)

= 5

 

Clock Period (T)

=

 

1/(250*106) = 0.000000004 = 4 ns

Execution time (ET)

= ?

 

 

 

We Know that

 

 

 

 

 

ET

=

IC*CPI*T

 

=

9 * 5

* 4

 

ET

=

180 ns

 

This means that address-3 machine will take 180 ns to execute program.

RSS

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

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

.