简体   繁体   English

谁能用更简单的方式解释一下?

[英]Can anyone please explain this in a easier way?

I had take up a computer organization course a year ago and now I have a follow up to it as 'Computer architecture' , I am using the 3rd edition of John Hennessy's book 'Quantitative approach to computer architecture', I went through the MIPS ISA but still need some help , can you explain this line of code in greater detail 一年前,我参加了一门计算机组织课程,现在我以“计算机体系结构”作为后续课程,我正在使用约翰·轩尼诗的第三版“计算机体系结构的定量方法”,并通过了MIPS ISA但仍然需要一些帮助,您能否更详细地解释这一行代码

Source code: 源代码:

for(i=1000; i>0; i--)
    x[i] = x[i] + s;

Assembly code: 汇编代码:

   Loop:      L.D         F0, 0(R1)          ; F0 = array element
              ADD.D       F4, F0, F2        ; add scalar
              S.D         F4, 0(R1)          ; store result
              DADDUI      R1, R1,# -8      ; decrement address pointer
              BNE         R1, R2, Loop    ; branch if R1 != R2

This is given as an example for loop unrolling to exploit ILP , I have a few doubts . 这是作为循环展开以利用ILP的示例,我对此有一些疑问。 I do get it that the array starts at Mem[0+R1] and goes backwards till Mem[R+8](as given in the text) , any reason for this or they just randomly took this location? 我确实知道该数组从Mem [0 + R1]开始,然后向后直到Mem [R + 8](如文本中所示),这是出于任何原因,或者它们只是随机地占据了这个位置?

Also why use a DADDUI (unsigned ) when we are adding a signed number (-8) ? 另外,为什么要在添加带符号的数字(-8)时使用DADDUI(无符号)?

Please give a detailed overview of this so that i can follow along the rest of the topics. 请对此进行详细概述,以便我可以遵循其余主题。 Thanks 谢谢

The memory accesses are performed to the addesses and in the order as specified by the loop in the source code. 对内存的访问是按照源代码中循环指定的顺序对地址进行的。

The daddiu instruction is sufficient to perform such address arithmetic. daddiu指令足以执行这种地址运算。 The "negative" value accomplishes subtraction in two's-complement. “负”值完成了二进制补码的减法。 Addresses are neither negative nor positive; 地址既不是消极也不是积极; they are just bit-patterns. 它们只是位模式。 Refer to an ISA reference to learn more about MIPS and instructions. 请参考ISA参考以了解有关MIPS和说明的更多信息。

The 16-bit signed immediate is added to the 64-bit value in GPR rs and the 64-bit arithmetic result is placed into GPR rt . 将16位带符号立即数添加到GPR rs中的64位值中,并将64位算术结果放入GPR rt中。 No Integer Overflow exception occurs under any circumstances. 在任何情况下都不会发生Integer Overflow异常。

The term “unsigned” in the instruction name is a misnomer; 指令名称中的“无符号”一词是不正确的; this operation is 64-bit modulo arithmetic that does not trap on overflow. 该操作是64位模运算,不会在溢出时捕获。 It is appropriate for unsigned arithmetic such as address arithmetic, or integer arithmetic environments that ignore overflow, such as C language arithmetic. 它适用于无符号算术(例如地址算术)或忽略溢出的整数算术环境(例如C语言算术)。

The example is not optimized or unrolled. 该示例未优化或展开。 It's just a literal translation of the source. 这只是来源的字面翻译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM