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

15-Sep-20

Chapter 6

BOOLE Algebra AND


LOGIC CIRCUIT

Reference books
Reference books

Digital Systems - principles Digital design - Principles and Kỹ thuật số 1


and applications, Ronald J. Practices, John F. Wakerly, 4th Nguyễn Như Anh, NXB
Tocci, 10th Edition, Prentice- Edition, Prentice-Hall, 2001. ĐHQG TP.HCM, 2002.
Hall, 2001. 2

1
15-Sep-20

Analog and digital (Tương tự và số)

 Analog signal: is the signal that the graph


represents is a continuous function over time
 Digital signal: a signal that graphs represent as a
discrete (discontinuous) function over time.
 Analogue devices and systems
 Processing on continuous signals (e.g. audio signals
transmitted to 1 microphone)
 Digital Devices and systems
 Handling on discrete values of signals at each time,
this value is either 0 or 1 (for example: the light on or
off of a light bulb)

Example

 Typical analog
system

2
15-Sep-20

Typical digital and analog system

Digital divices and system today


 Today, the term "digital" has become very familiar
through widely used products: computers, smartphones,
tablets, music players, cameras / filming, automation,
robots, traffic, media and entertainment.

3
15-Sep-20

Advantages of the digital system

 Easy to design
 Easy to store
 High precision and less affected by noise
 Can be programmed
 Fast response speed
 Many digital circuits can be made into chips

DisAdvantages of the digital system

 Real-world signals/components mainly exist in


analog form: temperature, pressure, sound,
speed, etc.
 Converting data from analog to digital data for
processing, usually the following 3 steps are
applied:
 Convert analog signals from reality to digital form
 Processing on digital data
 Transfer the digital data at output to the analog form
and then export the results to the outside

4
15-Sep-20

Analog - digital

 Many systems combine analog and digital


processing to achieve the desired goal

CD drive

10110011101 Digital-to-analog Linear amplifier


Digital data converter Analog
reproduction
of music audio
Speaker
signal
Sound
waves

5
15-Sep-20

Logic concept in electric circuits

 H →logic 1(or 1) L→logic 1 (or 1)


 L →logic 0(or 0) H→logic 0 (or 0)
 Vlogic 1 > Vlogic 0 Vlogic 1 < Vlogic 0
 (Positive Logic) (Negative Logic)

State - logic level

 High: voltage from 2V to 5V


 Low: voltage from 0V to 0.8V
 Invalid: voltage from 0.8V to 2V
 Binary digit: the binary number
system uses 2 binary digits 0 and
1 to represent numbers, we are
also called 2 bits 0 and 1

6
15-Sep-20

Digital wave form (Dạng song số)

 The digital waveform changes between low and high or


vice versa.
 A pulse changes a positive-going pulse Xunh chuyển sang logic
dương) when it changes from a logic low to a logic high. The
opposite is called negative-going pulse.
 Digital waveforms are formed from sequences of coherent
pulses.

Positive-going pulse Negative-going pulse

7
15-Sep-20

Digital waveform – unideal

 Digital waveform carries binary information

 Timing scheme is used to show the relationship


between two or more digital waveform

8
15-Sep-20

Serial and parallel data

 Digital Data can be transmitted between two devices in a


serial or parallel fashion.

Process of digital design


 Process
Required design

Technical description
by diagram, flow chart

Design

Simulation
Re-design
The design works properly?

9
15-Sep-20

Real test Fixed error

Testing

Any error? Re-design


The design works
properly with
technical
description?

Finished products

Types of digital chips

 Based on characteristics and function


 Standard chip
 Contains a small amount of logic gates
 Execute simple functions and functions (NOT, AND, ..)
 For example, the 74xx family of chips

10
15-Sep-20

 Programmable Logic Devices (PLD) or Field-


Programmable Gate Array (FPGA))
 Set of unconnected gates, the connection between these gates
is programmed by the user through CAD tools
 The functionality of the chip can be designed by the user

Altera DE2 board with Cyclone II FPGAchip

 SPLD (simple programmable logic device)

 CPLD (complex programmable logic device)

11
15-Sep-20

 FPGA(field effect programmable gate array)

 Application-Specific Integrated Circuit (ASIC))


 Optimized for implementing a specific function
 Optimized performance, execution speed
 More logic circuits are integrated
 High price

