PRELIM Modules PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

CPT02

LOGIC and SWITCHING


THEORY

JU LIU S P ERIE I. MA G CAWA S, MIT


[email protected]
[email protected]
OVERVIEW
The main purpose of this module is to develop the students the ability to analyze
and design the digital circuits. The increased uses of digital technology in objects used for
day-to-day life necessitate an in-depth knowledge of the subject for the professionals and
computer analysts.

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.

b. To apply the simplification methods to simplify the given Boolean function


(Boolean algebra, k-map and Tabular method).

c. To implement given Boolean function using logic gates.

d. To design and analyze various combinational and sequential circuits.

e. Generate adaptability in lifelong learning skills in pursuit of personal


development and excellence in professional practice.

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.

Important reminder before you start!

SOME STANDARD NOTATIONS TO REPRESENT SETS :

N : the set of natural numbers

W : the set of whole numbers Other frequently used symbols are :


: 'belongs to'
Z or I : the set of integers : 'does not belong to'
$: There exists, $: There does not exist.
Z+ : the set of positive integers

Z- : the set of negative integers

Q : the set of rational numbers

R : the set of real numbers


C : the set of complex numbers

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.

Roster method (Tabular form)

In this method a set is represented by listing all its elements, separating these by commas
and enclosing these in curly bracket.

Example:

If V be the set of vowels of English alphabet, it can be written in Roster form as :

V = { a, e, i, o, u}

If A be the set of natural numbers less than 7, then

A={1, 2, 3, 4, 5, 6}, is in the Roster form.

Note : To write a set in Roster form elements are not to


be repeated i.e. all elements are taken as distinct. For
example if A be the set of letters used in the word
mathematics, then
A = {m, a, t, h, e, i, c, s}

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}

Let A be the set of natural numbers less than 7, then

A = {x : x  N and 1  x < 7}
Note : Symbol ':' read as 'such that'
Examples:

Write the following in set -builder form :

(a) A={-3, -2, -1,0,1,2,3}


(b) B = {3,6,9,12}
Solution :

(a) A = {x : x Z and -3 x 3 }

(b) B = {x : x =3 n and n N, n 4 }


Write the following in Roster form. Solution :
(a) C ={50, 51,52,53,54,55,56,57,58,59,60}
(a) C = { x : x N and 50 x 60 }
(b) 2x - 5x + 6 = 0 or (x - 3) (x - 2) = 0
(b) D = {x : x R and x2 -5x +6 =0} X = 3, 2.
\ D = {2,3}

6
UNIT 1
CLASSIFICATION OF SETS
Finite and infinite sets

Let A and B be two sets where

A = {x : x is a natural number}

B = {x : x is a student of your school}

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.

Empty (Null) Set :

Consider the following sets.

A = {x : x R and x2 +1 =0}

B = {x : x is number which is greater than 7 and less than 5}

Note: A set which has no element is said to be a null/empty/void set, and is


denoted by f

7
UNIT 1
CLASSIFICATION OF SETS
Singleton Set : Consider the following set :

A = {x : x is an even prime number}

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.

Two sets A and B are said to be


A = {1,2,3}, B = {2,1,3} equivalent sets if they have same
number of elements but they are said
D = {1,2,3}, E = {a, b, c}. to be equal if they have not only the
same number of elements but
Example: elements are also the same.
1. If A = {x : x is a vowel of English alphabet} and B = {y : y N and y 5}

Is (i) A = B (ii) AB ?


Solution : A = {a, e, i, o, u}, b = {1, 2, 3, 4,5}.

Each set is having five elements but elements are different

\A B but AB.

2. Which of the following sets are singleton ?

A = {x : x Z and x - 2 =0}B = {y : y R and y2 - 2 =0}.


Solution : Set A contains those integers which are the solution of x- 2=0 or x = 2.
\A={2}.

A is a singleton set.


B is a set of those real numbers which are solutions of 2y- 2 =0 or y = 2
\ B ={- 2, 2}Thus, B is not a singleton set.

8
UNIT 1
CHECK YOUR PROGRESS
Write each of the following sets in the Roster form :

1. A = {x : x z and - 5 x 0 }.

2. B = {x : x R and x2 - 1 =0}.


3. C = {x : x is a letter of the word banana}.

4. D = {x : x is a prime number and exact divisor of 60}.

Write each of the following sets are in the set builder form ?

1. A = {2, 4, 6, 8, 10} 3. B = {3, 6, 9,...... }

2. C = {2, 3, 5, 7} 4. D = {- 2, 2}
Which of the following sets are finite and which are infinite ?

