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?
Asked
Active
Viewed 198 times
0
-
Real MIPS processors can be configured as either big or little endian. – markgz Jan 16 '14 at 23:03
-
using xspim its becomes big endian or little endian depending on the machine – user3175173 Jan 17 '14 at 02:27
1 Answers
2
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

Konrad Lindenbach
- 4,911
- 1
- 26
- 28