You are on page 1of 176

End Show

UNIT 2 Data Representation and Internal


Operations of the Computer

End Show
Unit 2 Data Representation and Internal
Operations of the Computer

2.1 Introduction to Number Systems


2.2 Data Representation
2.3 Logic Gates and Circuits
2.4 Boolean Algebra

End Show

Some ancient numerals

End Show

Some ancient numerals

End Show

Egyptian
3rd Century BC

End Show

Some ancient numerals

End Show

Cretan
1200-1700BC

End Show

Englands five-barred gate

The Greek Numeral System

End Show

End Show

Computation with Greek Numeral


System
Indo-Arabic
Indo-Arabic

End Show

Roman Numerals
1 I
2 II
3 III
4 IV
5 V
6 VI
10X
11XI
16XVI

20 XX
25 XXV
29 XIX
50 L
75 LXXV
100 C
500 D
1000M

Now try these:


1.
2.
3.
4.
5.

XXXVI
XL
XVII
DCCLVI
MCMLXIX

End Show
What is this ?
This is also a symbol

Why do we use this symbol ?


To represent quantity

Five (5)

End Show
Symbols to represent certain quantities
0
1

10

End Show
How do you represent this quantity on a spike abacus?

How do you represent this quantity

End Show

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

End Show

How Represent This Quantity

How Represent This Quantity

102

101

100

End Show

End Show

Abacus

Abacus is a Latin word, related to the Greek abax, meaning


