计算机系统结构实验报告
一、实验目的:
1、熟练掌握WinDLX模拟器的操作和使用
2、熟悉DLX指令集结构及其特点
二、实验内容:
1、用WinDLX模拟器执行求阶乘程序fact.s。这个程序说明浮点指令的使用。
该程序从标准输入读入一个整数,求其阶乘,然后将结果输出。该程序中调用了input.s 中的输入子程序,这个子程序用于读入正整数。
2、用WinDLX模拟器执行求最大公约数程序gcm.s。该程序从标准输入读入两
个整数,求他们的最大公约数,然后将结果写到标准输出。该程序中调用了input.s 中的输入子程序。
3、通过上述使用WinDLX,总结WinDLX的特点。
三、实验结果:
fact.s程序代码:
.data
Prompt: .asciiz "An integer value >1 : "
PrintfFormat: .asciiz "Factorial = %g\n\n"
.align 2
PrintfPar: .word PrintfFormat
PrintfValue: .space 8
.text
.global main
main:
;*** Read value from stdin into R1
addi r1,r0,Prompt
jal InputUnsigned
;*** init values
movi2fp f10,r1 ;R1 -> D0 D0..Count register