An ASIC-based USBBitcoin miner. TheASIC


chip is on the bottom-left ofthe device
A tray of ASIC chips

12
15-Sep-20

Based on the integration of the logic gates

 Small Scale Integration – (SSI): 1 to 20 gates


 Medium Scale Integration – (MSI): from 20 to 200
 Large Scale Integration – (LSI): from 200 to 1.000.000
 Very Large Scale Integration – (VLSI): above 1.000.000
gates

Overview of basic logical functions


 Comparision function

 Arithmetic function

13
15-Sep-20

Code transform function

 Data selection function

14
15-Sep-20

 Registers store data

Digital Number system

 Radix of a system: is the number of digits used to


represent all values
 For example :
Number Radix Number of digits
system
Decimal 10 (D) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Binary 2 (B) 0, 1
Octadecimal 8 (O) 0, 1, 2, 3, 4, 5, 6, 7
Hexadecimal 16 (H) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
A, B, C, D, E, F

15
15-Sep-20

The Decimal system


 Example : 2745.21410 = 2745.214D=2745.214

 2745.21410 =
2 * 103 + 7 * 102 + 4 * 101 + 5 * 100 +
2 * 10-1 + 1 * 10-2 + 4 * 10-3

Binary system

 Example : 1011.1012 = 1011.101B

Binary point

 Transfer
 1011.1012 = 1 * 23 + 0 * 22 + 1 * 21 + 1 * 20 +
1 * 2-1 + 0 * 2-2 + 1 * 2-3

16
15-Sep-20

Octadecimal (O)
 Example: 3728 = 372O

 Represent
 372O = 3*82 + 7*81 + 2*80

Hexadecimal (H)

 Example : 3BA16 = 3BAH

 Represent
 3BAH = 3*162 + B*161 + A*160

17
15-Sep-20

Radix conversion
 Convert from any S-system to decimal
 Multiply each digit by the weight
 Conversion formula

 Thực hiện lấy tổng vế phải sẽ có kết quả cần tìm.

 In the above equation, ai and r are the coefficients


and the base is represented.

Binary to Decimal Conversion

 Convert from binary to decimal (B-D)


 Example: Convert 1101110.102 to decimal

18
15-Sep-20

Examples

 From B to D
 Example : 10012
10012 = 1x23 + 0x22 + 0x21 + 1x20 = 9
 From O to D
 Example : 162.438
162.438 = 1x82+6x81+2x80+4x8-1+3x8-2
 From H to D
 Example : 1E4A.6B16
1x163+Ex162+4x161+Ax160+6x16-1+Bx16-2
1x163+14x162+4x161+10x160+6x16-1+11x16-2

Convert from decimal to other systems

 Example: convert 13 to binary


 Result 13=11012

19
15-Sep-20

 Example 2 : 13.125
 Convert the whole part : 13=11012
 Convert the fraction part : 0.125
result whole part fraction part
 0.125 x 2 = 0.250 0 0.25
 0.25 x 2 = 0.50 0 0.5
 0.5 x 2 = 1.0 1 0 (finish)
 Result : 0012
 Combine whole-fraction : 1101.001

 Convert from Decimal to Octa (D – O)


 Example: 153.513
 Whole part : 153=2318
 Fraction part : 0.513
 Multiply result whole part fraction part
 0.513x 8 = 4.104 4 0.104
 0.104x 8 = 0.832 0 0.832
 0.832x 8 = 6.656 6 0.656
 0.656x8 = 5.248 5 0.28
 0.248x8 = 1.984 1 0.984…
 Result:406518
 Combine whole – fraction: 231.406518

20
15-Sep-20

 Convert from decimal to Hexadecimal (D – H)


 Example : 1023 = 3FFH

 Convert: B – O
 Convert: B – H
 Convert: O – B
 Convert: H – B
 Method 1 : using D as intermediaries
 B–D–O
 B–D–H
 O–D–B
 H–D–B
 Example : 1011111011111110 : differcult

21
15-Sep-20

 Method 2 : Use 2 comments :


 A digit in octal is equivalent to 3 digits in binary
 A digit in hexadecimal is equivalent to 4 digits in
binary
 Specific relations are presented in the following
table:

Relation tables 1

