Department of Electrical Engineering
ELEC261 - Digital Systems Design
ELEC261
Number Systems and Boolean Algebra
Lecture 1 Prof. F Bensaali
Content:
• Digital and analog
• Number systems
o Decimal, Hexadecimal (HEX), Octal, Binary, Binary-Coded-Decimal (BCD)
• Conversion between number systems
o Binary to HEX, Binary to Octal, Binary to Decimal
• Logic functions and logic gates
o Truth tables
• Boolean algebra
o Boolean representation of logic functions
o Boolean reduction of logic functions
o Boolean relations from truth tables
• Shorthand definitions for logic functions
2
Digitaland
Digital andanalogue
analog
Human world signals are usually based upon continuous
analog signals that vary in time and space
e.g., temperature variation in the room over a day
To represent this analog world digitally we have to assign
numbers to successive parts of the analog signal and
process them instead
It’s a conversion process from the continuous analog
world to the digital world
3
Digitaland
Digital andanalogue
analog (Cont’d)
(Cont’d)
Each value represented by a dot can be represented as a digital
code that consists of a series of 1s and 0s
5
Number systems
Number systems
There are many number systems adopted in computer related
applications
In dealing with digital electronics, you will need to be
conversant with DECIMAL, HEXADECIMAL, OCTAL, BINARY
and BINARY-CODED-DECIMAL (BCD) and be able to convert
readily between them
In all number systems the position of the digits comprising any
number is representative of relative weighting of that digit
o The total number of units in a number is obtained by multiplying
each digit by the base raised to a power
o The power is determined by the digit position
6
Decimal
Decimal
Base Allowed digits
10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Example
• Total units:
(1x104)+(0x103)+(3x102)+(6x101)+(2x100)
• DECIMAL number: 1036210
7
Hexadecimal
Hexadecimal
Base Allowed digits
16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A(10), B(11),
C(12), D(13), E(14), F(15)
Example
• Total units:
(1x164)+(4x163)+(0x162)+(11x161)+(15x160)
• HEX number: 140BFH = 8211110
8
Octal
Octal
Base Allowed digits
8 0,1, 2, 3, 4, 5, 6, 7
Example
• Total units: (5x84)+(0x83)+(7x82)+(4x81)+(2x80)
• OCTAL number: 507428 = 2096210
9
Binary
Binary
Base Allowed digits
2 0, 1
Example
• Total units: (1x24)+(0x23)+(1x22)+(1x21)+(0x20)
• BINARY number: 101102 = 2210
10
Binary (Cont’d)
Binary (Cont’d)
A binary digit is called BIT – The smallest unit
An 8-bit binary number is called BYTE
e.g., 00110101 (= 5310)
A complete unit of information is called a word
Generally consists of two or more bytes
11
Binary-Coded-Decimal (BCD)
Binary-Coded-Decimal (BCD)
Base Allowed digits
2 (encoded) 0, 1
In this case, each digit of a decimal number is encoded
separately into the corresponding 4-bit binary code
o These codes, when placed end-to-end, form the BCD equivalent
Example
• BCD number: 1000000100110110BCD = 813610
13
Conversion: Binary
Conversion: Binary to
to HEX
HEX
• Write out the binary digits
Step 1
• Divide up into groups of four starting from the far right (leading zeros
Step 2 can be added to the last group to make up four bits if necessary)
• Obtain the corresponding decimal number for each group
Step 3
• Convert from decimal into the equivalent HEX alphanumeric
Step 4
Example 10110101
step 1:
step 2: 1011 0101
So 101101012 = B5H
step 3: 11 5
step 4: B 5
15
Conversion: Binary
Conversion: Binary to
to Octal
Octal
• Write out the binary digits
Step 1
• Divide up into groups of three starting from the right (leading zeros
Step 2 can be added to the last group to make up three bits if necessary)
• Obtain the corresponding octal digit for each group
Step 3
Example
step 1: 10110101
step 2: 010 110 101
So 101101012 = 2658
step 3: 2 6 5
16
Conversion: Binary to Decimal
The method shown in slide 9 is the most fundamental method
but this is not always the quickest way
o For long binary numbers it is often easier to convert from
BINARY to HEX to DECIMAL, this saves several multiply
and add stages
Example
11111101
111111012 = FDH
1111 1101 = (15x161)+(13x160)
= 25310
15 13
F D
Binary to HEX HEX to Decimal
17
Conversion: Decimal
Conversion: Decimal to
to Binary
Binary
• Divide the decimal number successively by 2 and note the remainder
Step 1
• Repeat the process till the division result is zero
Step 2
• Read the remainders in reverse order (starting with the last one)
Step 3
Example
60 / 2 = 30 remainder 0 LSB
30 / 2 = 15 remainder 0
6010 = ?2 15 / 2 = 7 remainder 1 6010 = 1111002
7 / 2 = 3 remainder 1
3 / 2 = 1 remainder 1
1 / 2 = 0 remainder 1 MSB
18
Voltage level
Voltage level representation
representation of
of binary
binary numbers
numbers
A single wire (a data line) can assume a voltage level to
represent a binary bit
Eight wires (Bus) can then be used for a whole byte
A very common system uses zero volts (0 v) as binary ‘0’ and
+5 volts (+5 v) as binary ‘1’
Example
Level 1 1 0 1 0 0 1 0
voltages +5 V +5 V 0V +5 V 0V 0V +5 V 0V
19
Combinational and
Combinational and sequential
sequential logic
logic
Digital electronics is classified into:
o Combinational logic
o Sequential logic
Combinational logic: output is a function of, and only of, a
COMBINATION of the present inputs
Sequential logic : output depends not only on the present
inputs but also on the past history (or SEQUENCE) of the inputs
o It has storage (memory)
outputs
Inputs
Combinational
logic Memory
element
20
Logic functions
Logic functions and
and logic
logic gates
gates
Any decision that can be answered YES/NO or TRUE/FALSE
can be mathematically represented as a combination of logic
functions
Readily available logic gates can be used to implement logic
functions
o Logic gates are building blocks of all digital electronic chips
including CPUs
o Logic gates are illustrated diagrammatically using logic symbols
21
Truth tables
Truth tables
A truth table is a means of describing a logic function in terms
of its input
o For a binary logic system with a number of inputs ‘n’ , there are
N possible combinations of inputs
o In order to be a complete description of the logic function, a truth
table must contain N rows where N is given by:
N = 2n input combinations
22
Truth table entries
Since a binary logic system has only two allowed states the
truth table must reflect this
In an electrical system, two different voltage levels are used to
represent these states
o The actual voltages depend on the type of technology (Logic
family) used
o Two widely accepted descriptions for the two states are shown
below (NO particular voltage levels are implied so these
descriptions are valid for ANY logic family)
LOGIC 0 = LOW LOGIC 1 = HIGH
23
‘NOT’ logic
‘NOT’ logic gate
gate (inverter)
(inverter)
Description of function
The X output is ‘1’ if input A is ‘0’
The output is the opposite (inverse) of the input
24
2-input ‘OR’
2-input ‘OR’ logic
logic gate
gate
Description of function
The output X is ‘1’ if input A is ‘1’
OR input B is ‘1’ (or both - inclusive OR)
25
2-input ‘NOR’
2-input ‘NOR’ (NOT-OR)
(NOT-OR) logic
logic gate
gate
Description of function
The output X is ‘1’ if neither input A is ‘1’
NOR input B is ‘1’
26
2-input ‘AND’
2-input ‘AND’ logic
logic gate
gate
Description of function
The output X is ‘1’ if input A is ‘1’ AND input B
is ‘1’
27
2-input ‘NAND’
2-input ‘NAND’ (NOT-AND)
(NOT-AND) logic
logic gate
gate
Description of function
The output X is NOT ‘1’ if input A is ‘1’ AND input
B is ‘1’
28
‘XOR’ or
‘XOR’ or ‘EXOR’
‘EXOR’ (Exclusive
(Exclusive OR)
OR) logic
logic gate
gate
Description of function
The output X is ‘1’ if input A is ‘1’ OR input B is ‘1’
but not both (exclusive OR)
29
‘XNOR’ or
‘XNOR’ or ‘EXNOR’
‘EXNOR’ (Exclusive
(Exclusive OR)
OR) logic
logic gate
gate
Truth Table
XNOR gate symbol
A B X
A
X
0 0 1
B A
X 0 1 0
B
Equivalent 1 0 0
1 1 1
Description of function
The output X is NOT ‘1’ if input A is ‘1’ OR input B
is ‘1’ but not both
30
Boolean Algebra
Before studying digital logic, we shall consider Boolean
Algebra which can be used to describe digital logic
functions
Boolean Algebra was devised by 19th Century Irish
mathematician George Boole
Boolean Algebra deals with binary variables and
functions, which can only take one of two values
31
Boolean representation
Boolean representation of
of functions
functions
George Boole devised a set of symbols (BOOLEAN
OPERATORS) and algebraic theorems which can be
used to describe and manipulate logic functions
The Boolean operators are:
• = AND + = OR
⊕ = XOR 𝒇𝒇� = function ‘f’ inverted
(‘NOT f’ or ‘f BAR)
32
Fundamental Boolean
Fundamental Boolean relations
relations and
and operations
operations
A AND B → f = A.B A.1=A
A.0=0
A OR B → f = A+B A.A=A
A XOR B →
� =0
A.A
f = A⊕B
A NAND B → f = A.B
A+1=1
A NOR B → f = A+B A+0=A
A XNOR B → f = A⊕B A+A=A
� =1
A+A
NOT A → �
f=A
33
Boolean reduction
Boolean reduction of
of logic
logic functions
functions
Logic functions may be reduced in complexity by the application
of the following Boolean algebraic laws:
Commutative: A+B = B+A
A.B = B.A
Associative: (A.B).C = A.(B.C)
(A+B)+C = A+(B+C)
Distributive: A.(B+C) = A.B+A.C
A+(B.C) = (A+B) . (A+C)
� +B
De Morgan’s Theorem: A.B = A �
A+B = A� .B
�
NB: De Morgan is easily remembered by saying:
“SPLIT THE LINE AND CHANGE THE SIGN” 35
Boolean reduction
Boolean reduction of
of logic
logic functions
functions (Cont’d)
(Cont’d)
Exercise
1. Use De Morgan’s theorem and Boolean algebra to verify the
following relation:
� .B=A+B
A+A
2. Reduce the following Boolean functions: Homework
a. f = A . B + A . B
� .B+A
b. f = A . B + A � .B
� +A.B
�
c. f = A � +A
� .C � .C+A
� .B
� +A.B
�
36
Boolean relations
Boolean relations from
from truth
truth tables
tables
Any logic function can be represented by a truth table /
Boolean relation
Since we can reduce a Boolean relation using Boolean
algebra, it is useful to be able to obtain Boolean
relation from truth table
We will consider two forms of relations which can be
readily found from a truth table:
o Sum of Products – SOP
o Product of Sums - POS
37
Sum of
Sum of Products
Products (SOP)
(SOP)
• Establish a Boolean PRODUCT (AND) for each ROW in the truth
Step 1 table – this is called the BINARY CONNECTIVE
• Note every CONNECTIVE where f = 1 (TRUE)
Step 2
• Form the SOP by ‘OR’ing the TRUE CONNECTIVES together
Step 3
Example
Binary
ROW A B f State Connective
0 0 0 0 FALSE A�.B �
1 0 1 1 TRUE A �.B OR � .B+A.B
f=A �
2 1 0 1 TRUE A . B � =A⊕B
3 1 1 0 FALSE A.B
38
Product of
Product of Sums
Sums of
of (POS)
(POS)
• Establish the binary connectives as a Boolean SUM (OR) for each
Step 1 ROW of the truth table
• Note every CONNECTIVE where f = 0 (FALSE)
Step 2
• Form the POS by ‘AND’ing the FALSE CONNECTIVES together
Step 3
Example For the POS we take A/B = 0
and A� /B
� =1
A+B
�
A+B AND � + B)
f = (A + B) . (A �
�+B
A =A⊕B
�+B
A �
39
Shorthand definitions
Shorthand definitions for
for logic
logic functions
functions
A shorthand form for defining logic functions can be
adopted by referring to the DECIMAL ROW NUMBERS
and writing them as a mathematical set
The row numbers referring to f = 0 are called MAXTERMS (M)
The row numbers referring to f = 1 are called MINTERMS (m)
Using this notation we can define the XOR gate for
example as follows:
SOP: f(A,B) = ∑ 𝒎𝒎(𝟏𝟏, 𝟐𝟐)
POS: f(A,B) = ∏ 𝑴𝑴(𝟎𝟎, 𝟑𝟑)
40
Shorthand definitions
Shorthand definitions for
for logic
logic functions
functions (Cont’d)
(Cont’d)
Exercise
Using the following equation:
- Complete the truth table and write the function in set form
using the maxterms
- Write f(A,B,C) as a Boolean SOP and POS
f(A,B,C) = ∑ 𝒎𝒎(𝟎𝟎, 𝟐𝟐, 𝟒𝟒, 𝟓𝟓, 𝟔𝟔)
41