www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS501 Assignment No 01 Spring 2020 Solution & Discussion

No Description

Views: 838

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

#CS501AssignmentNo1Spring2020
#CS501
#CS501assignment1
#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.

1

2

3

4

5

## Latest Activity

Hina Tahir added a discussion to the group HRM627 Human Resource Development

### GDB: HRM627- Human Resource Development

5 hours ago
12 hours ago
Famia Khan joined + M.Tariq Malik's group

### CS506 Web Design and Development

12 hours ago
Famia Khan added a discussion to the group CS614 Data Warehousing

### cs614 Assigment no1 fall 2021

12 hours ago
Famia Khan joined + M.Tariq Malik's group

### CS614 Data Warehousing

12 hours ago
jamil sadiq joined + M.Tariq Malik's group

### ENG503 Introduction to English Language Teaching

12 hours ago
Famia Khan and Hania Khalid Shariff are now friends
12 hours ago
Ehrish Gul updated their profile
15 hours ago