STT H B STT H B
0 0 0000 8 8 1000
1 1 0001 9 9 1001
2 2 0010 10 A 1010
3 3 0011 11 B 1011
4 4 0100 12 C 1100
5 5 0101 13 D 1101
6 6 0110 14 E 1110
7 7 0111 15 F 1111

22
15-Sep-20

Relation table 2

STT O B
0 0 000
1 1 001
2 2 010
3 3 011
4 4 100
5 5 101
6 6 110
7 7 111

 Example : convert from B to O and H


 1011111011111110

23
15-Sep-20

Arithmetic Operations

 The concept of LSB and MSB


 Consider the binary number:
765 4 3 21 0

100 1 1 110 = 1x27 + 0x26 +0x25 +1x24 +...


LSB : Least significant bit
MSB : Most significant bit

1Byte = 8 bit
1KB = 210 Byte = 1024 Byte
1MB = 210 KB = 1024 KB.
1GB = 210 MB = 1024 MB
47

Arithmetic operations

 Binary addition: 4 cases can be occur :


0 + 0 =0
1 + 0 =1
1 + 1 = 10 = 0 + carry 1 to next position.
1 + 1 + 1 = 11 = 1 + carry 1 to next position.
Example :
1 1. 0 1 1 (3.375)
1 0. 1 1 0 (2.750)
1 1 0. 0 0 1 (6.125)
48

24
15-Sep-20

Arithmetic Operations

 Binary substraction : 4 cases can be occur :


0–0=0
1–0=1
1–1=0
0 – 1 = 1 borrow 1
Example :
 Borrow 11 111
 subtrahend 100 111001
 Minus 011 1011
 Result 001 101110

49

Arithmetic operation

Binary multiply : 4 cases can be occur :


0x0=0
0x1=0
1x0=0
1x1=1
Example :

50

25
15-Sep-20

Signed Number Representation

 In the D system, to represent signed numbers, we use:


 Sign + refer positive number
 Sign – refer negative number
 In the B system without +, - . To represent signed numbers, use
bit MSB as the sign:
 Bit 1 refer negative number
 Bit 0 refer positive number
 The remaining bits represent magnitude
 Example : 0 1 1 0 1 0 0 = + 52 1 1 1 0 1 0 0 = - 52

sign bit sign bit


51

Signed Number Representation

 Notes:
 0 number has 2 results : 000000(+0) and 100000 (-0)
 Some calculations gave wrong results
 Example: assume 5-bit number, we consider :
0 1 0 0 0 (+ 8) 0 1 0 0 0 (+8)
+ 0 1 0 1 0 (+ 10) + 1 0 0 1 0 (-2)
1 0 0 1 0 ( - 2) false 1 1 0 1 0 (-10) false
 Therefore, the signed numbers must be expressed

by other methods, namely one complement and


two complement. 52

26
15-Sep-20

Signed Number Representation

 1’s complement: 1’s complement of a number A


is B such that when A + B is taken, we get the
sum of 1 in all positions.
 Example: A = 10110, B = 01001
 Find the 1’s complement of a number:
 Convert bit 1 to 0
 Convert bit 0 to 1
 Example: what is 1’s complement of:
110010
001101 53

Signed Number Representation


 2’s complement = 1’s complement + 1
 Example: what is 2’s complement of : 10010
 1’s complement : 01101
 2’s complement : + 1
01110
 Signed numbers represent 1’s comp: use rules
 Use bit MSB as sign: 0 - positive, 1 - negative
 The remaining bits represent the true value of the
positive or 1’s complement of negative number.
 Signed number n bits, can be present ranging from:
- (2n-1 -1) to (2n-1 - 1) 54

27
15-Sep-20

Signed Number Representation


 Example : use 6 bits
17 : 010001 26 : 011010
-17 : 101110 -26 : 100101
 Signed number representation use 2’s complement:

 Use bit MSB as sign : 0 – Positive, 1 – Negative


 The remaining bits represent the true value of the
positive or 2’s complement of negative number.
 Signed number n bits, can be present ranging from:
- 2n-1 to (2n-1 – 1)
 Example:17 : 010001 26 : 011010
55
-17 : 101111 -26 : 100110

Add and Subtract Numbers use 1’s comp

 A + B: normal addition, including the sign bit. If the result is


overflowed, add the MSB to the LSB.
 Example: Perform calculations :
