Question: The function F is defined as F(1) = F(2) = F(3) = 1 and for n >= 3, F(n + 1) = F(n) + (F(n
The function F is defined as F(1) = F(2) = F(3) = 1 and for n >= 3,
F(n + 1) = F(n) + (F(n - 1) * F(n - 2))
i.e., the (n + 1)th value is given by the sum of the nth value and the product of the (n - 1)th and (n - 2)th values.
a) Write an assembly program for computing the kth value F(k), where k is an integer bigger than 3 read from a memory location M, and storing F(k) at memory location M.
b) Show the execution of your program on a superscalar processor for k = 5. Assume that all the decoded instructions are already loaded into an instruction window IW on board. The remaining pipeline stages are RR, EX and WB. Assume that there are two functional units (reading and writing to registers, and execution units) for each of the pipeline stages. Make your additional as- sumptions explicit. Explain where and why delay slots appear.
Use the instruction set in the Instruction Set Architecture below:
LOAD a, b a <- b
STOR a, b a <- b
ADD a, b, c a <- b + c
SUB a, b, c a <- b - c
MUL a, b, c a <- b * c
DIV a, b, c a <- b / c
AND a, b, c a <- b & c
OR a, b, c a <- b | c
NOT a, b a <- !b
ASH a, b, c r <- b (arithmetically) shifted by c positions
LSH a, b, c a <- b (logically) shifted by c positions
BR a PC <- a
BEQ a, b, c PC <- a if b is equal to c
BNE a, b, c PC <- a if b is not equal to c
BLT a, b, c PC <- a if b is less than c
BGT a, b, c PC <- a if b is greater than c
BLE a, b, c PC <- a if b is less than or equal to c
BGE a, b, c PC <- a if b is greater than or equal to c
please make sure to use the instruction set given above.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
