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
contains 200
.
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.
You're right.
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