开发者

placing words in memory

开发者 https://www.devze.com 2022-12-19 00:07 出处:网络
I\'m using pcspim simulator and my processor is anIntel x86 (little endian) As I understand, the declaration.word -5 sho开发者_开发百科uld place in memory the

I'm using pcspim simulator and my processor is an Intel x86 (little endian)

As I understand, the declaration .word -5 sho开发者_开发百科uld 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


The spim docs say:

SPIM’s byte order is the same as the byte order of the underlying machine that runs the simulator.

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:

fb ff ff ff ff ff ff ff
ef cd ab 89 67 45 23 01

By word:

fffffffffffffffb
0123456789abcdef

The other possibility is that your build of pcspim is actually simulating a big-endian processor.

0

精彩评论

暂无评论...
验证码 换一张
取 消