St Louis Community College.

home

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

  • Sign is not stored with the number
  • Represented as binary equivalent
  • Use every available bit pattern to represent positive numbers and zero

Signed Numbers

  • Sign is stored with the number
  • Two’s complement method is used to represent signed numbers
  • Greatly simplifies hardware needed to manipulate signed numbers
  • Positive numbers represented as binary equivalent
  • Negative numbers represented by the two’s complement of positive bit pattern
  • Leftmost bit indicates its sign: 0 for positive, 1 for negative

To derive the two’s complement of a number, two methods can be used.

Method 1

  1. Find the binary representation of the value, adding leading zeros if necessary to fill the memory unit.
  2. Invert each bit (0s become 1s, 1s become 0s)
  3. Add 1

EX: -54, using a word

  1. 0000 0000 0011 0110
  2. 1111 1111 1100 1001
  3. +                               1
  4. 1111 1111 1100 1010

Method 2

  1. Find the binary representation of the value, adding leading zeros if necessary to fill the necessary memory unit.
  2. Working from the right, copy bits up to and including the first 1.
  3. Invert subsequent bits.

EX: -54, using a word

  1. 0000 0000 0011 0110
  2.                                10
  3. 1111 1111 1100 1010

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 rexp 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:

  • One bit is used for the sign of the number; 0 if positive, 1 if negative.
  • Eight bits are used to represent the exponent as an unsigned integer.
  • Twenty-three bits are used for the mantissa.

EX: The decimal value –10.625 in binary floating point would be:

-1010.101 x 20 mantissa = 1010.101 exponent = 0

Placed in 1.n form: -1.010101 x 23 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 1038

Quadword        Signed           -922337203685477808 to +922337203685477807

Quadword         Floating        -10-308 to 10308

 

© 2017 St. Louis Community College
June 10, 2003