Chapter 01
Chapter 01
College of Engineering
Electrical and Software Engineering Programs
EE 210/SE223
Digital Design
Chapter 1
Digital Systems and Binary Numbers
Outline
• Digital and analog systems
• Numerical representations
• Digital number systems
• Digital circuits/logic circuits
• Digital computers
Outcome 1 2
Numerical Representations
• In science, technology, business and other
fields, we deal with quantities
• Quantities are measured, monitored,
recorded, manipulated arithmetically and
observed in most physical systems
• It is important when dealing with various
quantities that we can represent their values
efficiently and accurately
3
Analog Representations
• A quantity is represented by a voltage,
current, or meter movement that is
proportional to the value of that quantity
• Example 1: Analog multimeter
• Example 2: Glass thermometer
4
Digital Representations
• Quantities are represented not by movement
proportional to the quantities but by symbols
called digits.
• The quantity changes in discrete steps
• Example 1: Digital multimeter
• Example 2: Digital thermometer
5
Signal Examples Over Time
Time
Continuous in
Analog value & time
Digital Discrete in
value &
Asynchronous continuous in
time
Discrete in
Synchronous
value & time
6
Exercise
7
Why do we use Binary system?
• It is very difficult to design electronic equipment so
that it can work with ten different voltage levels
• On the other hand, it is very easy to design simple,
accurate electronic circuits that operate with only
two voltage levels
• In the binary system there are only two symbols or
possible digit values, 0 and 1
• Combinations of the two values, called codes, are
used to represent numbers, symbols, alphabetic
characters and other types of information
8
Binary Digits and Logic Levels
• The two digits in the binary system, 1 and 0,
are called bits
• A 1 is represented by the higher (usually)
voltage, which we will refer to as a HIGH
• A 0 is represented by the lower voltage level,
which we will refer to as a LOW
9
Logic Levels
• The voltages used to represent a 1 and a 0 are
called logic levels
• In a digital circuit, however, a HIGH can be any
voltage between a specified minimum value
and a specified maximum value
• Likewise, a LOW can be any voltage between a
specified minimum and a specified maximum
10
Typical Voltage Assignment in Digital
Systems
5V
Binary 1
2V 1 1
Not used 5V
0.8 V
Binary 0 0 0
0V 0V t
t1 t2 t3 t4 t5
12
DIGITAL SYSTEMS
• Takes a set of discrete information inputs and
discrete internal information (system state) and
generates a set of discrete information outputs.
Discrete
Discrete information Discrete
Inputs processing Outputs
system
System State
13
Types of Digital Systems
• No state present
– Combinational Logic System
– Output = Function(Input)
• State present
– State updated at discrete times
=> Synchronous Sequential System
– State updated at any time
=>Asynchronous Sequential System
– State = Function (State, Input)
– Output = Function (State)
or Function (State, Input)
14
Digital System Example:
A Digital Counter (e. g., odometer):
Count Up
Reset 0 0 1 3 5 6 4
Memory
Arithmetic &
Control Unit
CPU (CU)
Logic Unit
(ALU)
19
Outline
• Base-b Number System
• Binary Number System
• Octal Number System
• Hexadecimal Number System
• Representing negative numbers
• Addition and multiplication
20
Outcome 1
NUMBER SYSTEMS – Representation
(Number)10 = (å i=n-1
Ai r )+( å
i
j=-1
Aj r)
j
i=0 j=-m
(Integer Portion) + (Fraction Portion)
21
Number Systems – Examples
General Decimal Binary Octal
Radix (Base) r 10 2 8
Symbols 0 => r - 1 0 => 9 0 => 1 0 => 7
0 r0 1 20 = 1 1
1 r1 10 21 = 2 8
2 r2 100 22 = 4 64
3 r3 1000 23 = 8 512
Powers of 4 r4 10,000 24 = 16 4096
Radix 5 r5 100,000 25 = 32 32768
-1 r -1 0.1 2-1 = 0.5 0.125
-2 r -2 0.01 2-2 = 0.25 0.015625
-3 r -3 0.001 2-3 = 0.125 0.001953125
-4 r -4 0.0001 2-4 = 0.0625 1/(8)4
-5 r -5 0.00001 2-5 = 0.03125 1/(8)5 22
Decimal System
• In a decimal system (base-10), 10 symbols are used to
construct any number. The symbols are: 0, 1, 2, 3, 4, 5, 6,
7, 8, 9
• How do you read 1234.567?
– 1000 plus 200 plus 30 plus 4 plus 5 tenth plus 6 hundredth
plus 7 thousandth
– That is: 1´103 + 2´102 + 3´101 + 4´100 + 5 ´10-1
+ 6´10-2 + 7´10-3
1 2 3 4 . 5 6 7
24
Decimal counting
0 10 100 1000
1 11 101 1001
2 12 102 1002
3 13 103 1003
4 . . .
5 . . .
6 . . .
7 . . .
8 98 998 9998
9 99 999 9999
25
Binary system
• 1011.1012 = 1×23 + 0×22 + 1×21 + 1×20 +
1×2-1 + 0×2-2 + 1×2-3
= 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125
= 11.62510
1 0 1 1 . 1 0 1
29
Representing Binary Numbers
• 216 = 26 ´ 210 = 64 K
Exercise
30
Base-b to decimal (base-10)
• To convert from base-b to decimal, simply
multiply each digit by b raised to the power
corresponding to the position of the digit
• Ex: convert 310.234 to decimal
= 48 + 4 + 0 + 2/4 + 3/16
= 52.6875
31
Converting from decimal to binary
• To convert a number from base-10 to base-2,
you successively divide the number by 2 and
keep track of the remainder
• Ex: convert 12 to binary.
33
Base-10 to base-b
• Ex: convert the decimal number 325.512 to base-
5
Number Result of division by 5 remainder
325 325/5 = 65 0
65 65/5 = 13 0
13 13/5 = 2 3
2 2/5 = 0 2
35
Octal numbers and binary numbers
• There is a simple way to convert a binary
number to octal (without converting to
decimal first).
• Starting from the binary point, group each
three binary digits into one octal digit
• Ex: convert 101110111.100010 to octal
5 6 7 . 4 2
copy
binary
point 36
Octal number to binary number
• To convert from octal to binary, simply
expand each octal digit into 3 binary digits
• Ex: convert 436.57 to binary
37
Hexadecimal numbers
• In a hexadecimal system there are 16 different
digits, namely, 0 to 9 and A, B, C, D, E, and F
38
Hexadecimal to decimal
• To convert from a hexadecimal number, simply
multiply each hex-digit by the corresponding power
of 16
• Ex: convert 1AB.CD to decimal
1AB.CD16 = 1× (162) + 10× (161) + 11× (160)
+ 12× (16-1) + 13× (16-2)
= 256 + 160 + 11 + 0.75 + 0.05078125
= 427.8007812510
39
Hexadecimal and binary numbers
• To convert a binary number to hexadecimal
number, simply group each four binary digits
into one hex-digit
• Ex: convert 110001101111.0101 to hex
C 6 F . 5
copy
binary
point
To convert a hex number to binary, perform
40
the opposite operation
Notes on converting octal and hex
• What do you do if the number of binary digits
is not a multiple of 3 in case of converting to
octal? Add extra zeros as needed to the end of
the sequence
• Ex: convert the binary number 1.1 to octal
1 . 4
41
Exercise
11011011.101
3672.672
528.65
AB9.CD
42
Number of Elements Represented
• Given n digits in radix r, there are rn distinct
elements that can be represented.
• Examples:
– You can represent 4 elements in radix r = 2 with
n = 2 digits: (00, 01, 10, 11).
43
Exercise
44
Number of Bits Required
• Given M elements to be represented by a
binary code, the minimum number of bits, n,
needed, satisfies the following relationships:
2n ³ M > 2(n – 1)
n = log2 M where x , called the ceiling
function, is the integer greater than or equal
to x.
• Example:
– You need 5 digits to represent 25 elements in
radix 2
45
Exercise
46
Representing negative numbers
• There are three common ways to represent
negative numbers, they are:
– Sign magnitude
– 1’s complement
– 2’s complement
• Sign magnitude
– The sign and the magnitude are separate
– There is one sign bit, zero for positive and one for
negative
– The magnitude is usually represented by more than
one bit
47
Sign magnitude
• Assume 8 bits are used for the sign and the
magnitude
• Positive 8 is represented as: 00001000
• Negative 8 is represented as: 10001000
• The only difference between the negative and
the positive number is in the sign bit
• It is not clear how adding negative 8 to
positive 8 yields zero! It is much more
complicated than simply adding the bits
48
1’s complement
• To represent a negative number, each bit of the
corresponding positive number is inverted
• Ex: the 1’s complement representation for negative 8,
using 8 bits, can be found as follows:
00001000 positive 8
-7
52
Addition in base-b
• The rules of addition remain the same for base-b
• Consider additions in base-2 (binary) and base-
16(hex)
011 01 1
1001 + A2CE
+
0011 B963
1 10 0 15C31
53
Exercise
• 0101112 + 1010112
• 63758 + 14468
54
Four-bit Signed Binary Numbers
55
Signed 2's-complement Addition
• Add all n bits, including their sign bits
• Discard a carry out of the sign-bit
• Check for the overflow
00110 11010
+ 11011 + 11011
10110 01111
+ 10011 + 01011
56
Overflow
• It appears if the result of addition cannot be
represented by n bits
– i.e., if we start with two n-bit numbers and the
sum occupies n+1 bits, we say we have overflow
• It may happen if two +ve or two –ve numbers
are added
– If the sign of the result ≠ the sign of 2 inputs,
there is an overflow
• Consider the carry bits related to the sign bit:
– If carry in ≠ carry out, there is an overflow
57
Signed 2's-complement Subtraction
• Let X and Y be represented in signed 2’s
complement number system using n bits,
• X-Y=X+(-Y) can be obtained as
– Take the 2's complement of Y (including the sign
bit) to represent -Y
– add it to X (including the sign bit)
– A carry out of the sign-bit position is discarded.
58
Example
In the 6-bit signed 2’s complement number system,
Obtain
(a)-6-(-13)
(b) -7-(14)
59
Binary Codes
• Any discrete element of information can be
represented with a binary code (i.e., a pattern of 0's
and 1's)
• An n-bit binary code is a group of n bits that has up
to 2n distinct combinations of 1's and 0's
– Binary numbers from 0 to 2n-1 (00…0 to 11…1)
• Each element must be assigned a unique binary bit
combination,
• No two elements can have the same value
60
BCD (Binary Coded Decimal) Code
61
BCD Addition
To obtain a BCD # with the addition of 2 BCD #s:
• add 2 digits using binary addition
• If the result is > 1001 add it to 0110
27 à 0010 0111
+34 à 0011 0100
62
Other Decimal Codes
• Many different codes can be generated
weighted codes self complemented codes
64
ASCII Codes
65