1. Set of lines which are parallel to a given line.

2. Set of animals on the earth.

3. Set of Natural numbers less than or equal to fifty.


4. Set of points on a circle.

Which of the following are null set or singleton ?

1. A = {x : x R and x is a solution of x2 +2 =0}

2. B = {x : x Z and x is a solution of x - 3 =0}.

3. C = {x : x Z and x is a solution of x2 - 2 =0}.


4. D = {x : x is a student of your school studying in both the classes XI and XII }

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, .......}

Clearly each element of set D is an element of set E also \ D E

Note: Each set is a subset of itself i.e. A A .


Null set has no element so the condition of becoming a subset is
automatically satisfied. Therefore null set is a subset of every set.
If A Band B A then A = B.
If A Band A B then A is said to be a proper subset of B and B
is said to be a super set of A. i.e. A B or B A .
Examples:

1. If A = {x : x is a prime number less than 5} and B = {y : y is an even prime number} then


is B a proper subset of A ?

Solution : It is given that

A = {2, 3 }, B = {2}.

Clearly B A and B A

We write B A and say that B is a proper subset of A.

10
UNIT 1
Cont…
SUB - SETS

Examples cont…

2. If A = {1, 2, 3, 4}, B = {2, 3, 4, 5}.

is A B or B A ?

Solution : Here 1A but 1 B AB.

Also 5B but 5A BA.

Hence neither A is a subset of B nor B is a subset of A.

3. If A = {a, e, i, o, u}

B = {e, i, o, u, a }

Is A B or B A or both ?

Solution : Here in the given sets each element of set A is an element of set B also

\ A B and each element of set B is an element of set A also. \ B A or A = B

11
UNIT 1
Cont…
UNIVERSAL SETS

Consider the following sets.


Note: Universal set does not mean a
A = {x : x is a student of SLSU Tiaong} set containing all objects of the
universe. A set which is a universal set
B = {y : y is a male student of SLSU Tiaong} for one problem may not be a universal
set for another problem.
C = {z : z is a female student of SLSU Tiaong}

D = {a : a is a student of BSIT 1 in SLSU Tiaong}

Clearly the set B, C, D are all subsets of A.

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

Diagrammatical representation of sets is known as a Venn diagram.

12
UNIT 1
Cont…
DIFFERENCE OF SETS

Consider the sets


A = {1, 2, 3, 4, 5} and B= {2, 4, 6}.

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

X = {x : x is any member of the family}


Y = {x : x is a male member of the family}

Z = {x : x is a female member of the family}

X-Y is a set having female members of the family..


X-Z is a set having male members of the family..

X-Y is said to be the complement of Y and is usually denoted by Y' .


X-Z is said to be complement of Z and denoted by Z'

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}

The complement of a set can be represented using Venn diagram as :

Given that

A = {x : x is a even natural number less than or equal to 10} and B =


{x : x is an odd natural number less than or equal to 10}
Find: 1) A-B, 2) B-C, 3) is A-B=B-A ?

Solution : It is given that


Note: Difference of two sets can be found even if
A = {2, 4, 6, 8, 10}, B = {1, 3, 5, 7, 9} none is a subset of the other but complement of a
set can be found only when the set is a subset of
Therefore, A-B ={2, 4, 6, 8, 10} some universal set. F’ =U and U’ =f.
B-A ={1, 3, 5, 7, 9}
Clearly, A-B B-A.

Let U be the universal set and A its subset where


U={x : x N and x 10 }

A = {y : y is a prime number less than 10}


Find A’

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 rectangles, is contained in the set of all quadrilaterals.

Set of all circles having center at origin is contained in the set of all ellipses having center
at origin.

2. If A = { 1, 2, 3, 4, 5 } , B= {5, 6, 7} find (i) A-B (ii) B-A.

3. Let N be the universal set and A, B, C, D be its subsets given by

A = {x : x is a even natural number}

B = {x : x N and x is a multiple of 3}

C = {x : x N and x 5}

D = {x : x N and x 10}

Find complements of A, B, C and D respectively.

15
UNIT 1
RELATIONS
Consider the following example :

A={Mohan, Sohan, David, Karim}

B={Rita, Marry, Fatima}

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}

Domain and Range of a Relation

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.

Consider previous example given above.

Domain = {Mohan, Sohan, David, Karim}

Range = {Rita, Marry, Fatima}

16
UNIT 1
RELATIONS
If R is a relation 'is greater than' from A to B, where

