Big Endian y Little Endian

Given is the snap shot of memory of a byte-addressable computer. What would be loaded into register $16 after execution of instruction lw $16, 24($17) if machine is big endian and when Little Endian. Register $17 contiene 200.

enter image description here

Now according to me, four bytes would be copied from the memory (224-227) irrespective of Little Endian or Big Endian,then if the machine is Big Endian then they will be copied to the register as they are.

If the machine is Little Endian then will be reversed and then copied to the register.

Please guide me if I am wrong with the concept.

preguntado el 08 de noviembre de 11 a las 12:11

Basically, you are right. I don't know mips enough, however, to know there isn't a catch. -

Big/little endianness has nothing to do with MIPS. So he's just plain right :) -

1 Respuestas

Tienes razón.

More technically, in big-endian mode, the most significant byte is the one with the lowest address, and least significant byte is the one with the highest address. In little-endian mode, the most significant byte is the one with the highest address, while the least significant byte is the one with the lowest address.

So the contents of $16 register would be

If big-endian -> BADADBBD If little-endian -> BDDBDABA

respondido 08 nov., 11:19

Yes I really confused byte order in memory and bit patterns in registers which are not related. The bit patterns in registers for the same number will be the same in both architectures. - Vladimir F

No, byte order in memory and registers is the same. - m0skit0

Just to clarify, in either case, the four bytes from 224 a 227 would be loaded in $16; if the architecture is little-endian to begin with, the numbering of OP's memory diagram would have been reversed, therefore giving us BDDBDABA en lugar de BADADBBD - Yibo Yang

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.