Advance Computer Architecture (CS501) Total marks = 20
Assignment # 01 Deadline Date
Spring 2020 1st June 2020
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.
You should consult the recommended books to clarify your concepts as handouts are not sufficient.
You are supposed to submit your assignment in .doc or docx format.
Any other formats like scan images, PDF, zip, rar, ppt and bmp etc will not be accepted.
Objective:
Objective of this assignment is to increase the learning capabilities of the students about
Classification of Instruction Set Architecture for different machines
Performance Measurement of a processor
Comparison of Processors’ performance
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.
If you find any mistake or confusion in assignment (Question statement), please consult with your
instructor before the deadline. After the deadline no queries will be entertained in this regard.
For any query, feel free to email at:
[email protected]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:
Clock Period
Machine Type Average CPI Processor Frequency
5ns
2-address 3 200 MHz
4ns
3-address 5 250 MHz
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.