11
13 001101 -13 110010
+11 +001011 -11 + 110100
+ 24 011000 -24 100110
+ 1
100111

56

28
15-Sep-20

Add and Subtract Numbers use 1’s comp

 A – B = A + (-B) : perform as addition.


 Exampel: perform subtraction
11
6 0110 0110
-3 -0011 +1100
3 0010
+1
0011

57

Add and Subtract Numbers use 2’s comp


 A+B : Normal addition, including the sign bit. If
the result is overflow (there is a 2n weighted bit)
then this bit is dropped.
 Example:

1 11 1
12 001100 -12 110100
+ 9 + 001001 + -9 +110111
21 010101 -21 1101011

drop: result is : 101011 58

29
15-Sep-20

Add and Subtract Numbers use 2’s comp

 A-B = A + (-B) : perform the same as additon.


 Example:
11 1
10 00101 01010
- 5 - 01010 + 11011
5 100101
Drop : result is : 00101

59

BCD code
 BCD (Binary Coded Decimal): Represent each
decimal digit using a 4-bit combination. In the
following table: STT D BCD code
0 0 0000
 Other combination 1 1 0001
not use: 2 2 0010
3 3 0011
 1010, 1011, 1100,
4 4 0100
1101, 1110, 1111
5 5 0101
Are called invalid. 6 6 0110
7 7 0111
8 8 1000
9 9 1001

30
15-Sep-20

 Example:
1941D = 11110010101 (use 11 bits–normal convert)
1941D = 0001 1001 0100 0001BCD (use 16 bits)
 Operations on BCD numbers

 A+B = S :
 Rules
 The number of memories in the low Decade is up to a high
decade and edit low decade
 If any decade of the total is> 9, it must be edited
 The editing is done by adding up to 6

 Example:
18 0001 1000
+ 26 + 0010 0110
44 0011 1110
+ 0110 Edit S0 (decade S0)
0100 0100

31
15-Sep-20

 Example:
1 (carry from decade S0)
28 0010 1000
+ 19 0001 1001
47 0100 0001
+ 0110 Edit S0
0100 0111

Logic gates and Operations

 Logic arithmetic
X Y X+Y X.Y X XY
0 0 0 0 1 0
0 1 1 0 1 1
1 0 1 0 0 1
1 1 1 1 0 0
 + is called OR
 . Is called AND
 _ is called NOT
  is called XOR

32
15-Sep-20

Logic gates

 Inverter gate (NOT inverter)


 Symbol:

 True table:

 Relatioship

A out
 Input – output relation : 0 1
Out  A 1 0
65

Logic gates

 AND gate A B out


 Perform mult operation
0 0 0
 The output is only equal to 1
0 1 0
when all inputs are 1
1 0 0
 Symbol :
1 1 1

 True table:
 Input-output relation :

out = A . B
66

33
15-Sep-20

Logic gates

 NAND gate
 Complement of AND logic

 Output is only 0 when all


inputs are equal to 1
 Symbol:
7400
A B out
0 0 1
 True table: 0 1 1
 Input-output relation : 1 0 1
out = A.B
1 1 0
67

Logic gates

 OR gate
 Perform OR operation logic

 Output is only 0 when all inputs are 0

 Symbol:

A B out
0 0 0
0 1 1
 True table:
1 0 1
 Input-ouput relation :
out = A + B 1 1 1
68

34
15-Sep-20

Logic gates

 NOR gate
 Complement of OR logic operation

 The output is only equal to 1 when all inputs are 0

 Symbol :

A B out
0 0 1
0 1 0
 True table: 1 0 0
 Input-output relation : 1 1 0
out = A + B
69

Logic gates

 EXOR gate (Exclusive OR)


 Perform module 2

 The output is only zero when all the inputs are the same

 Symbol :

A B out
 True table: 0 0 0
 Input-output relation: 0 1 1
1 0 1
out  A  B  A.B  A.B 1 1 0
70

35
15-Sep-20

Logic gates

 EXNOR gate
 Complement of XOR logic operation

 The output is only equal to 1 when all the inputs are

the same
 Symbol :

A B out
0 0 1
0 1 0
 True table: 1 0 0
 Input-output relation : 1 1 1
out  A  B  A.B  A.B 71

36

You might also like