A= {1, 2, 3, 4, 5} and B = {1,2,6}.

Find:

R in the roster form.

Domain and Range of R.

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. logic high (Vdd)

B. logic low (GND).

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.

Thus, if a given circuit node is at Vdd,

signal is said to carry a logic '1‘;

If the node is at GND,

the node carries a logic '0'.

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:

AND, OR, and NOT (or inversion)

LOGIC FUNCTION NOTATIONS

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.

F = AB F = A+B F = A XOR B F=A F = AB F = A+B

F=A B F=A B F = A’ F = (A B)’ F = (A+B)’

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

Look at the circuit diagram:

If both switches are open, then F = Vdd;

If one switch is open and the other closed, then F = Vdd

If both switches are closed, then F = GND

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

F = GND if SW1 and SW2 are open

F = Vdd if SW1 or SW2 are closed.

Note that in both cases the physical circuit always


behaves the same way, but the behavior can be
interpreted as OR-like, or as AND-like. As will be seen
in later work, which interpretation is used is a matter of
convenience.

21
MODULE 2
NUMBER SYSTEM
SIGNED NUMBERS
CODES

22
UNIT 1
NUMBER SYSTEM
● Digital systems consider discrete amounts of data

Examples

● 26 letters in the alphabet

● 10 decimal digits

● Larger quantities can be built from discrete values:

● Words made of letters

● Numbers made of decimal digits (e.g. 239875.32)

● Computers operate on binary values (0 and 1)

● Easy to represent binary values electrically

● Voltages and currents

● Can be implemented using circuits

● Create the building blocks of modern computers

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

● How many items does decimal number 8653 represents?


1000 100 10 1 Weight
● 8653 = 8 x103 + 6 x102 + 5 x101 + 3 x100

● Number = d3 x B3 + d2 x B2 + d1 x B1 + d0 x B0 = Value

● What about fractions?

● 97654.35 = 9x104 + 7x103 + 6x102 + 5x101 + 4x100 + 3x10-1 + 5x10-2


● In formal notation → (97654.35)10

UNDERSTANDING OCTAL NUMBERS

● Octal numbers are made of octal digits: (0,1,2,3,4,5,6,7)

● How many items does an octal number represent?


512 64 8 1 Weights
● (4536)8 = 4x83 + 5x82 + 3x81 + 6x80 = (2398)10

● What about fractions?

● (465.27)8 = 4x82 + 6x81 + 5x80 + 2x8-1 + 7x8-2

● Octal numbers don’t use digits 8 or 9

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)

● How many items does a hex number represent?

4096 256 16 1 = Weights

● (3A9F)16 = 3x163 + 10x162 + 9x161 + 15x160 = 1499910

● What about fractions? : (2D3.5)16 = 2x162 + 13x161 + 3x160 + 5x16-1 = 723.312510

● Note that each hexadecimal digit can be represented with fourbits : (1110)2 =(E)16

● Groups of four bits are called a nibble : (1110)2

UNDERSTANDING BINARY NUMBERS


● Binary numbers are made of binary digits (bits):

● 0 and 1
8 4 2 1 Weights
● How many items does a binary number represent?

