MIPS and ARM differences

Mail picture Mail · Nov 2, 2014 · Viewed 24.5k times · Source

I just started learning architecture and I have some confusions between MIPS and ARM architectures.

I came to know that the MIPS predominantly has two instruction formats: I and R (J as well). I read about these representation formats, rs, rt, opcode and related stuff. I also had a look at COA book of Patterson (Edition-IV) which focuses on ARM ISA. The instruction representation is different in that edition. Are these differences due to the varying architectures? And the ARM assembly code is slightly varying with the book I used with MIPS ISA.

eg. Patterson' edition IV says

LDR r5,[r3,#32]
STR r1,[r4,#48]

while the other MIPS one I read says

lw r5,[r3,#32]
sw r1,[r4,#48]

Is the difference due to the ISA they follow or they are two different versions of the same ISA? Could you also explain the key differences between MIPS and ARM?

Answer

old_timer picture old_timer · Nov 2, 2014

Yes lw and sw are load and store word for mips. ldr and str are load and store a word for arm. and for x86 you use mov.

Mips typically has a syntax that uses $0-$31 or the even more disgusting $v0, etc. Arm and many others use r and a number r0-rn, (some folks are trying to uglify that as well with alias names).

ARM and MIPS are competitors, they are not the same company not the same architectures. MIPS machine encoding falls into the few categories you mentioned, ARM has many for whatever reason good or bad, these are both well documented in the MIPS or ARM documentation.

So as far as instruction encoding that is determined by the inventors of the instruction set for whatever reasons they choose, good, bad, or otherwise, it is their thing they can do what they want.

AS far as the assembly language syntax, the isa inventor generally creates one to go along with the documentation for the instruction set and they typically create or hire someone to make an assembler. But the assembler (the software that takes the assembly language and makes machine code from it) authors ultimately dictate the assembly language syntax, and they dont have to conform to the syntax in the isa documentation. And there is no reason for any two separately created assemblers to use the same syntax. Over time for example hex numbers had a dollar sign $12 or a trailing h 12h, but now you often see C syntax supported or preferred 0x12. Sometimes you see indirect plus an offset as 12(r3) or [r3,#12] or to describe the exact same thing.