Chapter 1
Chapter 1
Chapter 1
Chapter 1
Data Representation
Data in computers is represented in binary form. The represented data can be number, text, movie, color
(picture), sound, or anything else. It is up to the application software that presents the data to portray the
data accordingly. We enter data into a computer using letters, digits & special symbols. But inside the
computer, there is no color, letter, digit or any other character inside the computer system unit.
Just like any other electrical device, computers understand and respond to only the flow of electrical
charge. They also have storage devices that work based on magnetism. This shows that the overall
structure of computers work only in binary conditions (the semi-conductors are conducting or not
conducting, a switch is closed or opened, a magnetic spot is magnetized or demagnetized). Hence, data
must be represented in the form of binary code that has a corresponding electrical signal.
The form of binary data representation system we are seeking is similar to the binary number system in
mathematics. Nevertheless we humans are not accustomed to the use of binary numbers. The main focus
of this chapter is on how data is represented in computers. Since understanding of binary number system
is essential to understand binary data representation, conversion of numbers from a given number base
to another base, is also discussed here. The number systems (bases) we will discuss are: decimal, binary,
octal, and hexadecimal.
0 1
Electronic No current There is current
Magnetic Demagnetized Magnetized
Switch Off On
B. 10011110
1001 1110
9 E
Therefore, 100111102 = 9E16
VI. Conversion form Hexadecimal to Binary
Step 1: For each hexadecimal digit, find the equivalent four digit binary number.
Step 2: If there are leading 0s for the binary equivalent of the leftmost hexadecimal digit, remove
them.
Example: Find the binary equivalents for the hexadecimal numbers 1C and 823.
A. 1C
1 C
0001 1100
After removing the leading 0s for the binary equivalent of the leftmost hexadecimal number 1,
the result becomes 11100. Therefore, 1C16 = 111002.
B. 823
8 2 3
1000 0010 0011
There is no leading 0s for the binary equivalent of the hexadecimal number 8; we simply
concatenate the binary digits to get the final result. Hence, 82316 = 1000001000112.
VII. Conversion from Octal to Hexadecimal of Vice Versa
Computer Organization and Architecture compiled by: Fikru Tafesse (MSc)
The decimal number system can be used as an intermediate conversion base. As it is shown in
the above sections, however, it the binary number system is quite convenient for conversion to or
from octal and hexadecimal. To convert an octal number to a hexadecimal number or from
hexadecimal to octal, the binary number system is used as an intermediate base.
Step 1: Convert the given number into binary.
Step 2: Convert the binary number you got in step 1 into the required base.
Example 1: Convert the octal number 647 to hexadecimal.
Step 1: Convert 6478 to binary
6 4 7
110 100 111
Step 2: Convert 1101001112 to hexadecimal
0001 1010 0111
1 A 7
Therefore, 6478 = 1A716
Example 2: Find the octal equivalent for the hexadecimal number 3D5
Step 1: Convert 3D516 to binary
3 D 5
0011 1101 0101
Step 2: Convert 11110101012 to octal
001 111 010 101
1 7 2 5
Therefore, 3D516 = 17258
Computer storage has a limited capacity to hold data. The number of bits available for data
representation determines the range of integers we can represent. With 4 bits, it is possible to
represent a total of 16 integers. If the number of available bits increases to 5, we can represent 32
integers. In fact with every bit added, the number of possible integers we can represent is
doubled. In general, the number of integers we can represent with n bits is 2n. Singed integers
include positive integers, negative integers, as well as zero. The 2n places are partitioned among
the negative, positive, and zero. For example, with 8 bits, it is possible to represent 256 different
integers. Typically, 128 of them are positive integers and zero while the rest 128 of them are
negative integers.
Signed integer representations discussed in this section are sign magnitude, 1’s complement, 2’s
complement, and excess-N. We assume the number of bits available for representation is 8
Computer Organization and Architecture compiled by: Fikru Tafesse (MSc)
unless explicitly specified.
Figure 1: Sign-magnitude representation number line; (a) the unsigned decimal value of the
binary number, (b) the binary numbers, (c) the actual value the binary numbers represent in sign-
magnitude representation
Figure 2: One’s complement number line; (a) the unsigned decimal value of the binary number,
(b) the binary numbers, (c) the actual value the binary numbers represent in one’s complement
representation.
In mathematics numbers are written in two common ways: either placing the radix point at a
fixed location or by locating the point at any location in the number and providing an extra data
which indicates the actual location of the radix point. With integers the radix point is implicitly
known to be at the right end of the number. This is an example of representation with the radix
point located at a fixed location in the number. In science very large and very small numbers are
quite common. Writing them with the radix point at its actual position is inconvenient. Therefore
the common and convenient way of writing such numbers is the scientific notation. In scientific
notation, a number is written with the radix point put after the first non-zero digit and the actual
position of the radix point is indicated by the exponent of the number. The scientific notation
allows the radix point to “float” anywhere in the number. This makes the representation of very
small and very large numbers effective and efficient and makes representation of numbers over a
large range of magnitude. Manipulation of fixed point representation is less costly than floating
point numbers but the range of numbers that can be represented by fixed point representation is
quite narrow.
In computers, representation of numbers similar to the scientific notation is available and is
known as floating point number. Unlike the scientific notation, there is no radix point character
in floating point numbers. For the representation of integers, the only required information is the
magnitude and the sign of the number. To represent floating point numbers or in scientific
notation we need the following information:
the magnitude of the number
the sign of the number
the magnitude of the exponent
the sign of the exponent
the base of the number
Of these required pieces of information, only the first four are necessary to represent floating
point numbers in computers. The base of the number is not necessary for representation because
it is always 2 as the number system of computers is binary.
Among the variety of floating number representations in computers, the IEEE 754 standard is the
most widely used. It is commonly referred as the IEEE floating point. Two formats of IEEE
floating point are:
Single precision: 32 bits wide representation with 23 bits significand, one sign bit, and 8
bits of exponent. The accuracy of binary numbers with 23 bits significant is equivalent to
Computer Organization and Architecture compiled by: Fikru Tafesse (MSc)
accuracy of 7 digits of decimal number.
Double precision: 64 bits wide representation of which 52 bits are for the signed and,
one bit for the sign of the number and 11 bits for the exponent. Double precision numbers
are accurate to 16 digits of decimal number.
Modern high level languages have numerical data types for both single and double precision
IEEE floating point format. For example the float data type in C and C++ is for single precision
representation and the data type double is for the double precision representation. Figure 4
shows the layout of single and double precision formats of the IEEE floating point
representation. The two formats are exactly the same except for the number of bits they have.
Notice the layout of bits for the sign, exponent and significand.
range of the exponent of single precision is [-127, 127]. 2 -127 is roughly 10-38 since -127 × log102
≈ -38 and 2127 is approximately 238. With similar argument, the range of values of double
precision is roughly from 10-308 to 2308. However, this range does not include all the possible
values of numbers because there are some numbers that cannot be represented exactly. A good
example is the real number 2/3.
3.4.2 Characters
Text documents contain strings of characters. Characters refer to letters of the alphabet, the ten
digits (0 through 9), punctuation marks, characters that are used to format the layout of text on
pages such as the newline, space, and tab characters, and other characters that are useful for
communication. The most widely used character code is the International Reference Alphabet
(IRA). The American version of IRA is called American Standard Code for Information
Interchange (ASCII). Even though IRA used 8 bits, each character is represented by 7 bits; hence
a total of 128 characters are represented.
Computer Organization and Architecture compiled by: Fikru Tafesse (MSc)
Another character encoding system is the EBCDIC (Extended Binary Coded Decimal for
Interchange Code) is used on IBM mainframe. It uses 8 bits per character (and a ninth parity bit),
thus represents 256 characters. As with IRA, EBCDIC is compatible with BCD. In the case of
EBCDIC, the codes 11110000 through 11111001 represent the digits 0 through 9.
ASCII is a standard for use in the United States. Many countries adapted their own versions of
ASCII. There are also 8-bit versions of ASCII which allow having additional 128 rooms for
more characters, especially of those languages based on the Latin character. To allow encoding
of characters of all the languages in the world, a character set known as the Unicode is devised.
The Unicode character has variants known as UTF-8, UTF-16, and UTF-32. UTF-8 is the same
as ASCII. UTF-16 and UTF-32 use 16-bit and 32-bit per character respectively, thus, have
incorporated much more characters. For backward compatibility with ASCII, the first 128
characters of UTF-16 and UTF-32 are similar to those of ASCII.
Computer Organization and Architecture compiled by: Fikru Tafesse (MSc)
The digital circuitry in digital computers and other digital systems is designed, and its behavior is
analyzed, with the use of a mathematical discipline known as Boolean algebra. The name is in honor of
an English mathematician George Boole, who proposed the basic principles of this algebra in 1854 in
his treatise, An Investigation of the Laws of Thought on Which to Found the Mathematical Theories of
Logic and Probabilities. In 1938, Claude Shannon, a research assistant in the Electrical Engineering
Department at M.I.T., suggested that Boolean algebra could be used to solve problems in relay- switching
circuit design. Shannon‟s techniques were subsequently used in the analysis and design of electronic
digital circuits.
Boolean algebra turns out to be a convenient tool in two areas:
Analysis: It is an economical way of describing the function of digital circuitry.
Design: Given a desired function, Boolean algebra can be applied to develop a simplified
implementation of that function.
Boolean algebra makes use of logical variables and logical operators. The possible values for a logical
variable are either TRUE or FALSE. For ease of use, these values are, conventionally, represented by 1
and 0 respectively. A system in which the only possible values are 0 and 1 is the binary number system.
Likewise, it is similar to the binary states of digital electronics and that is why Boolean algebra is used
to analyze digital circuits. The logical operators of Boolean algebra are AND, OR, and NOT, which are
symbolically represented by dot (∙), plus sign (+), and over bar (¯). Often the dot is omitted in Boolean
expression. Hence, A∙B is written as AB without the dot.
The operation AND yields true (binary value 1) if and only if both of its operands are true. The
operation OR yields true if either or both of its operands are true. The unary operation NOT inverts the
value of its operand. Other useful derived operators are NAND, NOR, and XOR. NAND (stands for
NOT - AND) is a combination of AND and NOT. It is the opposite of AND. NOR (NOT - OR) is
formed by combining OR and NOT. NOR is the opposite of OR. Similarly XOR is equivalent to the
equationX∙Y + X∙Y. Operator NOT is a unary operator and others are binary operators. XOR yields 1
when only if exactly one of the operands has the value 1. Except NOT, all operators and can be used
with more than two variables.
Table 1 shows the truth tables for these Boolean operators. A truth table shows the results of
an operation for every possible combination of values for its variables.
Table 2 shows important identities of Boolean algebra. These identities are useful in simplifying
Boolean functions in order to find simple circuit designs
Computer Organization and Architecture compiled by: Fikru Tafesse (MSc)
Figure 2: (a) The use of NAND gate (b) The use of NOR gate
There are three combinations of input values that cause F to be 1, and if any one of these
combinations occurs, the result is 1. This form of expression, for self-evident reasons, is known
as the sum of products (SOP) form. Figure 3 shows a straightforward implementation with AND,
OR, and NOT gates.
Computer Organization and Architecture compiled by: Fikru Tafesse (MSc)
Table 3: Truth table for the function in Equation (1.1)
This is in the product of sums (POS) form, which is illustrated in Figure 4. For clarity, NOT
gates are not shown. Rather, it is assumed that each input signal and its complement are
available. This simplifies the logic diagram and makes the inputs to the gates more readily
apparent. Thus, a Boolean function can be realized in either SOP or POS form. At this point, it
would seem that the choice would depend on whether the truth table contains more 1s or 0s for
the output function: The SOP has one term for each 1, and the POS has one term for each 0.
However, there are other considerations:
Computer Organization and Architecture compiled by: Fikru Tafesse (MSc)
It is often possible to derive a simpler Boolean expression from the truth table
than either SOP or POS.
It may be preferable to implement the function with a single gate type (NAND or
NOR).
The significance of the first point is that, with a simpler Boolean expression, fewer gates will be
needed to implement the function. Three methods that can be used to achieve simplification are:
Algebraic simplification
Karnaugh maps
Quine–McKluskey tables
Algebraic Simplification
Algebraic simplification involves the application of the identities of Table 2 to reduce the
Boolean expression to one with fewer elements. For example, Equation (1.1) can be simplified
to:
2.5.1 Flip-Flops
The simplest form of sequential circuit is the flip-flops. There are a variety of flip-flops, all of
which share two properties: The flip-flop is a bistable device, i.e. has two stable states. It exists
in one of two states and, in the absence of input- function as a 1-bit memory. The flip-flop has
two outputs, Q and the complement of Q.
E.g S-R, J-K & D flip-flops
A. S-R Flip-Flops
The circuit has two inputs, S (Set) and R (Reset), and two outputs, Q & complement of Q.
Mostly, events in the digital computer are synchronized to a clock pulse, so that changes occur
only when a clock pulse occurs. The S and R inputs are passed to the NOR gates only during the
clock pulse. Only when the clock signal changes [0-1] can output affected according to the
values of input S and R.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: