This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:cs:chapter_3_11 [2025/05/15 09:20] – [Integers] ktokarz | en:multiasm:cs:chapter_3_11 [2026/01/10 20:18] (current) – pczekalski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Fundamentals of Data Encoding, Big Endian, Little Endian ====== | ====== Fundamentals of Data Encoding, Big Endian, Little Endian ====== | ||
| - | The processor can work with different types of data. These include integers of different sizes, floating point numbers, | + | The processor can work with different types of data. These include integers of different sizes, floating-point numbers, |
| ===== Integers ===== | ===== Integers ===== | ||
| - | Integer data types can be 8, 16, 32 or 64 bits long. If the encoded number is unsigned, it is stored in binary representation, | + | Integer data types can be 8, 16, 32 or 64 bits long. If the encoded number is unsigned, it is stored in binary representation, |
| - | In two's complement representation, | + | In two's complement representation, |
| <table binarynumbers> | <table binarynumbers> | ||
| < | < | ||
| Line 20: | Line 20: | ||
| ===== Floating point ===== | ===== Floating point ===== | ||
| - | Integer calculations do not always cover all mathematical requirements of the algorithm. To represent real numbers the floating point encoding is used. A floating point is the representation of the value //A// which is composed of three fields: | + | Integer calculations do not always cover all mathematical requirements of the algorithm. To represent real numbers, the floating-point encoding is used. A floating point is the representation of the value //A//, which is composed of three fields: |
| * Sign bit | * Sign bit | ||
| * Exponent (E) | * Exponent (E) | ||
| Line 27: | Line 27: | ||
| {{ : | {{ : | ||
| - | There are two main types of real numbers, called floating point values. Single precision is the number which is encoded in 32 bits. Double | + | There are two main types of real numbers, called floating-point values. Single precision is a number which is encoded in 32 bits. A double-precision floating-point number is encoded with 64 bits. They are presented in Fig{{ref> |
| <figure realtypes> | <figure realtypes> | ||
| - | {{ : | + | {{ : |
| - | < | + | < |
| </ | </ | ||
| Line 43: | Line 43: | ||
| </ | </ | ||
| - | The most common representation for real numbers on computers is standardised in the document IEEE Standard 754. There are two modifications | + | The most common representation for real numbers on computers is standardised in the document IEEE Standard 754. Two features have been implemented |
| - | * The Biased exponent | + | * the Biased exponent, |
| - | * The Normalised Mantissa | + | * the Normalised Mantissa. |
| - | Biased | + | A biased |
| The normalised mantissa is adjusted to have only one bit of the value " | The normalised mantissa is adjusted to have only one bit of the value " | ||
| Line 52: | Line 52: | ||
| ===== Texts ===== | ===== Texts ===== | ||
| - | Texts are represented as a series of characters. In modern operating systems, texts are encoded using two-byte Unicode which is capable of encoding not only 26 basic letters but also language-specific characters of many different languages. In simpler computers like in embedded systems, 8-bit ASCII codes are often used. Every byte of the text representation in the memory contains a single ASCII code of the character. It is quite common in assembler programs to use the zero value (NULL) as the end character of the string, similar to the C/C++ null-terminated string convention. | + | Texts are represented as a series of characters. In modern operating systems, texts are encoded using two-byte Unicode, which is capable of encoding not only 26 basic letters but also language-specific characters of many different languages. In simpler computers, like in embedded systems, 8-bit ASCII codes are often used. Every byte of the text representation in the memory contains a single ASCII code of the character. It is quite common in assembler programs to use the zero value (NULL) as the end character of the string, similar to the C/C++ null-terminated string convention. |
| ===== Endianness ===== | ===== Endianness ===== | ||
| - | Data encoded in memory must be compatible with the processor. Memory chips are usually organised as a sequence of bytes, which means that every byte can be individually addressed. For processors of the class higher than 8-bit, there appears | + | Data encoded in memory must be compatible with the processor. Memory chips are usually organised as a sequence of bytes, which means that every byte can be individually addressed. For processors of the class higher than 8-bit, there appears |
| - Little Endian - low-order byte is stored at a lower address in the memory. | - Little Endian - low-order byte is stored at a lower address in the memory. | ||
| - | - Big Endian - high-order byte is stored at a lower address in the memory. | + | - Big Endian - the high-order byte is stored at a lower address in the memory. |
| These two methods for a 32-bit class processor are shown in Fig{{ref> | These two methods for a 32-bit class processor are shown in Fig{{ref> | ||