将单词放入记忆中
我正在使用 pcspim 模拟器,我的处理器是 Intel x86(小端)
据我了解,声明 .word -5 应该将 以下字节 1111 1011 1111 1111 1111 1111 1111 1111(小端)。但是模拟器 pcspim 以大端顺序将该单词放入内存中 意思是:1111 1111 1111 1111 1111 1111 1111 1011。 谁能解释一下这个? 预先感谢,
xyoavx
I'm using pcspim simulator and my processor is an Intel x86 (little endian)
As I understand, the declaration .word -5 should place in memory the
following bytes
1111 1011 1111 1111 1111 1111 1111 1111 (little endian). But the simulator
pcspim places this word in memory in a big-endian order it
means: 1111 1111 1111 1111 1111 1111 1111 1011.
Who can explain this ?
Thanks in advance,
xyoavx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
spim 文档 说:
所以你是对的,字节顺序在你的机器上应该是小尾数。您确定正在查看字节顺序视图吗?如果您一次查看内存中的一个字,那么您正在查看的视图通常会混合字节。例如:
按字节:
按字:
另一种可能性是您构建的 pcspim 实际上是在模拟大端处理器。
The spim docs say:
So you're right, the byte order should be little endian on your machine. Are you sure you're looking at a byte ordered view? If you're looking at the memory word-at-a-time, the view you're looking at usually swizzles the bytes around. For example:
By byte:
By word:
The other possibility is that your build of pcspim is actually simulating a big-endian processor.