Assembly 使用IAS指令集的矩阵乘法
我必须使用IAS指令集编写一个程序,将两个2*2矩阵相乘,并将结果存储在另一个矩阵C中。我看到另一个人发布了一个用于矩阵加法的程序:Assembly 使用IAS指令集的矩阵乘法,assembly,ias,Assembly,Ias,我必须使用IAS指令集编写一个程序,将两个2*2矩阵相乘,并将结果存储在另一个矩阵C中。我看到另一个人发布了一个用于矩阵加法的程序: ********************** * Initialize a variable 'count' to 999 Label: TOP 00000001 LOAD M(A[count]) Transfer M(A[count]) to the accumulator 00000101 ADD M(B[count])
**********************
* Initialize a variable 'count' to 999
Label: TOP
00000001 LOAD M(A[count]) Transfer M(A[count]) to the accumulator
00000101 ADD M(B[count]) Add M(B[count]) to AC and store result in AC
00100001 STOR M(C[count]) Transfer contents of accumulator to memory location C[count]
00001010 LOAD M(address of count) Transfer the contents of M(address of count) to the AC
00000110 SUB M(the number 1) Subtract one from AC and store in AC
00100001 STOR M(D) Transfer contents of AC to location M(D)
00001111 JUMP+ M(X,0:19) If number in accumulator is non-negative take next
instruction from left half of M(X)
**************************
如何将变量“count”初始化为999?答案:IAS没有立即数,但假设内存中的某个地方已经有了正确的常量,就像假设内存中有程序一样 黑客: 可以使用其他未使用的位,例如
L
或AC?!你为什么要为这种架构编写程序?
LEFT and RIGHT instructions 1 and 2 at Selector 0: 20 xxxx 20 1998
L / R instructions 3 and 4 at Selector 1: 20 xxxx 20 999
Left instruction 5: LOAD AC <- S(0)
Right instruction 6: AC -= S(1)