Madhusanka Liyanage: Lecture 3: Data Representation in Computer Systems
Madhusanka Liyanage: Lecture 3: Data Representation in Computer Systems
Madhusanka Liyanage
School of Computer Science
University College Dublin, Ireland
[email protected]
1
Learning Objectives
2
Data and Information
3
Basic Unit of Data
4
Bit
5
Byte
6
Nibble
• A group of four bits is called a nibble (or nybble).
– Half a byte
– Bytes, therefore, consist of two nibbles: a
“high-order/Upper nibble” and a “low-
order/lower nibble”.
– Nibble is most often used in the context of
hexadecimal number representations, since a
nibble has the same amount of information as
one hexadecimal digit.
7
Crumb
• A pair of two bits or a quarter byte was called a
crumb.
– Quarter of a byte
– Often used in early 8-bit computing.
8
Word
9
Data Representation
12
Integer Representation (Recap)
14
Integer Representation (Recap)
16
Floating-Point Representation
17
Floating-Point: Scientific Notation
• Scientific notation is a way of expressing numbers
that are too large or too small to be conveniently
written in decimal form.
– For example:
0.125 = 1.25 10-1
5,000,000 = 5.0 106
18
Scientific Notation
• Scientific Notation: has a single digit to the left of the decimal point.
• Numbers written in scientific notation have three components:
19
Floating-Point Representation
• Computers use a form of scientific notation for
floating-point representation
• Computer representation of a floating-point number
consists of three fixed-size fields:
21
Example:
For illustrative purposes, we use a 14-bit model with a 5-bit
exponent and an 8-bit significand.
• Example:
– Express 3210 in the simplified 14-bit floating-
point model.
• We know that 32 is 25. So in (binary) scientific
notation 32 = 1.0 x 25
• Using this information, we put 101 (= 510) in the
exponent field and 1 in the significand as shown.
22
Example: synonymous forms
32 = 1.0 x 25 = 0.1 x 26 = 0.01 x 27 = 0.001 x 28 = 0.0001 x 29
23
Floating-Point Representation: Negative
exponents
24
IEEE-754 Representation
• A technical standard for floating-point arithmetic by
the Institute of Electrical and Electronics Engineers
(IEEE).
• The standard defines several interchange formats,
26
IEEE-754 Representation: How to Solve
synonymous Issue
• To resolve the problem of synonymous forms,
IEEE-754 establish a rule that the first digit of
the significand must be 1 (and integer part
should be zero).
• e.g. 32 = 1.0 x 25 = 0.1 x 26
• This results in a unique pattern for each floating-point
number.
– In the IEEE-754 standard, this 1 is implied meaning
that a 1 is assumed after the binary point.
27
IEEE-754 Representation: How to
Solve negative exponents
• To provide for negative exponents, IEEE-754 uses a
biased exponent.
• A bias is a number that is approximately midway in
the range of values expressible by the exponent.
• Exponent filed in IEEE-754 is filled by adding the
bias to the real exponent value
– So, Need to subtract the bias from the value in the
exponent field to determine its true value.
• Exponent values less than bias are negative,
representing fractional numbers.
28
IEEE-754 Representation
• The IEEE-754 single precision floating point
standard uses bias of 127 over its 8-bit exponent.
29
Example 1:
– Express 3210 in the revised 14-bit
floating-point model with a 5-bit
exponent and an 8-bit significand. Use
16 as bias.
• We know that 32 = 1.0 x 25 = 0.1 x 26.
• To use our excess 16 biased exponent, we add 16 to
6, giving 2210 (=101102).
• Graphically:
30
Example 2:Representation
– Express 0.062510 in the revised 14-bit
floating-point model with a 5-bit
exponent and an 8-bit significand. Use
16 as bias.
• We know that 0.0625 is 2-4. So, in (binary) scientific
notation 0.0625 = 1.0 x 2-4 = 0.1 x 2 -3.
• To use our excess 16 biased exponent, we add
16 to -3, giving 1310 (=011012).
31
Example 3 (To Do):Representation
– Express -26.62510 in the revised 14-bit
floating-point model with a 5-bit
exponent and an 8-bit significand. Use 16
as bias.
• We find 26.62510 = 11010.1012. Normalizing, we have:
26.62510 = 0.11010101 x 2 5.
• To use our excess 16 biased exponent, we add 16 to 5,
giving 2110 (=101012).
• We also need a 1 in the sign bit (for a negative
number).
32
What about Characters?
33
Character Codes
34
Character Codes
36
Character Codes : EBCDIC
39
The ASCII Code
40
41
Unicode
Unicode
43
Unicode
44
Data Recording and Transmission
45
Codes for Data Recording and
Transmission
• When character codes or numeric values are stored in
computer memory, their values are unambiguous (Fixed).
• However, this is not always the case when data is stored
on magnetic disk or transmitted over a distance of more
than a few feet.
– Owing to the physical irregularities of data
storage and transmission media, bytes can
become distorted or garbled.
• Data errors are reduced by use of suitable coding
methods as well as through the use of various error-
detection techniques.
46
Codes for Data Recording
and Transmission
• To transmit data, pulses of “high” and “low” voltage
are sent across communications media.
• To store data, changes are induced in the magnetic
polarity of the recording medium.
• The period of time during which a bit is transmitted,
or the area of magnetic storage within which a bit is
stored is called a bit cell.
47
Non-Return-to-Zero (NRZ)
50
Error Detection and Correction
51
2.8 Error Detection and Correction
52
Types of Error
53
Error detection/correction
• Error detection
– Check if any error has occurred
– Don’t care the number of errors
– Don’t care the positions of errors
• Error correction
– Need to know the number of errors
– Need to know the positions of errors
– More difficult
10.54
Error Detection
56
Error Detection Techniques
57
Parity check
59
Home work
60
Summery
61
Thank You
62