Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3 (45 marks) The following is an assembly language implementation of a for-loop in C. BX is used to hold the variable i. AX

image text in transcribed

Question 3 (45 marks) The following is an assembly language implementation of a for-loop in C. BX is used to hold the variable i. AX and CX somehow hold the array elements a [i] and c [i]. You will notice that there is a conditional branch ( jl ) and an unconditional jump (jmp) instruction. As far as the branch prediction algorithm is concerned, conditional and unconditional branches are treated in the same way. We assume that branch prediction is implemented in the instruction-fetch unit using a small amount of memory to hold the branch prediction buffer. Before the loop is executed, there are no entries in the branch prediction buffer so the first time when the conditional or unconditional branch is encountered, it is predicted as not-taken. (d) Under a 2-bit branch prediction scheme, fill in the following table with simulating the same implementation above: (5 marks) (e) With reference to answer of 2 bits branch prediction scheme in (d), obtain (i) The total number of jump and branch encountered (ii) The total number of incorrect predictions (either jump or branch) (iii) Misprediction rate for all predictions (iv) Misprediction rate per iteration (5 marks) In a certain program, no branch-delay slot can be filled by independent instructions, meaning that NOP instructions will be inserted to the branch delay cycles. Suppose we have a deeply pipelined processor with a fixed branch delay of two processor cycles, and an ideal CPI of 1 when no branch instruction is present in the instruction stream. A branch-target buffer with prediction is now implemented in this pipelined processor, and yields zero-cycle branch delay if there is a hit in the prediction buffer with correct prediction. However, the implementation will incur a 3-cycle penalty if the prediction is incorrect or if the target is not found in the buffer. (f) Assume that the branch prediction is correct 100% of time and 20% of the instructions are conditional branches. Calculate the minimum buffer hit ratio in order to outperform the original implementation. (15 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions