Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:multiasm:cs:chapter_3_11 [2025/05/15 06:20] – [Integers] ktokarzen:multiasm:cs:chapter_3_11 [2025/12/12 11:24] (current) ktokarz
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, texts, structures and even single bits. All these data are stored in the memory as a single byte or multiple bytes. +The processor can work with different types of data. These include integers of different sizes, floating point numbers, texts, structures and even single bits. All this data is stored in the memory as a single byte or multiple bytes. 
  
 ===== 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, while if the value is signed, the representation is two's complement. A natural binary number starts with aero if it contains all bits equal to zero. While it contains all bits equal to one, the value can be calculated with the expression {{ :en:multiasm:cs:equation_binary.png?200 |}}, where n is the number of bits in a number. +Integer data types can be 8, 16, 32 or 64 bits long. If the encoded number is unsigned, it is stored in binary representation, while if the value is signed, the representation is two's complement. A natural binary number range starts with zero. In such a case, it contains all bits equal to zero. While it contains all bits equal to one, the value can be calculated with the expression {{ :en:multiasm:cs:equation_binary.png?200 |}}, where n is the number of bits in a number. 
  
-In two's complement representation, the most significant bit (MSB) represents the sign of the number. Zero means a non-negative numberone represents a negative value. The table {{ref>binarynumbers}} shows the integer data types with their ranges.+In two's complement representation, the most significant bit (MSB) represents the sign of the number. Zero means a non-negative numberone represents a negative value. The table {{ref>binarynumbers}} shows the integer data types with their ranges.
 <table binarynumbers> <table binarynumbers>
 <caption> Integer binary numbers</caption> <caption> Integer binary numbers</caption>
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 numbersthe 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:
 {{ :en:multiasm:cs:equation_floating.png?200 |}} {{ :en:multiasm:cs:equation_floating.png?200 |}}
  
-There are two main types of real numbers, called floating point values. Single precision is the number which is encoded in 32 bits. Double precision floating point number is encoded with 64 bits. They are presented in Fig{{ref>realtypes}}.+There are two main types of real numbers, called floating-point values. Single precision is number which is encoded in 32 bits. Double-precision floating-point number is encoded with 64 bits. They are presented in Fig{{ref>realtypes}}.
  
 <figure realtypes> <figure realtypes>
-{{ :en:multiasm:cs:floating_numbers.png?600 |Illustration of a single and double precision real numnbers}} +{{ :en:multiasm:cs:floating_numbers.png?600 |Illustration of a single and double precision real numbers}} 
-<caption>Illustration of a single and double precision real numnbers</caption>+<caption>Illustration of a single and double precision real numbers </caption>
 </figure> </figure>
  
Line 43: Line 43:
 </table> </table>
  
-The most common representation for real numbers on computers is standardised in the document IEEE Standard 754. There are two modifications implemented which make the calculations easier for computers.+The most common representation for real numbers on computers is standardised in the document IEEE Standard 754. There are two features implemented which make the calculations easier for computers.
   * The Biased exponent   * The Biased exponent
   * The Normalised Mantissa   * The Normalised Mantissa
-Biased exponent means that the bias value is added to the real exponent value. This results with all positive exponents which makes it easier to compare numbers.+A biased exponent means that the bias value is added to the real exponent value. This results in all positive exponentswhich makes it easier to compare numbers.
 The normalised mantissa is adjusted to have only one bit of the value "1" to the left of the decimal. It requires an appropriate exponent adjustment. The normalised mantissa is adjusted to have only one bit of the value "1" to the left of the decimal. It requires an appropriate exponent adjustment.
  
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 Unicodewhich is capable of encoding not only 26 basic letters but also language-specific characters of many different languages. In simpler computerslike 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 the issue of the byte order in bigger data types. There are two possibilities:+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 to be an issue with the byte order in bigger data types. There are two possibilities:
   - 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>littlebigendian}} These two methods for a 32-bit class processor are shown in Fig{{ref>littlebigendian}}
en/multiasm/cs/chapter_3_11.1747290039.txt.gz · Last modified: 2025/05/15 06:20 by ktokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0