Some data formats like integers, floating number use more than a byte for representation purpose. The CPU needs to assign addresses to 8-bit memory locations and these values must be stored in more than one locations.
There are two commonly used organizations for multibyte data.
1) Big endian format
In this format, the most significant byte of a value is stored in location L, the following byte in location L+1 and so on for next bytes.
Suppose we need to store 32 bits value 0x12345678 in the memory of a computer. Then data organization will look like as given below:
2) Little endian format
In this format, the least significant byte is stored in location L, the next byte in location L+1, and so on. Using the same example as we have used in big endian, data organization will look like as given below:
As long as the CPU is designed to handle a specific format, neither is better than the other.
However, the data needs to be converted if it is transferred between machines using different multi-byte data format.
There are two commonly used organizations for multibyte data.
1) Big endian format
In this format, the most significant byte of a value is stored in location L, the following byte in location L+1 and so on for next bytes.
Suppose we need to store 32 bits value 0x12345678 in the memory of a computer. Then data organization will look like as given below:
Memory Address
|
Data (in hex)
|
300
|
12
|
301
|
34
|
302
|
56
|
303
|
78
|
2) Little endian format
In this format, the least significant byte is stored in location L, the next byte in location L+1, and so on. Using the same example as we have used in big endian, data organization will look like as given below:
Memory Address
|
Data(in hex)
|
400
|
78
|
401
|
56
|
402
|
34
|
403
|
12
|
As long as the CPU is designed to handle a specific format, neither is better than the other.
However, the data needs to be converted if it is transferred between machines using different multi-byte data format.
No comments:
Post a Comment