PRELIM Modules PDF
PRELIM Modules PDF
PRELIM Modules PDF
All the topics are illustrated with clear diagram and simple language is used
throughout the text to facilitate easy understanding of the concepts. The author welcomes
constructive suggestion and comments at the end of each module.
OBJECTIVES
a. To discuss the concepts and techniques of number systems and codes in
representing numerical values in various number systems and perform number
conversions between different number systems and codes.
2
MODULE 1
OVERVIEW OF
LOGIC
FUNCTIONS
Sets, Relations and
Logic Functions
3
UNIT 1
SETS
Let us consider the following situation :
One day Mrs. and Mr. Mehta went to the market. Mr. Mehta purchased the
following objects/ items. "a toy, one kg sweets and a magazine". Where as Mrs. Mehta
purchased the following objects/ items. "Lady fingers, Potatoes and Tomatoes". In both the
examples, objects in each collection are well defined. What can you say about the collection
of students, Who speak the truth ? Is it well defined?
Perhaps not.
4
UNIT 1
SETS
A set is a collection of well defined objects. For a collection to be a set it is
necessary that it should be well defined.
The word well defined was used by the German Mathematician George Cantor
(1845- 1918 A.D) to define a set. He is known as father of set theory. Now-a-days set theory
has become basic to most of the concepts in Mathematics. There are two methods to
represent a set.
In this method a set is represented by listing all its elements, separating these by commas
and enclosing these in curly bracket.
Example:
V = { a, e, i, o, u}
5
UNIT 1
REPRESENTATION OF A SET
Set-builder form
In this form elements of the set are not listed but these are represented by some common
property.
Example:
Let V be the set of vowels of English alphabet then V can be written in the set builder form
as: V = {x : x is a vowel of English alphabet}
A = {x : x N and 1 x < 7}
Note : Symbol ':' read as 'such that'
Examples:
6
UNIT 1
CLASSIFICATION OF SETS
Finite and infinite sets
A = {x : x is a natural number}
As it is clear that the number of elements in set A is not finite (infinite) while
number of elements in set B is finite. A is said to be an infinite set and B is said to be is
finite set.
Note : A set is said to be finite if its elements can be counted and it is said to be
infinite if it is not possible to count up to its last element.
7
UNIT 1
CLASSIFICATION OF SETS
Singleton Set : Consider the following set :
As there is only one even prime number namely 2, so set A will have only one element.
Such a set is said to be singleton. Here A = {2}. Note: A set which has only
one element is known as
Equal and equivalent sets : Consider the following examples. singleton.
8
UNIT 1
CHECK YOUR PROGRESS
Write each of the following sets in the Roster form :
Write each of the following sets are in the set builder form ?
2. C = {2, 3, 5, 7} 4. D = {- 2, 2}
Which of the following sets are finite and which are infinite ?
9
UNIT 1
Cont…
SUB - SETS
Let set A be a set containing all students of SLSU Tiaong and B be a set containing all
students of BSIT 1 of SLSU Tiaong. In this example each element of set B is also an
element of set A. Such a set B is said to be subset of the set A. It is written as B A,
Consider D ={1, 2, 3, 4,........}
E = {.....-3-2,-1, 0, 1, 2, 3, .......}
A = {2, 3 }, B = {2}.
10
UNIT 1
Cont…
SUB - SETS
Examples cont…
is A B or B A ?
3. If A = {a, e, i, o, u}
B = {e, i, o, u, a }
Solution : Here in the given sets each element of set A is an element of set B also
11
UNIT 1
Cont…
UNIVERSAL SETS
A can be considered as the universal set for this particular example. Universal set is
generally denoted by U.
VENN DIAGRAM
British mathematician John Venn (1834-1883 AD) introduced the concept of diagrams to
represent sets. According to him universal set is represented by the interior of a rectangle
and other sets are represented by interior of circles. For example if U= {1, 2, 3, 4, 5}, A =
{2, 4} and B = {1,3}, then these sets can be represented as
12
UNIT 1
Cont…
DIFFERENCE OF SETS
A new set having those elements which are in A but not B is said to be the difference of sets
A and B and it is denoted by A-B.
\ A-B= {1, 3, 5}
Similarly a set of those elements which are in B but not in A is said to be the difference of B
and A and it is devoted by B - A.
\B - A = {6}
COMPLEMENT OF A SET
Let X denote the universal set and Y, Z its sub set where
13
UNIT 1
COMPLEMENT OF A SET
If U is the universal set and A is its subset then the complement of A
is a set of those elements which are in U which are not in A. It is
denoted by A'.
A' = U-A = {x : x U and x A}
Given that
Solution : It is given
U= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.
A = { 2, 3, 5, 7}
A’=U - A= {1, 4, 6, 8, 9, 10}
14
UNIT 1
CHECK YOUR PROGRESS
1. Which of the following statements are true or false ?
Set of all boys, is contained in the set of all students of your school.
Set of all boy students of your school, is contained in the set of all students of your school.
Set of all circles having center at origin is contained in the set of all ellipses having center
at origin.
15
UNIT 1
RELATIONS
Consider the following example :
Suppose Rita has two brothers Mohan and Sohan, Marry has one brother David, and Fatima
has one brother Karim. If we define a relation R " is a brother of" between the elements of A
and B then clearly. (Mohan, Rita), (Sohan, Rita), (David, Marry), (Karima, Fatima).
The above information can also be written in the form of a set R of ordered pairs
as R= {(Mohan, Rita), (Sohan, Rita), (David, Marry), Karim, Fatima}
If R is a relation between two sets then the set of its first elements (components) of all the
ordered pairs of R is called Domain and set of 2nd elements of all the ordered pairs of R is
called range, of the given relation.
16
UNIT 1
RELATIONS
If R is a relation 'is greater than' from A to B, where
Find:
Solution :
R = {(3, 1), (3, 2), (4, 1), (4, 2), (5, 1), (5, 2)}
Domain of R = {3, 4, 5}
Range of R = {1, 2}
17
UNIT 1
INTRO TO LOGIC FUNCTION
BASIC LOGIC FUNCTION
A digital circuit represents and manipulates information encoded as electric signals that can
assume one of two voltages:
A digital circuit requires a power supply that can produce these two voltages, and these
same supply voltages are also used to encode information in the form of two-state, or binary
signals.
The components in digital circuits are simple on/off switches that can pass logic '1' and
logic '0' signals.
18
UNIT 1
INTRO TO LOGIC FUNCTION
Three primary logic relationships:
The AND relationship, F=A⋅B, can be written F=AB. The OR relationship uses the plus (+)
sign, and the NOT or inversion relationship is shown by placing a bar over the inverted
variable or by placing a single quote character after the variable or quantity to be inverted.
19
UNIT 1
INTRO TO LOGIC FUNCTION
TRUTH TABLES
A truth table is the primary tool for capturing logical relationships in a concise
and universally understood format. All possible combinations of inputs are shown in rows
on the left of a truth table, and outputs are shown on the right.
For example, a truth table with two inputs, A and B, will require 22, or 4 rows to
list all possible combinations: '0 0', '0 1', '1 0', and '1 1'.
For the ANDing operation, the output is “true” only when both inputs are true, so the
rightmost column would have a '1' only in the last row. For the ORing operation, the truth
table would have a '0' only in the first row.
20
UNIT 1
INTRO TO LOGIC FUNCTION
Represent Basic Logic Operations in Circuits
This circuit, like that of the previous circuit, can demonstrate either the AND
relationship or the OR relationship depending on how the input and output signals are
interpreted
21
MODULE 2
NUMBER SYSTEM
SIGNED NUMBERS
CODES
22
UNIT 1
NUMBER SYSTEM
● Digital systems consider discrete amounts of data
Examples
● 10 decimal digits
23
UNIT 1
NUMBER SYSTEM
UNDERSTANDING DECIMAL NUMBERS
● Decimal numbers are made of decimal digits: (0,1,2,3,4,5,6,7,8,9) Base = 10
● Number = d3 x B3 + d2 x B2 + d1 x B1 + d0 x B0 = Value
24
UNIT 1
NUMBER SYSTEM
UNDERSTANDING HEXADECIMAL NUMBERS
● Hexadecimal numbers are made of 16 digits:
● (0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F)
● Note that each hexadecimal digit can be represented with fourbits : (1110)2 =(E)16
● 0 and 1
8 4 2 1 Weights
● How many items does a binary number represent?
25
UNIT 1
NUMBER SYSTEM
Putting It AllTogether
26
UNIT 1
NUMBER SYSTEM
WHY USE BINARY NUMBERS?
1
AND 0
Gate 0
27
UNIT 1
NUMBER SYSTEM
CONVERSION BETWEEN NUMBER BASES
Octal
(base 8)
Decimal Binary
(base 10) (base 2)
Hexadecimal
(base 16)
28
UNIT 1
NUMBER SYSTEM
Convert a Fraction from Decimal to Another Base
For each digit position:
29
UNIT 1
NUMBER SYSTEM
The Growth of Binary Numbers
n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
3 23=8 11 211=2048
4 24=16 12 212=4096
30
UNIT 1
NUMBER SYSTEM
Convert an Integer from Decimal to Octal
31
UNIT 1
NUMBER SYSTEM
Convert a Fraction from Decimal to Octal
32
UNIT 1
NUMBER SYSTEM
Conversion Between Base 16 and Base 2
● Conversion is easy!
33
UNIT 1
NUMBER SYSTEM
BINARY ADDITION
● Binary addition is very simple
BINARY SUBTRACTION
● We can also perform subtraction (with borrowsin place of carries)
34
UNIT 1
NUMBER SYSTEM
BINARY MULTIPLICATION
• Binary multiplication is much the same as decimal multiplication, except that the
multiplication operations are much simpler
● signed magnitude
● 1’scomplement
● 2’scomplement
35
UNIT 2
SIGNED NUMBERS
Signed Magnitude Representation
● The left most bit is designated as the sign bit while the remaining bits form the
magnitude
36
UNIT 1
NUMBER SYSTEM
One’s Complement Representation
7 0111
6 0110
. .
. .
4 bits 1 0001
0 0000
−0 1111
−1 1110
. .
16 combinations . .
−6 1001
−7 1000
37
UNIT 1
NUMBER SYSTEM
Two’s Complement Shortcuts
● Algorithm 1: Complement each bit then add 1 to the result
10011010 01100100
+___________1 +_________1
10011011 01100101
● Algorithm 2: Starting with the least significant bit, copy all of the bits up to and
N = 0 1 1 0 0 1 10
7 0111
[N] = 1 0 0 1 1 0 1 0 6 0110
. .
Two’s Complement Representation
. .
1 0001
0 0000
4 bits
−1 1111
−2 1110
. .
. .
16 combinations −7 1001
−8 1000
38
UNIT 2
CODES
BINARY CODED DECIMAL
0 0000 5 0101
1 0001 6 0110
2 0010 7 0111
3 0011 8 1000
4 0100 9 1001
39
UNIT 2
CODES
PUTTING IT ALLTOGETHER
● Easier to read?
40
UNIT 2
CODES
GRAY CODE
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
41
UNIT 2
CODES
ASCII CODES
● American Standard Code for Information Interchange
PARITYCODES
● Parity codes are formed by concatenating a parity bit, P to each code word C
● In an even-parity code, the parity bit is specified so that the total number of ones is
even
● In an odd-parity code, the parity bit is specifiedso that the total number of ones is
odd
42
UNIT 2
CODES
Parity Code example
Concatenate a parity bit to the ASCII code for the characters “0”, “X”, and “=” to produce both
odd- parity and even-parity codes
Character ASCII
Odd-Parity Even-Parity
ASCII ASCII
BINARY DATASTORAGE
● Hex (binary)
● BCD
● ASCII
43
UNIT 2
CODES
REGISTER TRANSFER
TRANSFER OF INFORMATION
● Stored in memory
44
UNIT 2
CODES
BUILDING A COMPUTER
● We need processing
● We need storage
● We need communication
45
EXERCISES
A. Convert the following:
1. 100110112 to dec, oct and hex
2. 2378 to dec, bin and hex
3. A0EC to bin, oct and dec
4. 10011010112 + 1001110002 + 1438 + BAD = ???
B. Solve for the 2s complement by using the two algorithm:
1. 100010100101010101002
2. 011001110101010100012
C. Attach an EVEN parity to code word 011 1000
D. Attach an ODD parity to code word 101 1101
E. What is the decimal equivalent for BCD number 136?
REFERENCES
Switching Theory And Logic Design: Number System and Boolean Algebra and
Switching functions.2015. https://www.pdfdrive.com/switching-theory-and-logic-design-
unit-i-number-system-and-boolean-algebra-and-switching-e45401819.html. Accessed 3
August 2020
Astola, Jaakko T., Stanković, Radomir S. Fundamentals of Switching Theory and Logic
Design. 2006. https://www.pdfdrive.com/fundamentals-of-switching-theory-and-logic-
design-d17528650.html. Accessed 3 August 2020.
46