MIPS XSPIM 不同的字节顺序混乱 [英] MIPS XSPIM different endianess order confusion
问题描述
作为第一次使用 MIPS 的我似乎很困惑.我有一个同学说那里XSPIM是大端.但是,在 Linux 中它是小端字节序.如果 MIPS 可以是小端或大端.有没有办法在 XSPIM 中找出它在您的机器中是按小端还是大端运行?
As a first time MIPS user I seem to be confused. I have some classmate who have said that there XSPIM is big endian. However, in Linux it is little endian byte order. If MIPS can be little endian or big-endian. Is there a way to find out in XSPIM if it runs as little endian or big endian in your machine?
推荐答案
SPIM 采用运行它的机器的字节序.(http://www.dsi.unive.it/~arcb/LAB/spim.htm#Byte%20Order)
SPIM adopts the endian-ness of the machine on which it runs. (http://www.dsi.unive.it/~arcb/LAB/spim.htm#Byte%20Order)
这是一个检查机器字节序的小程序:
Here's a little program to check the endian-ness of your machine:
.data
word: .word 1
bigStr: .asciiz "Big Endian\n"
littleStr: .asciiz "Little Endian\n"
.text
main:
la $t0 word
lb $t1 0($t0)
beqz $t1 bigEndian
littleEndian:
la $a0 littleStr
addi $v0 $zero 4
syscall
jr $ra
bigEndian:
la $a0 bigStr
addi $v0 $zero 4
syscall
jr $ra
这篇关于MIPS XSPIM 不同的字节顺序混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!