Question: You will be designing an assembly program running on MSP430 hardware using the IAR Kickstart IDE tool, a free tool for IAR for programming MSP430.

You will be designing an assembly program running on MSP430 hardware using the IAR Kickstart IDE tool, a free tool for IAR for programming MSP430.

Assume that R4 stores multiplicand, R5 stores multiplier, and R6 stores the product.

1.Fill in the assembly code to right shift the multiplier one bit.

___________ ; clear the carry bit

_________ ______ ; right rotate the multiplier

2.Fill in the assembly code to implement if the LSB of the multiplier is one, add the multiplicand to the product. Assume the LSB of the multiplier is stored in the carry bit. The if_a and endif_a are labels. Should you have more decision structures, you would use labels ended by _b, _c, etc.

_____ _______ ; skip if the carry is not set

if_a:

_______ ____ , ______ ; add multiplicand to product

endif_a:

Check

3.Fill in the assembly code to left shift the multiplicand one bit

__________ ; clear the carry bit

_________ ______ ; left rotate the multiplicand

4.The decision block in Figure 1 requires to check when the computation is done. If we perform multiplication on two one-byte operands, the product will require two bytes. So to fit to the MSP430 registers, we assume the multiplicand and multiplier contain one-byte data. Based on the algorithm, the shift-add operation should repeat 8 times, one for each bit in the multiplier. This essentially requires a counting mechanism. In this lab, however, we will use another register R7 to do the counting. Here is the idea. We first set R7 to the binary 10000000 and right shift one bit at each iteration. Then all we need to do is check when the 1 reaches to the LSB. At that time, the loop should be terminated. Fill in the partial code follows.

____ _____, ___ ; set R7 to the binary 10000000

loop: ; loop begins here

.

. ; loop body

.

_______ _____ ; right rotate the counter R7

________ _____ ; loop if the LSB of R7

; is still 0

check

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!