Meeting1-Block 1-Part 1
Meeting1-Block 1-Part 1
Meeting1-Block 1-Part 1
Information Technology 2
Meeting #1
Block 1 (Part 1 )
Binary data representation and computation
OU Materials, PPT prepared by Dr. Khaled Suwais
1
Edited by Dr. Ahmad Mikati
Contents
• Introduction
• 1.1 Representing integers and text in binary
• 1.2 Decimal numbers and some limitations of binary representations
• 1.3 Representing logic operations and logic circuits
• Summary
2
Introduction
3
1.1 Representing integers and text in binary
4
1.1 Representing integers and text in binary
5
Binary representation systems in computers
7
Converting numbers from decimal to binary
notation
8
Representing integers in binary
Unsigned integers
10
Adding unsigned integers in binary notation
12
Sign-magnitude representation
Signed magnitude is the most intuitive method for representing the
unsigned numbers.
The MSB (Most Significant Bit) of a binary number is kept as the
“sign” of the number
MSB = 1: negative number
MSB = 0: positive number
The remaining bits represent the magnitude (or absolute value) of
the numeric value.
• So for our 3 bits, there would be 23 = 8 possible binary codes, which
could be used to encode positive and negative integers as shown in
Table 1.7.
13
Sign-magnitude representation
In an N bit word signed magnitude system
1 bit is used for the sign of the number (MSB).
N-1 bits are used for the magnitude of the number.
The largest integer is 2N-1- 1
The smallest integer is -(2N-1- 1)
• Since 2007, the standard encoding system for characters has been
Unicode Transformation Format-8 (UTF-8) which uses a variable
number of bytes (up to 6) to encode characters in use across the
world. However, in order to maintain backward compatibility, the
original 127 ASCII codes are preserved in UTF-8.
16
Floating-point numbers and scientific
notation
18
1.3 Representing logic operations and logic
circuits
• In the previous two sections, we have seen that we can use binary
encodings to represent numerical and textual data. We will now see
that operations, including arithmetical operations such as addition,
and comparison operations such as less than and equals, can be
encoded as one or more logic operations. These logic operations act
on the binary representations of the data.
• To move from the human to the computer view, the integers have to
be encoded as binary representations and the addition operator has
to be encoded as a sequence of logical operations that have what is
called the truth table.
19
1.3 Representing logic operations and logic
circuits
22
1.3 Representing logic operations and logic
circuits
• The OR operation
• truth table for the logic operation OR (which Boole originally
designated by the symbol +) is shown below
OR logic gate
OR truth table
23
Building logic circuits
24
Building logic circuits
• To translate this into a logic expression – that is a combination of
our logic operations (NOT, AND and OR) – we follow this algorithm.
• Identify the row where the outcome (B > A) is 1.
• If input A is 1, write A; otherwise write NOT A in the logic expression for
the selected row.
• If input B is 1, write B; otherwise write NOT B in the logic expression for
the selected row.
• Join these with an AND.
• The final equation will be the sum of all the deduced logic expressions.
This algorithm yields the answer given
• Here, the resulting logic expression NOT A AND B tells us that the
logic circuit that is equivalent to this truth table for each combination
of inputs can be constructed from two logic gates
27
1.3.4 What is inside a logic gate?
• How Logic gates are actually constructed , and what exactly is
inside a logic gate?
• A Logic gate is itself made up of a combination of more
fundamental components that act as on/off switches.
• In early computers, such devices were generally based on
various designs of vacuum tube (collectively called valves).
• In modern computers, they are based on transistors, which are
formed of layers of semiconducting material such as silicon.
28
A ‘pluggable’ unit made of valves from A chip containing six inverters
an IBM computer of the mid-1950s