共计 1928 个字符,预计需要花费 5 分钟才能阅读完成。
CCPS310 – COMPUTER ORGANIZATION II
LAB 1
ARC, ARC ASSEMBLY, ARC SIMULATOR
Submission instruction: Due Feb 12th @23:00hr
Students may work in groups of 2, and are expected to do the lab together.
Submit solutions in one text file on Brightspace.
Evaluation :Correct completion of the following four programs.
Note: CS Labs: Arc Simulator program is located in the shared drive with path
‘Program Files\ArcTools\ArcTools’. OR Install on your computer from zip file on
brightspace.
!n: The ArcTool requires an added empty line at the bottom of the code to
assemble
PART 1:
- Please add comment for each line.
a. Explain what the program intends to do.
b. Assemble the code by hand. - Run the program through the simulator
- What is the content of %r4 after this program is executed?
! Program 1
! Hint: op3 for subcc is 010100
.begin
.org 2048
dstart .equ 4000
ld [a], %r1
ld [b], %r2
ld , %r3
addcc %r2, %r3, %r0
addcc %r1, %r0, %r4
subcc %r2, %r4, %r2
st %r0, [a]
st %r2, [y]
jmpl %r15 + 4, %r0
.org dstart
a: 15
b: 54
c: -29
y: 0
.end
PART 2: - Please add comment for each line.
a. Explain what the program intends to do.
b. Assemble the code by hand. - Run the program through the simulator
- What is the content of %r3 after this program is executed?
! Program 2
.begin
.org 2048
m_start: ld [x], %r1
ld [y], %r2
subcc %r1, %r2, %r0
bne else
andcc %r1, %r2, %r3
ba done
else: orcc %r1, %r2, %r3
done: st %r3, [a]
jmpl %r15+4, %r0
x: 30
y: 48
a: 0
.end
PART 3: - Please add comment for each line.
a. Explain what the program intends to do.
b. Assemble the code by hand. - Run the program through the simulator
- What is the content of %r1 after this program is executed?
! Program 3
.begin
.org 2048
main: ld [x], %r2
top: subcc %r1, 4, %r0
be done
srl %r2, 1, %r2
addcc %r1, 1, %r1
ba top
done: st %r3, [y]
jmpl %r15+4, %r0
.org 3000
x: 800
y: 0
.end
PART 4: - Please add comment for each line.
a. Explain what the program intends to do.
b. Assemble the code by hand. - Run the program through the simulator
- What is the content of %r4 after this program is executed?
! Program 4
.begin
.org 2048
main: ld [a], %r1
ld [b], %r2
ld , %r3
top: subcc %r4, 3, %r0
be done
subcc %r5, %r6, %r0
bneg else
orcc %r1, %r2, %r1
addcc %r6, 1, %r6
ba bottom
else: andcc %r1, %r3, %r1
addcc %r5, 1, %r5
bottom: addcc %r4, 1, %r4
ba top
done: st %r3, [y]
jmpl %r15+4, %r0
.org 3000
a: 0xa0
b: 0x33
c: 0x52
y: 2
WX:codehelp
正文完