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.

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!