Docsity

Midterm Paper - Computer Architecture Principles | CDA 5155, Exams of Electrical and Electronics Engineering

Toggle sidebar
bg1
1
CDA 5155 Computer Architecture Principles
Midterm – Fall 2007
October 23, 2007
Name
Sample Midterm with Solutions
UFID
On my honor, I have neither given nor received unauthorized aid on this examination.
Signature: ______________________________
1. This is a 110 minutes (100 marks), closed-book/notes exam. You are allowed to bring hand-written
note on one side of a US letter size paper, and a scientific calculator.
2. This exam contains seven pages (including this one) and nine questions.
3. Write all answers on the white space provided below the question. In case you require more space use
the last page (page 8) or extra pages and clearly write the question number for which you are answering.
If you use extra pages for answering your questions, please do not forget to attach them.
4. Grading will be based on what you explicitly stated in your answers. Please try to be as clear and precise
as possible. You MUST show the solution steps that lead to the final answer.
5. Try to answer all the questions since partial credit will be given for correct approach.
6. Make reasonable assumptions when you think the question is not providing all necessary details. Points
will be deducted if you make an assumption to simplify the problem when the information is directly
available or can be derived from the information provided.
7. Hints are not answers. Ignore them if you think that they are not helpful.
Grading
:
Problem
1 2 3 4 5 6 7 8 9 Total
Points 7 8 26
9 14
5 17
3 11
100
Received
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Midterm Paper - Computer Architecture Principles | CDA 5155 and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

CDA 5155 Computer Architecture Principles

Midterm – Fall 2007

October 23, 2007

Name Sample Midterm with Solutions

UFID

On my honor, I have neither given nor received unauthorized aid on this examination.

Signature: ______________________________

  1. This is a 110 minutes (100 marks) , closed-book/notes exam. You are allowed to bring hand-written note on one side of a US letter size paper, and a scientific calculator.
  2. This exam contains seven pages (including this one) and nine questions.
  3. Write all answers on the white space provided below the question. In case you require more space use the last page (page 8) or extra pages and clearly write the question number for which you are answering. If you use extra pages for answering your questions, please do not forget to attach them.
  4. Grading will be based on what you explicitly stated in your answers. Please try to be as clear and precise as possible. You MUST show the solution steps that lead to the final answer.
  5. Try to answer all the questions since partial credit will be given for correct approach.
  6. Make reasonable assumptions when you think the question is not providing all necessary details. Points will be deducted if you make an assumption to simplify the problem when the information is directly available or can be derived from the information provided.
  7. Hints are not answers. Ignore them if you think that they are not helpful.

Grading:

Problem 1 2 3 4 5 6 7 8 9 Total Points 7 8 26 9 14 5 17 3 11 100 Received

1. Introduction Indicate True/False for the following comments. No explanation is required.

i. [1 pt] The relationship of design and verification complexity growth is linear (X-axis is design complexity, and Y-axis is verification complexity).

True

ii. [1 pt] The loss due to delayed market entry of a product in linearly related to the time delay in entering the market.

False

iii. [1 pt] Adding more designers reduces the design development time.

False / True

iv. [1 pt] Design and verification complexity is increasing exponentially over time.

True

v. [1 pt] Number of application-specific (embedded) processors in the market today is smaller than the number of general-purpose (desktop) processors.

False

vi. [1 pt] The latency improvement rate is almost identical to the bandwidth improvement rate.

False

vii. [1 pt] Power = Energy x Time

False

2. Measuring and Reporting Performance

i. [5 pts] Suppose a program runs in 100 seconds on an enhanced machine. The enhanced machine uses a new multiplier that is 4 times faster compared to the multiplier in the original machine. The multiplication operations take 40 seconds in the enhanced machine (i.e., 40% of the overall time in the enhanced machine). Show how Amdhal’s law (directly or indirectly) can be used to compute the execution time of the program in the original machine?

For original machine: Execution Time of Non-enhanced part is same as the enhanced machine: (100-40)=60 seconds; For multiplier part, it is 4 times slower: Execution Time of multiplier: 4*40=160 seconds;

Total Execution Tile of the program in the original machine: 60+160=220 seconds

iii. [2 pts] What are the hexadecimal values of all misaligned 2-byte data that can be read from the given 32-bit word when stored in big-endian byte order?

ONE 34 56

iv. [2 pts] What are the hexadecimal values of all misaligned 2-byte data that can be read from the given 32-bit word when stored in little-endian byte order?

ONE 56 34

c) An architecture supports 64 registers, and immediate values between 0 and 1023. Assume that the architecture has 32-bit instruction encoding where destination is always register, and both source1 and source2 can be either register or immediate values.

i. [2 pts] What is the maximum number of operation (opcodes) supported by this architecture?

Dest  64 registers  6 bits Src1  10 bits or 6 bits + 1 bit for identification  11 bits Src2  11 bits 16 opcodes (4 bits left)

ii. [2 pts] Suggest a reasonable modification with minimal impact (respects all the constraints in some manner) to this architecture to increase the number of operations (opcodes).

Src1 supports immediate value up to 6 bits Dest  6 bits Src1  6 + 1 bits Src2  11 bits

iii. [2 pts] What would be the maximum number of operations (opcodes) under your suggested modification?

256 opcodes (8 bits)

d) [4 pts] Complete the entries of the table by choosing only one of the three symbols (S1, S2 or S3). Each column should have exactly one S1, one S2 and one S3 symbol. Each entry represents how good or bad an architecture is in terms of the corresponding feature. For example, register-register architecture is good (S1) from code generation point of view.

