This assignment must be submitted, as a PIC assembly file, to the Moodle submission page for Homework 8 by 11:00 PM on Thursday, 1 November.
Problem 1 and only
In Lab 8 you wrote a small PIC program to work on the Syracuse problem for 16-bit integers. Your task for this homework assignment is to extend that solution to 32-bit integers.
Here’s a few things you will need to get started.
- You will need to increase the space allocated for
xfrom 2 bytes to 4 bytes.
- In the lab you used one register,
x. This time you will need to use a two registers for
x. I suggest
In the, you used the following code to initialize
.equ initX,2012 MOV #initX,W0 MOV WREG,xBecause the initial value of
xis now 32-bits, you will need to do something different. I suggest the following:
.equ initX,7527 MOV #(initX&0xFFFF),W0 MOV WREG,x MOV #(initX>>16),W0 MOV WREG,x+2
Once you’ve made those changes, the task isn’t that
hard. Find the places in your lab program where your tested,
added, and shifted
Replace those few instructions with 32-bit versions as found
in Chapter 5.
It’s not that hard.
There were about six instructions testing and modifying
in the 16-bit version. Each will be doubled in the 32-bit version.
However, don’t wait too long to get started.
Some test cases