table. The word `calculus originally meant pebble in Latin,
used on the counting board.

Roman
Abacus

Chinese
Abacus

Japanese
Soroban
(Abacus)

End Show

2.1 Introduction to the Number System


A number system defines a set of symbols used to
represent quantity.
Quantifying values and items in relation to each
other is helpful us to make sense of our environment .
The study of number system is not just limited to
computers. We use numbers every day. A computer
manipulates and stores numbers inside the computer
system.

Why we learn it?

End Show

These

symbols
are
processed
internally by components that can
maintain a limited number of discrete
states.

To

represent these states we have to


use number systems.
Ex: The decimal digits 0,1,2, ..,9 provide
10 discrete symbols (10 digits)

End Show
Decimal Number system Place Values
We normally use the decimal number system to
represent quantities and perform calculations.
342

Hundreds
3 x 100

Tens
4 x 10

Ones
2x1

End Show

343

Hundreds
3 x 100

Tens
4 x 10

Ones
3x1

End Show

344

Hundreds
3 x 100

Tens
4 x 10

Ones
4x1

End Show

345

Hundreds
3 x 100

Tens
4 x 10

Ones
5x1

End Show

346

Hundreds
3 x 100

Tens
4 x 10

Ones
6x1

End Show

347

Hundreds
3 x 100

Tens
4 x 10

Ones
7x1

End Show

348

Hundreds
3 x 100

Tens
4 x 10

Ones
8x1

End Show

349

Hundreds
3 x 100

Tens
4 x 10

Ones
9x1

End Show

350

Hundreds
3 x 100

Tens
5 x 10

Ones
0x1

End Show

Consider this number format 53410


The Base of the Decimal number here is 10
Normally we dont write base numbers in
decimal form
We can use digits 0 - 9

End Show

Face Value and Place value

Weighing Factor The weighing factor is the multiplier


value applied to each column position of the number.
For instance, a decimal has a weighing factor of TEN,
in that each column on the immediate left indicates
an increase in value by a multiple of 10.

i.e.; each column moves to the left increasing by a


multiple of 10.

312 = 300 + 10 + 2
= 3 * 100 + 1 * 10 + 2 * 1

100

= 3 * 102 + 1 * 101 + 2 *
Weighing factors

End Show

Decimal Number System(cont..)


The decimal Number System:

uses base 10

includes only the symbols 0 through 9

The weighed values for each position is as follows:

104

103

10000 1000

102

101

100

10-1

10-2

10-3

100

10

.1

.01

.001

Decimal number system (cont..)

End Show

This number system uses TEN different symbols to


represent values. The set values used in decimal are

0123456789
Lowest value

Highest value

When doing a calculation, if the highest digit (9) is exceeded, a


carry over transferred to the next column (to the left) occurs.
Lets

17+4
17
18
+1
19
+2
20
+3
21
+4
When 9 is exceeded, we reset (0), and carry a value of 1 to
the next column on the left

Binary number system

End Show

TWO symbols are used to represent


numerals in the binary number system.
These have the values of,
0
1
0 represents low value, and 1 represents
high value.
Position

..

Binary Value

24

23

22

21

20

Decimal
Value

x-1

End Show
More illustration..
The binary number system is also known as
the base 2 number system.
The values of the positions are calculated by
raising 2 to some power.
Why is 2 the base in binary numbers?
Because we use 2 digits, the digits 0 and 1.

Binary Number System (cont)

End Show

The binary number system is also a

positional numbering system.


Instead of using ten digits, 0 - 9, the binary
system uses only two digits, 0 and 1.
Example of a binary number and the position values :

1 0 0 1 1 0 1
2 6 25 2 4 2 3 22 2 1 20

End Show

Representation of the binary number

4
0 x 23

1 x 22

0101

1
0 x 21

1 x 20

Position

Binary Value

23

22

21

20

Decimal
Value

x-1

End Show

Binary Number System(cont)


uses base 2
includes only the digits 0 and 1

The weighted values for each position is as


follows:
27

26

25

24

23

22

21

20

128 64

32

16

Octal number system

End Show

The octal number system uses EIGHT symbols to


represent numbers. The 8 distinct symbols are,

01234567

With 0 having the lowest value and 7 having the


highest value

Columns are used in the same way as in the


decimal system in that, the left most column is
used to represent the greatest value

Octal numbers are represented with the base 8

End Show

Representation of octal number 314

64
64
64

0 x 83

3 x 82

1 x 81

1
1
1
1
4 x 80

Octal Number System

End Show

The Octal system is based on the binary system with a 3-bit


boundary. The Octal Number System:
uses base 8
includes only the symbols 0 through 7
The weighted values for each position is as follows:

85
84
32768 4096

83
512

82
64

81
8

80
1

End Show

Hexadecimal number system

The hexadecimal number system uses SIXTEEN


symbols to represent Numbers. The 16 distinct
symbols are, 0 1 2 3 4 5 6 7 8 9 A B C D E F,
where A = 10, B = 11, .., F = 15
With 0 having the lowest value and F having
the highest value.
Hexadecimal numbers are represented with the
base 16.

End Show

Representation of hexadecimal number 34F

16

0 x 163

256

16

256

16

256

16

1 x 162

4 x 161

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

F(15) x 160

The Hexadecimal Number System:

End Show

uses base 16
includes only the symbols 0 through 9 and
the letters A, B, C, D, E, and F to represent
10, 11, 12, 13, 14, and 15 respectively.
The weighted values for each position is as follows:

163
4096

162
256

161
16

160
1

2.1.2

End Show

Number Base Conversion

Binary to Decimal
Multiply each digit by its weighted position, and add
each of the weighted values.
Example
The binary value 1011 represents:
1x23 + 0x22 + 1x21 + 1x20
=1x8 + 0x4 + 1x2 + 1x1
=8 + 0 + 2 + 1
=11 (base 10)

Converting from Binary to


Decimal

1 0 0 1 1 0 1
2 6 2 5 24 2 3 2 2 2 1 2 0
20 = 1
21 = 2
22 = 4
23 = 8

24 = 16
25 = 32
26 = 64

End Show

X 20 = 1
0 X 2 1 = 0
1 X 2 2 = 4
1 X 2 3 = 8
0 X 2 4 = 0
0 X 2 5 = 0
1 X 26 = 64
7710

End Show
Decimal to Binary (Repeated Division By 2)
Division

Quotient

Remainder

47 / 2

23

Binary Number
1

47
23 --1

End Show
Decimal to Binary (Repeated Division By 2)
Division

Quotient

Remainder

Binary Number

47 / 2

23

23 / 2

11

11

47

23 --1
11 --1

End Show
Decimal to Binary (Repeated Division By 2)
Division

Quotient

Remainder

47 / 2

23

23 / 2

11

11 / 2

Binary Number
1

47

11 2 23 --1
111 2 11 --1
5

--1

End Show
Decimal to Binary (Repeated Division By 2)
Division

Quotient

Remainder

Binary Number

47 / 2

23

23 / 2

11

11

11 / 2

111

5/2

1111

47

2 23 --1
2

11 --1

--1

--1

End Show
Decimal to Binary (Repeated Division By 2)
Division

Quotient

Remainder

Binary Number

47 / 2

23

23 / 2

11

11

11 / 2

111

5/2

1111

2/2

01111

47

2 23 --1
2

11 --1

--1

--1

--0

End Show
Decimal to Binary (Repeated Division By 2)
Division

Quotient

Remainder

47 / 2

23

23 / 2

11

11

11 / 2

111

5/2

1111

2/2

01111

1/2

101111

4710 = 1011112

Binary Number
2

47

2 23 --1
2

11 --1

--1

--1

--0

--1

End Show

Ex. Lets find the binary equivalent of the


decimal number 254
254 / 2

gives 127 with remainder 0

End Show
Lets find the binary equivalent of the decimal
number 254
254 / 2

gives 127 with remainder 0

127 / 2

gives 63 with remainder 1

End Show

Lets find the binary equivalent of the decimal


number 254
254 / 2

gives 127 with remainder 0

127 / 2

gives 63 with remainder 1

gives 31 with remainder 1

63 / 2

End Show

Lets find the binary equivalent of the decimal number 254


254 / 2

gives 127 with remainder 0

127 / 2

gives 63 with remainder 1

63 / 2

gives 31 with remainder 1

31 / 2

gives 15 with remainder 1

End Show

Lets find the binary equivalent of the decimal number 254


254 / 2

gives 127 with remainder 0

127 / 2

gives 63 with remainder 1

63 / 2

gives 31 with remainder 1

31 / 2

gives 15 with remainder 1

15 / 2

gives

7 with remainder 1

End Show

Lets find the binary equivalent of the decimal number 254


254 / 2

gives 127 with remainder 0

127 / 2

gives 63 with remainder 1

63 / 2

gives 31 with remainder 1

31 / 2

gives 15 with remainder 1

15 / 2

gives

7 with remainder 1

7/2

gives

3 with remainder 1

End Show

Lets find the binary equivalent of the decimal number 254


254 / 2

gives 127 with remainder 0

127 / 2

gives 63 with remainder 1

63 / 2

gives 31 with remainder 1

31 / 2

gives 15 with remainder 1

15 / 2

gives

7 with remainder 1

7/2

gives

3 with remainder 1

3/2

gives

1 with remainder 1

End Show

Lets find the binary equivalent of the decimal number 254


254 / 2

gives 127 with remainder 0

127 / 2

gives 63 with remainder 1

63 / 2

gives 31 with remainder 1

31 / 2

gives 15 with remainder 1

15 / 2

gives

7 with remainder 1

7/2

gives

3 with remainder 1

3/2

gives

1 with remainder 1

1/2

gives

0 with remainder 1

111111102

Lets find the binary equivalent of the decimal number 254


254 / 2

gives 127 with remainder 0

127 / 2

gives 63 with remainder 1

63 / 2

gives 31 with remainder 1

31 / 2

gives 15 with remainder 1

15 / 2

gives

7 with remainder 1

7/2

gives

3 with remainder 1

3/2

gives

1 with remainder 1

1/2

gives

0 with remainder 1

LSB

MSB

111111102

End Show

End Show

Binary to Octal Conversion


It is easy to convert a binary number to an octal.
This is accomplished by:
1010111012
Most Significant Bit
(MSB)

Least Significant Bit


(LSB)

1. Break the binary number into 3-bit sections from the LSB to the MSB.
2. Convert the 3-bit binary number to its octal equivalent.

For example, the binary value 1010111110110010


will be written:

001

010

111

110

110

010

End Show
Conversion from Binary to Octal
Convert 10110111 to octal.
Each octal digit is represented by 3 binary bits.
Split the binary number into groups of 3 bits,
starting from the right.
10 110 111
=2 =6 =7
= 2678

End Show

Relationship between binary and octal


Octal Binary (in 3
bits)
0
000
1
001
2
010
3
011
4
100
5
101
6
110
7
111

End Show

Octal to Decimal Conversion

To convert from Octal to Decimal, multiply the value in each


position by its Octal weight and add each value.
Example, convert this octal 342 to decimal,
we can obtain the decimal value as follows:
3x82

4x81

2x80

3x64

4x8

2x1

192

32

8
64
64
64

8
8
8

3 x 82

4 x 81

2 x 80

192 + 32 + 2 = 226

End Show
Conversion from Octal to Decimal
Convert 1768 to decimal.
Each column represents a power of 8,
176 = 1 * 82 + 7 * 81 + 6 * 80
= (1 * 64) + (7 * 8) + (6 * 1)
= 64 + 56 + 6
= 126

Decimal to Octal ConversionEnd Show


To convert decimal to octal is slightly more difficult. The typical
method to convert from decimal to octal is repeated division by 8.
Repeated Division By 8
For this method, divide the decimal number by 8, and write the
remainder on the side as the least significant digit.
This process is continued by dividing the quotient by 8 and
writing the remainder until the quotient is 0.

Decimal to Octal ConversionEnd Show


To convert decimal to octal is slightly more difficult. The typical
method to convert from decimal to octal is repeated division by 8.
Repeated Division By 8
For this method, divide the decimal number by 8, and write the
remainder on the side as the least significant digit.
This process is continued by dividing the quotient by 8 and
writing the remainder until the quotient is 0.
Division
87 / 8

Quotient Remainder
10

Decimal to Octal ConversionEnd Show


To convert decimal to octal is slightly more difficult. The typical
method to convert from decimal to octal is repeated division by 8.
Repeated Division By 8
For this method, divide the decimal number by 8, and write the
remainder on the side as the least significant digit.
This process is continued by dividing the quotient by 8 and
writing the remainder until the quotient is 0.
Division

Quotient Remainder

87 / 8

10

10 / 8

Decimal to Octal ConversionEnd Show


To convert decimal to octal is slightly more difficult. The typical
method to convert from decimal to octal is repeated division by 8.
Repeated Division By 8
For this method, divide the decimal number by 8, and write the
remainder on the side as the least significant digit.
This process is continued by dividing the quotient by 8 and
writing the remainder until the quotient is 0.
Division

Quotient Remainder

87 / 8

10

10 / 8

1 / 8

8710 = 1278

End Show

Binary to Hexa Conversion


It is easy to convert a binary number to hexa.
This is accomplished by:

1.Break the binary number into 4-bit sections from the LSB to the
MSB.
2.Convert the 4-bit binary number to its Hexa equivalent.
For example, the binary value 1010111110110010 is
written:

1010
A

1111
F

1011
B

0010
2

End Show
Conversion from binary to hexadecimal
Convert 10110 to hexadecimal.
Each hexadecimal digit represents 4 binary
bits. Split the binary number into groups of 4
bits, starting from the right.
1
0110
1
6
=16 in hexadecimal

End Show

Relationship between Binary and


Hexadecimal
Hexadecimal Binary Hexadecimal Binar
(in 4 bits)

0
1
2
3
4
5
6
7

0000
0001
0010
0011
0100
0101
0110
0111

(in 4
bits)

8
9
A
B
C
D
E
F

1000
1001
1010
1011
1100
1101
1110
1111

Hexa to Binary ConversionEnd Show


It is also easy to convert from an integer hexa number to binary.
This is accomplished by:
Convert the Hexa number to its 4-bit binary equivalent.
Combine the 4-bit sections by removing the spaces.
For example the hexa value B2 is written in binary:

B
1011

2
0010

This yields the binary number 10110010 or 1011 0010 in


our more readable format.

End Show

Hexadecimal to Decimal Conversion

To convert from Hexa to Decimal, multiply the value in each


position by its hexa weight and add each value.
Using the value from the previous example, B216, we can obtain
the decimal value as follows:
B x 161

2 x 160

11 x 16

2 x 1

176

16
16
16
16
16
16
16
16
16
16
16

176 + 2 = 178
0 x 163

0 x 162

11 x 161

1
1
2 x 160

End Show
Conversion from hexadecimal to decimal
Convert hexadecimal 17616 to decimal.
Each column represents a power of 16,
17616= (1 * 162) + (7 * 161) + (6 * 160)
= (1 * 256) + (7 * 16 )+ (6 * 1)
= 256 + 112 + 6
= 374

End Show
Decimal to Hexa Decimal Conversion
To convert decimal to hexa is slightly more difficult. The typical
method to convert from decimal to hexa is repeated division by
16.
Repeated Division By 16
For this method, divide the decimal number by 16, and write the
remainder on the right hand side as the least significant digit.
This process is continued by dividing the quotient by 16 and writing
the remainder until the quotient is 0.

End Show
Ex: Convert decimal 2811 to hexa as follows:
Division
2811 / 16

Quotient Remainder
175

11 = B

End Show
Ex: Convert decimal 2811 to hexa as follows:
Division

Quotient Remainder

2811 / 16

175

11 = B

175 / 16

10

15 = F

End Show
Ex: Convert decimal 2811 to hexa as follows:
Division

Quotient Remainder

2811 / 16

175

11 = B

175 / 16

10

15 = F

10 / 16

10 = A

End Show
Ex: Convert decimal 2811 to hexa as follows:
Division

Quotient Remainder

2811 / 16

175

11 = B

175 / 16

10

15 = F

10 / 16

10 = A

281110 = AFB16

2.2 Data Representation

End Show

What is BIT (BINARY DIGIT)?

A bit is the smallest element of information


used in a computer
A bit holds ONE of TWO possible values,
A bit which is OFF is also considered to be FALSE or
NOT SET; a bit which is ON is also considered to be
TRUE or SET
Only one of two values(0 or 1) can be stored in a single
bit.

End Show
With a single bit, you can represent any two distinct
items.
Examples
one

or

zero

true or

false

on

off

or

male

or

right or

wrong

female

End Show
Data Representation

H
ASCII CODE IS 72

01001000

What is Byte ?

End Show

Bytes are a grouping of 8 bits


A byte is the smallest addressable datum (data item) in
the memory by the microprocessor.

End Show

The bits in a byte are filled from LSB (b0) to MSB (b7)
respectively as follows:

b7 b6 b5 b4 b3 b2 b1 b0
Most Significant Bit (MSB)

Least Significant Bit (LSB)

The Binary equivalent of the decimal number 205 is as


follows and the Most Significant Bit(MSB) and the Least
Significant Bit (LSB)can be defined as below :

1
MSB

1
LSB

End Show

Since a byte consists of eight bits, it can represent 28, or 256,


different values. Generally, we use a byte to represent:

Unsigned numeric values in the range 0 to 255

Signed numbers in the range -128 to +127

ASCII(American Standard Code for Information Interchange)


character codes

Other special data types requiring no more than 256


different values.

Many data types have fewer than 256 items so eight bits is
usually adequate.

Capacity of Various Units


8 bits = 1Byte
(2 10) 1024 Byte = 1 KB (kilobyte)
(210) 1024 KB = 1 MB (Megabyte)
(210) 1024 MB = 1 GB (Gigabyte)
(210 ) 1024 GB = 1 TB (Terabyte)
Unit conversion
1kiloByte = 210 bytes
1MegaByte= 220 bytes
1GigaByte = 230 bytes
1TeraByte = 240 bytes

End Show

End Show

2.2.2 Coding Systems


1. BCD (Binary Coded Decimal)
2. ASCII
(American Standard Code for
Information Interchange)

BCD - Binary Corded Decimal

End Show

@ Binary Coded Decimal is a numerical code.


@ In this code structure, each of the decimal digits
(0-9) is represented by a four-bit binary code
(eg: 3 is represented by 0011)
@ Each digit is then represented by it's binary
equivalent.
@ 16 unique(different) numbers can be stored in the
4 bit binary code.
@ Thus there are 6 invalid four-bit combinations in
the BCD code.

End Show
The number 59 is coded in BCD as follows
5

0101

1001

BCD code is 01011001

The number 386 is coded in BCD as follows:


3

0011

1000

0110

BCD code is 001110000110

This makes BCD easy to read, but it is not very efficient in


terms of storage space, nor is it as efficiently processed in
hardware.

End Show

Cont BCD
Valid Combinations
Decimal

BCD

0000

0001

0010

0011

0100

0101

0110

0111

1000

1001

Invalid Combinations
Decimal

BCD

10

1010

11

1011

12

1100

13

1101

14

1110

15

1111

End Show

Cont .BCD
Converting the Decimal value 546 to BCD
5 = 0101
4 = 0100
6 = 0110
Thus 54610 = 0101010001102

Converting the binary value 011100010101 to


decimal is
0111 = 7
0001 = 1
0101 = 5
Thus 0111000101012 = 71510

End Show
ASCII - The American Standard Code for
Information Interchange
The American National Standards Institute has
published an American Standards Code for
Information Interchange(ASCII)
This code is now most widely used by major
manufactures. so that their equipment will be
compatible with those of other manufactures.

End Show
ASCII is a computer code which uses 128
different coding combinations of a group of seven
bits (27= 128) to represent
Characters A to Z, both upper and lower
case
Special characters, < , ., ?, : ,etc.,
Numbers 0 to 9
Special control codes used in device control

The tables below gives the ASCII character set :HEX

DEC

CHAR

HEX

DEC

CHAR

41

65

61

97

42

66

62

98

43

67

63

99

44

68

64

100

58

End Show

HEX

DEC

CHAR

30

48

31

49

32

50

33

51

34

52

35

53

36

54

88

78

120

37

55

59

89

79

121

38

56

5A

90

7A

122

39

57

End Show
ASCII (Cont)

Example Code the text string 'Hello.' in


ASCII using hexadecimal digits.
H = 48
e = 65
l = 6C
l = 6C
o = 6F
. = 2E
Thus the string is represented by the byte sequence
48 65 6C 6C 6F 2E

2.3

Logic Gates and Circuits

Where are we?

End Show

End Show
A logic gate is an elementary building block of a digital circuit.
Most logic gates have two inputs and one output.
At any given moment, every terminal is in one of the two
binary conditions low (0) or high (1), represented by different
voltage levels.
In most logic gates, the low state is approximately zero volts
(0 V), while the high state is approximately five volts positive
(+5 V).
There are seven basic logic gates: AND, OR, XOR, NOT,
NAND, NOR, and XNOR.

End Show
Logic gates are small (several micron)
structures which take one or more bits
as input, and produce another bit as
output

Different logic gates use different


techniques to calculate their output

The most common logic gates used perform


the following logic functions:
AND : Output is True(1) if all inputs are True (1)
OR

: Output is False (0) if all inputs are False (0)

NOT : Output is the opposite of the single input


i.e., If input is true (1) the output is false (0)
If input is false (0) the output is true (1)

End Show

End Show

AND - Gate
The AND gate has two or more inputs.

The output from the AND gate is 1 if and only if all of the
inputs are 1, otherwise the output from the gate is 0.
The AND gate is drawn as follows

A.B
A
B

F=A.B

End Show

0
0

End Show

0
0

End Show

0
0

End Show

1
0

End Show

1
0

End Show

0
0

End Show

0
1

End Show

0
1

End Show

0
0

End Show

1
1

End Show

1
1

End Show

0
0

Truth table for AND gate


A
0
0
1
1

B
0
1
0
1

A.B
0
0
0
1

End Show
0
0
0
1
1
0
1
1

The output from the AND gate is written as A.B


The truth table for a two-input AND gate looks like

F=0

F=0

F=0

F=1

OR-Gate

End Show

The OR gate has two or more inputs.


The output from the OR gate is 1 if any of the inputs is 1.
The gate output is 0 if and only if all inputs are 0.
The OR gate is drawn as follows
A

A+B

A
B

F=A+B

End Show

0
0

End Show

0
0

End Show

End Show

End Show

1
0

End Show

1
0

End Show

End Show

End Show

0
1

End Show

0
1

End Show

End Show

End Show

1
1

End Show

1
1

End Show

End Show

Truth table for OR gate

F=0

0
0

A
0
0
1
1

B
0
1
0
1

A+B
0
1
1
1

F=1

1
1

F=1

0
1

F=1

The output from the OR gate is written as A+B


The truth table for a two-input OR gate looks like

End Show

NOT-Gate

End Show

The NOT gate is unique in that it only has one


input. It looks like

A
0
1

1
0

The input to the NOT gate A is inverted


i.e. The binary input state of 0 gives an output of 1 and the
binary input state of 1 gives an output of 0.

is known as "NOT A" or alternatively as the complement


of A.

End Show

Logic Gates from Transistors


For example, we will build a NOT gate from a
transistor.
extra
power
source
Input to
NOT gate.

Transistor

Output from
NOT gate.

End Show

Logic Gates from Transistors


For example, we will build a NOT gate from a
transistor.
extra
power
source

Input to
NOT gate
is ON.

Output from
NOT gate
is OFF.

Transistor
OFF

NOT 1 0

End Show

Logic Gates from Transistors


For example, we will build a NOT gate from a
transistor.
extra
power
source

Input to
NOT gate
is OFF.

Output from
NOT gate
is ON.

Transistor
ON

NOT 0 1

End Show

End Show

End Show

End Show

End Show

End Show

End Show

End Show

NAND-Gate
A

End Show
P A.B

The truth table for a two-input


NAND gate looks like

P A.B

0
0
1
1

0
1
0
1

1
1
1
0

End Show

NOR-Gate
A
B

P A B
The truth table for a twoinput NOR gate looks like
A

0
0
1
1

0
1
0
1

1
0
0
0

End Show

XOR-Gate

The truth table for a twoinput XOR gate looks like


A
P A B

P A B

A
0
0
1
1

B
0
1
0
1

P
0
1
1
0

2.4 Boolean Algebra


George Boole

A set of rules formulated by the English


mathematician George Boole describe certain
propositions whose outcome would be either true
or false. With regard to digital logic, these rules
are used to describe circuits whose state can be
either, 1 (true) or 0 (false).
In order to fully understand this, the
relation between the AND gate, OR gate and NOT
gate operations should be appreciated.
End Show

End Show

2.4.1 Basic Laws in Boolean Algebra


Algebra:

variables, values, operations

In Boolean algebra, the values are the symbols 0 and 1


If a logic statement is false, it has value 0
If a logic statement is true, it has value 1
Operations: AND, OR, NOT.

Laws of Boolean Algebra

End Show

T1 : Commutative Law

(a) A + B = B + A

(b) A.B = B.A

A+
B

B+
A

A+
B

B+
A

T2 : Associate Law

End Show

(a) (A + B) + C = A + (B + C)
A

(A+B
)

(A+B)
+C

(B+C
)

A+
(B+C)

Associate Law contd.

End Show

(b) (A.B).C = A.(B.C)


A

(A.B)

(A.B).C

(B.C)

A.(B.C)

T3 : Distributive Law

End Show

(a) A.(B + C) = A.B + A.C


A

(B+C
)

A.(B+C)

AB

AC

AB+AC

End Show

(b) A + (B.C) = (A + B) (A + C)
A

BC

A+(BC)

(A+B
)

(A+C)

(A+B).
(A+C)

T4 : Identity Law
(a) A + A = A

End Show
A

P=A+A

P=A.A

(b) A.A = A

T5 :(a)

End Show

AB A B A
AB A B

AB

B AB
1
0

End Show

(b) A B . A B A

A B

( A B ).( A B )

0
1

B A+B

T6 : Redundance Law

End Show

(a) A + A.B = A
A

A.B

A+A.B

0
0
1
1

(b) A.(A + B) = A
A

A+
B

A.(A+B)

0
0
1
1

T7 :

End Show

(a) 0 + A = A
0

0+
A

0
1

(b) 0 . A = 0
0

0.A

T8 :

End Show

(a) 1 + A = 1
1

1+
A

1.A

(b) 1 . A = A

T9 : (a)

(b)

A A 1

End Show

A A

A. A 0
A

A. A

T10 :A AB A B

End Show

AB

A AB

A+
B

A.B

A( A B ) AB
A

A B

A( A B )

T11 : De Morgan's Theorem

(a)

End Show

A B A.B
A

A+B

A B

A.B

A.B A B

(b)

A B

A.B
1

A.B

End Show