Computer Science, asked by somila80, 7 months ago

Create a data definition for a doubleword that stored it in memory in big endian format.

Answers

Answered by yugbafna33
0

Answer:

Any integer that is a multiple of 4 looks like 4*N for some N.

How can you multiply by four in binary? By shifting left 2 positions. So a multiple of 4 looks like some N shifted left two positions. So the low order two bits of a multiple of 4 are both 0.

0x000AE430 Yes.

0x00014432 No.

0x000B0737 No.

0x0E0D8844 Yes.

Big Endian and Little Endian

Big Endian and Little Endian

A load word or store word instruction uses only one memory address. The lowest address of the four bytes is used for the address of a block of four contiguous bytes.

How is a 32-bit pattern held in the four bytes of memory? There are 32 bits in the four bytes and 32 bits in the pattern, but a choice has to be made about which byte of memory gets what part of the pattern. There are two ways that computers commonly do this:

Big Endian Byte Order: The most significant byte (the "big end") of the data is placed at the byte with the lowest address. The rest of the data is placed in order in the next three bytes in memory.

Little Endian Byte Order: The least significant byte (the "little end") of the data is placed at the byte with the lowest address. The rest of the data is placed in order in the next three bytes in memory.

In these definitions, the data, a 32-bit pattern, is regarded as a 32-bit unsigned integer. The "most significant" byte is the one for the largest powers of two: 231, ..., 224. The "least significant" byte is the one for the smallest powers of two: 27, ..., 20.

For example, say that the 32-bit pattern 0x12345678 is stored at address 0x00400000. The most significant byte is 0x12; the least significant is 0x78.

Within a byte the order of the bits is the same for all computers (no matter how the bytes themselves are arranged).

Answered by ravilaccs
0

Answer:

The instruction is generated for the given problem.

Explanation:

  • Different processors store multibyte integers in different orders in memory.
  • There are two popular methods of storing integers: big endian and little indian.
  • Big endian method is the most natural:
  • the biggest (i.e. most significant) byte is stored first, then the next biggest, etc.
  • IBM mainframes, most RISC processors and Motorola processors all use this big endian method.
  • However, Intel-based processors use the little endian method, in which the least significant byte is stored first.
  • Normally, the programmer does not need to worry about which format is used, unless
  • Binary data is transferred between different computers e.g. over a network.
  • All TCP/IP headers store integers in big endian format (called network byte order.)
  • Binary data is written out to memory as a multibyte integer and then read back as individual bytes or vise versa.
  • Endianness does not apply to the order of array elements.

Little Endian

  • x86 processors store and retrieve data from memory using little endian order (low to high). The least significant byte is stored at the first memory address allocated for the data. The remaining bytes are  stored in the next consecutive memory positions. Consider the doubleword 12345678h. If placed in memory at offset 0000, 78h would be stored in the first byte, 56h would be stored in the second byte, and  the remaining bytes would be at offsets 0002 and 0003, as shown in Figure
  • Some other computer systems use big endian order (high to low). The following Figure shows an  example of 12345678h stored in big endian order at offset 0
Attachments:
Similar questions