Member-only story
MIPS and the Little Endians — Tips and an FAQ to help ace your computer architecture class and have fun doing so!
Cool tricks I found in the MIPS architecture and the MARS Simulator! Here are some tips and tricks to learning and coding in MIPS and with the MARS Simulator, most if not all these commands and tricks will also work in other IDEs.
First, make sure to read this post before proceeding… once you finish, come back here and enjoy!
Q: Is MIPS little or big endian? What does that mean? And what about the MARS Simulator?
A: According to the Patterson and Hennessey book (Computer Organization and Design: the Hardware/Software Interface),
MIPS is in the big endian camp. Since the order matters only if you access the identical data both as a word and as four bytes, few need to be aware of the endianness.
Newer versions of the MIPS chip can support both big and little endian (bi-endian?), unlike the previous versions. Nonetheless, MIPS is classically referred to as big endian.
As for the MARS simulator, It is considered little-endian.
How to check: You can test this, in the data segment (`.data`) write:
store: .byte 0,0,0,1 #load 4 entries, each a byte long
store2: .byte 2,0,0,0 #I loaded a 2 here to avoid confusion.
and when you proceed to assemble the code, you can see how they are stored in the data segment. Pay attention to the Value+0 (0x01000000) and Value+4 (0x00000002)
Q: What are syscalls and how can I use them?
A: syscalls are a way to have the program interact with the user, it can print to the console, dialog box, and MARS can even play music with it (MIDI). In MARS, you can click Help -> Help -> and click on the syscall tab or you can view the web-version here
Q: How do I learn all the commands by-heart?
A: Start with the MIPS Green Sheet which has a concise version of most if not all the commands.
Q: The not command is a pseudo command and we cannot use it in class, how do I execute the not command without pseudocode?
A: You can use the nor command which is not pseudo… this will invert the bits!