大端和小端
给出的是字节寻址计算机的内存快照。如果机器是大端字节序,而机器是小端字节序,则执行lw $16, 24($17)
指令后将加载到寄存器$16
中的内容。寄存器 $17
包含 200
。
现在根据我的说法,将从内存中复制四个字节 (224-227)< /code> 无论是 Little Endian 还是 Big Endian,如果机器是 Big Endian,那么它们将按原样复制到寄存器中。
如果机器是Little Endian则将反转然后复制到寄存器。
如果我的概念有误,请指导我。
Given is the snap shot of memory of a byte-addressable computer. What would be loaded into register $16
after execution of instruction lw $16, 24($17)
if machine is big endian and when Little Endian. Register $17
contains 200
.
Now according to me, four bytes would be copied from the memory (224-227)
irrespective of Little Endian or Big Endian,then if the machine is Big Endian then they will be copied to the register as they are.
If the machine is Little Endian then will be reversed and then copied to the register.
Please guide me if I am wrong with the concept.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你说得对。
从技术上讲,在大端模式下,最高有效字节是具有最低地址的字节,而最低有效字节是具有最高地址的字节。在小端模式下,最高有效字节是具有最高地址的字节,而最低有效字节是具有最低地址的字节。
因此 $16 寄存器的内容将是
If big-endian ->巴达DBBD
如果是小尾数 ->苯并二苯并对二苯甲酸
You're right.
More technically, in big-endian mode, the most significant byte is the one with the lowest address, and least significant byte is the one with the highest address. In little-endian mode, the most significant byte is the one with the highest address, while the least significant byte is the one with the lowest address.
So the contents of $16 register would be
If big-endian -> BADADBBD
If little-endian -> BDDBDABA