IS:112 Software & Hardware Concepts DATA REPRESENTATION – ORGANIZATION OF MEMORY


Everything (instructions, numeric and character data) in memory is stored in binary form How it is interpreted is determined by the data or instruction format. Memory consists of consecutive bytes. A certain number of consecutive bytes is a word. A word is a group of bits of some predetermined length considered as an entity. Word size is different for various computers; it is, however, always a multiple of eight. Typical word sizes are 16 bits, 32 bits and 64 bits. When a data item is defined, a certain amount of memory is allocated for the data item. These include byte, word, doublewords, quadwords, and blocks of ten bytes. Most of the time, bytes and words are used. Bytes are used to hold small numbers or sequences of characters. Words are used to hold larger numbers. Doublewords and quadwords are used for real numbers and calculations done by a math coprocessor. Words and doublewords are also used to hold addresses. Within instructions, whether an address is a reference to a byte or word is determined by how the data is defined and/or by the instruction using the data. Alphanumeric Data Alphanumeric (character) data includes upper and lower case letters, special characters (ex: $, @, &) and decimal digits. Two coding schemes commonly used are EBCDIC (IBM mainframes) and ASCII (PCs and minicomputers). Unicode is also used. EBCDIC and ASCII use 8 bits to represent character data. Unicode uses 16. Numeric Data Generally computers work with two types of numbers: fixed point and floating point. The term point refers to the decimal (or more appropriately binary) point. Fixed point As it implies, the point is considered to be fixed in one position. Most computers fix the point to the right of the number. In other words, fixed point numbers are whole numbers. Since the point is always to the right of the number, there is no need to store it. There are two types of fixed point numbers: signed and unsigned. Unsigned numbers can represent only positive numbers and zero. Signed numbers can represent negative and positive numbers. Unsigned Numbers
Signed Numbers
To derive the two’s complement of a number, two methods can be used. Method 1
EX: 54, using a word
Method 2
EX: 54, using a word
Floating Point With floating point numbers, the point can be in any position. They are suitable for representing real numbers, values that have a fractional component. They are also used to represent very large and very small numbers. Floating point numbers use scientific notation in the form m x r^{exp} where m represents the mantissa, r is the radix (base) and exp is the exponent value. The mantissa and exponent are stored, as well as the sign of the number. The mantissa must be in the form 1.n (adjusting the point as necessary). The exponent is biased by 127 to allow both negative and positive exponents, with a range of –126 to +127. It is common to use 32 bits to represent floating point values, with the following placement:
EX: The decimal value –10.625 in binary floating point would be: 1010.101 x 2^{0} mantissa = 1010.101 exponent = 0 Placed in 1.n form: 1.010101 x 2^{3} mantissa = 1.010101 exponent = 3 Mantissa (23 bits, excluding 1.): 01010100000000000000000 Biased exponent: 3 + 127 = 130 binary = 10000010 Sign = 1 (negative) The resultant 32 bit representation: 11000001001010100000000000000000 And in hex: C 1 2 A 0 0 0 0 Range of Numbers/Memory Size Size Type Range Byte Unsigned 0 to 255 Byte Signed 128 to +127 Word Unsigned 0 to 65535 Word Signed 32768 to 32767 Doubleword Signed 2147483648 to +2147483647 Doubleword Floating 10^{38} to 10^{38} Quadword Signed 922337203685477808 to +922337203685477807 Quadword Floating 10^{308} to 10^{308}

June
10, 2003