● (1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10

● What about fractions?

● (110.10)2 = 1x22 + 1x21 + 0x20 + 1x2-1 + 0x2-2

25
UNIT 1
NUMBER SYSTEM
Putting It AllTogether

● Binary, octal, and hexadecimal are similar

● Easy to build circuits to operate on these representations

● Possible to convert between the three formats

26
UNIT 1
NUMBER SYSTEM
WHY USE BINARY NUMBERS?

● Easy to represent 0 and 1 using electrical values

● Possible to tolerate noise

● Easy to transmit data

● Easy to build binarycircuits

1
AND 0
Gate 0

27
UNIT 1
NUMBER SYSTEM
CONVERSION BETWEEN NUMBER BASES

● Learn to convert between bases

● Already demonstrated how to convert from binary to decimal

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:

1. Multiply decimal number by the base (e.g. 2)

2. The integer is the highest-order digit

3. Repeat first two steps until fraction becomes zero

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

2 22=4 10 210=1024 Kilo

3 23=8 11 211=2048

4 24=16 12 212=4096

5 25=32 20 220=1M Mega

6 26=64 30 230=1G Giga

7 27=128 40 240=1T Tera

30
UNIT 1
NUMBER SYSTEM
Convert an Integer from Decimal to Octal

For each digit position:

1. Divide decimal number by the base (8)

2. The remainder is the lowest-order digit

3. Repeat first two steps until no divisorremains

31
UNIT 1
NUMBER SYSTEM
Convert a Fraction from Decimal to Octal

For each digit position:

1. Multiply decimal number by the base (e.g. 8)

2. The integer is the highest-order digit

3. Repeat first two steps until fraction becomes zero

32
UNIT 1
NUMBER SYSTEM
Conversion Between Base 16 and Base 2

● Conversion is easy!

Determine the 4-bit binary value for each hex digit

● Note that there are 16 different values of four bits

● Easier to read and write in hexadecimal

● Representations are equivalent!

1. Convert from Base 16 to Base 2

2. Regroup bits into groups of three starting from right

3. Ignore leading zeros

4. Each group of three bits forms an octal digit

33
UNIT 1
NUMBER SYSTEM
BINARY ADDITION
● Binary addition is very simple

BINARY SUBTRACTION
● We can also perform subtraction (with borrowsin place of carries)

● Let’s subtract (10111)2 from (1001101)2 …

34
UNIT 1
NUMBER SYSTEM
BINARY MULTIPLICATION

• Binary multiplication is much the same as decimal multiplication, except that the
multiplication operations are much simpler

HOW TO REPRESENT SIGNED NUMBERS


● Plus and minus signs are used for decimal numbers:

● 25 (or +25), −16, etc

● In computers, everything is represented as bits

● Three types of signed binary number representations:

● signed magnitude

● 1’scomplement

● 2’scomplement

● In each case: left-most bit indicates the sign:


‘0’ for positive and ‘1’ fornegative

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

● The sign bit should not be included in addition/ subtraction operations

One’s Complement Representation


● The one’s complement of a binary number is done
by complementing (i.e. inverting) all bits

1’s comp of 00110011 is 11001100

1’s comp of 10101010 is 01010101

● For a n-bit number N the 1’s complement is


(2n − 1) − N

● Tofind the negative of a 1’s complement number


take its 1’s complement

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

Two’s Complement Representation


● The two’s complement of a binary number is done
by complementing (inverting) all bits then adding1

2’s comp of 00110011 is 11001101

2’s comp of 10101010 is 01010110

● For an n-bit number N the 2’s complement is


(2n−1) − N + 1

● Tofind the negative of a 2’s complement number


take its 2’s complement

37
UNIT 1
NUMBER SYSTEM
Two’s Complement Shortcuts
● Algorithm 1: Complement each bit then add 1 to the result

N = 01100101 [N] = 10011011

10011010 01100100

+___________1 +_________1

10011011 01100101
● Algorithm 2: Starting with the least significant bit, copy all of the bits up to and

including the first‘1’ bit, then complement the remainingbits

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

● Binary Coded Decimal (BCD) represents each decimal digit

with four bits

● This is NOT the same as 0011001010012

● Why do this? Because people think in decimal


BCD BCD
Digit Code Digit Code

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

● BCD is not very efficient

● Used in early computers


(1940s, 1950s)

● Used to encode numbers for seven-segment displays

● Easier to read?

40
UNIT 2
CODES
GRAY CODE

● Gray code is not a number system

It is an alternate way to represent four bit data

● Only one bit changes fromone decimal digit to the next

● Useful for reducing errors in communication

● Can be scaled to larger numbers

Digit Binary 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

● ASCII is a 7-bit code, frequently used with a 8th bitfor


error detection (more about that later)
Character ASCII (bin) ASCII (hex) Decimal Octal
A 1000001 41 65 101
B 1000010 42 66 102
C 1000011 43 67 103

Z
a

1

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

0 0110000 10110000 00110000

X 1011000 01011000 11011000

= 0111100 10111100 00111100

BINARY DATASTORAGE

● Binary cells store individual bits of data

● Multiple cells form a register

● Data in registers can indicate different values

● Hex (binary)

● BCD

● ASCII

43
UNIT 2
CODES
REGISTER TRANSFER

● Data can move from a register to a register

● Digital logic used to process data

TRANSFER OF INFORMATION

● Data input at keyboard

● Shifted into place

● Stored in memory

NOTE: Data input inASCII

44
UNIT 2
CODES
BUILDING A COMPUTER

● We need processing

● We need storage

● We need communication

● You will learn to useand

design these components

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

Singh, Arun Kumar. Foundation of Logic and Switching design.2008.


https://www.pdfdrive.com/foundation-of-switching-theory-and-logic-design-as-per-jntu-
syllabus-e159787713.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.

Basic Logic Functions and Truth Tables. (n.d.). Retrieved from


https://learn.digilentinc.com/

46

You might also like