These questions are to aid you in your studies. They are not to be turned in and they do not cover all the topics covered in class after Problem Set 5.
DOIT STW R1, R6, #0 ADD R6, R6, #1 AND R3, R1, R2 BRz EVEN ADD R1, R1, #3 ADD R5, R5, #-1 BRp DOIT EVEN ADD R1, R1, #1 ADD R7, R7, #-1 BRp DOIT
"Fetch" takes 1 cycle, "Decode" takes 1 cycle, "Execute" stage takes
variable number of cycles depending on the type of instruction (see below), and "Store Result" stage takes
1 cycle.
All execution units (including the load/store unit) are fully pipelined and the following instructions that
use these units take the indicated number of cycles:
STW: 3 cycles
ADD: 3 cycles
AND: 2 cycles
BR : 1 cycle
For example, the execution of an ADD instruction followed by a BR would look like:
ADD F | D | E1 | E2 | E3 | ST BR F | D | - | - | E1 | ST TARGET F | D
This figure shows several things about the structure of the pipeline:
Also, you are given the following information about the pipeline and the ISA:
Answer the following questions:
a) How many cycles does the loop above take to execute if no branch prediction is used?
b) Suppose that a static BTFN (backward taken-forward not taken) branch prediction scheme is used to predict branches.
i. How many cycles does the above loop take to execute with this scheme?
ii. What is the branch prediction accuracy?
iii. What is the prediction accuracy for each branch?
c) Suppose that two-bit saturating up/down counters (as discussed in lecture) are used for branch prediction. Each branch instruction has its own counter. The counters are initialized to '10' state. Top bit of the counter is used as the prediction. Hence, the first time a branch is seen it will be predicted taken.
i. How many cycles does the above loop take to execute if two-bit counters are used for branch prediction?
ii. What is the branch prediction accuracy?
iii. What is the prediction accuracy for each branch?
The following binary floating-point number consists of a sign bit, an excess 63, radix 2 exponent, and a 16-bit fraction. Express the value of this number as a decimal number.
0 0111111 0000001111111111
To add two floating point numbers, you must adjust the exponents (by shifting the fraction) to make them the same. Then you can add the fractions and normalize the result, if need be. Add the single precision IEEE floating-point numbers 3EE00000H and 3D800000H and express the normalized result in hexadecimal. ['H' is a notation indicating these numbers are in hexadecimal]
The Tightwad Computer Company has decided to come out with a machine having 16-bit floating-point numbers. The model 0.001 has a floating-point format with a sign bit, 7-bit, excess 63 exponent and 8-bit fraction. Model 0.002 has a sign bit, 5-bit, excess 15 exponent and a 10-bit fraction. Both use radix 2 exponentiation. What are the smallest and largest positive normalized numbers on both models? About how many decimal digits of precision does each have? Would you buy either one?
a*x^6 + b*x^5 + c*x^4 + d*x^3 + e*x^2 + f*x + g