S1 implies good, simple, small or no variation, S2 implies moderate, S3 implies bad, complex, or large variation

Architecture Type Code Size^ Instruction Encoding^ # of cycles / instruction^ Code Generation Memory-memory S1 S3 S3 S Register-register S3 S1 S1 S Register-memory S2 S2 S2 S

e) [2+1 pts] What are the characteristics of an orthogonal instruction-set design and who benefits from it?

Independence of  Register  Addressing Mode  Operations

Any one of it can use any combination of the other …..

Compiler benefits from it since it easier to generate efficient code.

4. Pipeline Exceptions

i. [3 pts] Define precise and imprecise exceptions.

Precise exceptions: Exceptions are maintained in correct program order i.e., when an exception occur all instructions before the exception-causing instruction will be allowed to complete and all the ones behind (including this one) will be killed from the pipeline.

Imprecise exceptions: When exceptions are not handled in program order e.g., out-of-order exceptions.

ii. [4 pts] Discuss one advantage and one disadvantage for precise and imprecise exceptions.

Advantage: precise – Correct program order

Disadvantage: precise – Costly (low performance), out-of-order execution is not possible.

Advantage: imprecise – Higher performance

Disadvantage: imprecise – May lead to incorrect output/behavior during out-of-order execution.

iii. [2 pts] Suggest one hardware technique to address the disadvantage of the imprecise exception.

Out-of-order exceptions can be handled using in-order graduation/completion buffer (ROB) and exceptions are serviced only during completion.

6. Limits of Instruction-Level Parallelism Assume a perfect (ideal) processor with infinite buffers for storing instructions, infinite registers for storing

values as well as perfect register renaming, infinite issue, perfect caches, perfect branch/jump predictors, and perfect memory alias analysis.

i) [1 pt] What is the best possible ILP that can be achieved using SPEC benchmarks on this perfect processor? In other words, suggest an upper bound such as infinite, 5000, 500, 50 etc.

150

ii) [2+2 pts] Explain your answer for the previous question using quantitative (based on practical considerations such as number of comparisons/computations) as well as qualitative reasons (such as program behavior considerations). For example, if you answered 5000, explain why ILP can not be ‘infinite’ (or vice versa) using both quantitative and qualitative reasons.

Quantitative Infinite issue buffer  requires O(n^2) comparisons to just detect any RAW dependency before issuing i.e. it is not possible to do so many comparisons in a clock cycle for issuing one instruction. So the problem of issuing infinite instructions is out of question.

Qualitative RAW is a property of the program. There is no way we can eliminate it which limits the number of instructions that can be issued simultaneously.

7. Branches and Predictors

i. [3 pts] Branch-target buffers (BTB) are used in decode stage (2 cycle penalty if the branch is in buffer and mispredicted; 2 cycle penalty if it is not in buffer and taken; 0 penalty otherwise). Determine the total branch penalty for a BTB based on following observations: a. Prediction accuracy is 80% for the instructions in the buffer. b. Hit rate in the buffer is 90% for branches predicted taken.

Probability (branch in buffer, but actually not taken)=0.90.2=0.18; Probability (branch not in buffer, but actually taken)=0. Penalty=(0.18+0.1)2=0.**

ii. [4 pts] Consider a simple processor with 4 stages: fetch, decode, execute and writeback. Assume that the branch frequencies (as percentages of all instructions) are as follows: conditional branches 20%, and unconditional branches 5%. Furthermore assume that 70% of the conditional branches are taken. Moreover, assume that the unconditional branches are resolved at the decode stage and the conditional branches are resolved at the execute stage. Compute the percentage of pipeline speedup loss due to control hazards.

Control flow type frequency Stalls Conditional (taken) 20%70=14% 2 Conditional (not taken) 20%30%=6% 1 unconditional 5% 1 Pipeline stalls=15%+214%+16%=0. Pipeline speedup=4(1/1.39)=2. Loss=(4-2.88)/4=28%*

iii. [10 pts] Assume a (2,2) correlated branch predictor is used to predict the branch outcomes of the following nested loop for both branches to control i and j loops. Assume that the initial state for all 2-bit predictors of all 4 possible correlations are “weakly-taken” (counter value = 2) and the initial state for the 2-bit correlation is “not-taken” and “not-taken”. Note that, two separate predictors are used for the branches to control i and j loops. Simulate the branch predictions using (2,2) predictors and complete the following entries. for (i=1; i<3; i++) // assume a single branch is used to convert this “for” loop for (j=1; j<3; j++) // assume a single branch is used to convert this “for” loop a[i,j] = b[i,j] + c[i,j]

Iteration i=1^ i=1,j=1^ i=1,j=2^ i=1,j=3^ i=2^ i=2,j=1^ i=2,j=2^ i=2,j=3^ i= Correlation NT-NT NT-NT NT-NT NT-NT NT-T T-NT NT-NT NT-NT NT-T Counter 2 2 1 0 1 1 0 0 0 Outcome NT NT NT T NT NT NT T T Predict T T NT NT T T NT NT NT

There are other possible solutions based on assumptions.

8. [3 pts] Dynamic Scheduling Complete the following table by entering only T (for Tomasulo) or S (for Scoreboard) when that particular dynamic scheduling algorithm is most suitable for the processor architecture. No data forwarding S Best possible performance T Memory references can’t be resolved statically (^) T Small number of programmer-visible registers (^) T Least possible area (transistors) S Too many parallel functional units **T

  1. Itanium (IA-64) Architecture** i. [2+2 pts] What is predication and when/how is it useful?

Converting control dependency to data dependency if A else B 

x= cond x: A x’: B

Since reduces control dependency, ILP increases, branch/penalty reduced