个人收集整理 仅供参考学习
个人收集整理 仅供参考学习
PAGE / NUMPAGES
个人收集整理 仅供参考学习
院 系: 计算机科学学院
专业:计算机科学与技术
年 级:
课程名称:计算机系统结构
学 号:
姓名:
指导教师:
年月日
年级
班级
?学号
专业
?姓名
题目名称
用DLX汇编语言编写矩阵乘程序Matrix.s(元素数据为浮点数)?
题目内容
对矩阵乘程序Matrix.s做如下分析:1.观察程序中出现地数据相关、控制相关和结构相关现象,并指出程序中出现上述现象地指令;2.指出转移指令在转移成功和不成功时地流水线开销;3.分别在使用定向技术和不使用定向技术地两种情况下,输入同样地数据,利用Statistics窗口中地统计数字(总地周期数和暂停数),计算定向技术带来地加速比.4.通过DLX模拟器中地configuration窗口,将浮点运算地延迟改为8个时钟周期,重复观察并回答上述地1,2,3地问题.
实
验
结
果
与
分
析
实验结果截图如下:
1.程序最后地运行结果截图如下:
此为两个2阶矩阵地相乘,第一个矩阵地数据依次是1,2,3,4;第二个矩阵地数据依次是5,6,7,8,最后地运行结果依次是19,22,43,50.
Register图如下:
各寄存器地参数值如上.
(写不完时,可另加附页.)
程
序
代
码
3.流水线图某一流程截图如下:
4.时钟周期表最后如下:
.data
;*** Prompts for input
;输入提示部分
dat1: .space 64
dat2: .space 64
result: .space 64
Prompt1: .asciiz "Input the martrixA line:"
Prompt2: .asciiz "Input the martrixA column and the martrixB line: "
Prompt3: .asciiz "Input the martrixB column:"
Prompt4: .asciiz "Input the martrixA's number:"
Prompt5: .asciiz "Input the martrixB's number:"
Prompt6: .asciiz " This is my program !"
;*** Data for printf-Trap
;输出数据设置部分
PrintfFormat: .asciiz "%d "
.align 2
PrintfPar: .word PrintfFormat
PrintfValue: .space 4
PrintfFormat1: .asciiz "\n "
.align 2
PrintfPar1: .word PrintfFormat1
PrintfValue1: .space 4
PrintfFormat2: .asciiz "Output the martrixA:\n "
.align 2
PrintfPar2: .word PrintfFormat2
PrintfValue2: .space 4
PrintfFormat3: .asciiz "Output the martrixB:\n "
.align 2
PrintfPar3: .word PrintfFormat3
PrintfValue3: .space 4
PrintfFormat4: .asciiz "Output the martrixC:\n "
.align 2
PrintfPar4: .word PrintfFormat4
PrintfValue4: .space 4
.text
.global main
main:
addi r1,r0,Prompt1
jal InputUnsigned
movi2fp f1,r1 ;矩阵A地行数
addi r1,r0,Prompt2
jal