Logic Design - Slide - 1
Logic Design - Slide - 1
lecture 01
Introduction
Course Administration
Instructor: Dr. Hassen Khemaies MESTIRI
E_mail:
Office Place: (Room AF-10)
Office Hrs:
TA:
Tutorial:
Text Book: M. Morris Mano; “Digital Design”, 4thEdition, prentice
hall.
Prerequisite:
Recommended Text:
Notes: Lecture slides and Assignments
2
Course Objectives
Design of Digital logic systems.
Building large systems from
6
7
Why Digital?
Digital systems are easier to design and
implement than analog systems.
10
11
12
13
NUMBER SYSTEMS – Representation
(Number)r = (
i=n-1
Ai r )+(
i
j=-1
Aj r)j
i=0 j=-m
(Integer Portion) + (Fraction Portion)
Number Systems – Examples
General Decimal Binary Octal Hex.
Radix (Base) r 10 2 8 16
Digits 0 => r - 1 0 => 9 0 => 1 0 => 7 0 => F
0 r0 1 1 1 1
1 r1 10 2 8 16
2 r2 100 4 64 256
3 r3 1000 8 512 4096
Powers of 4 r4 10,000 16 4096 65536
Radix 5 r5 100,000 32 32768 1048576
-1 r -1 0.1 0.5 0.125 0.0625
-2 r -2 0.01 0.25 0.015625 0.00390625
-3 r -3 0.001 0.125 …. ….
-4 r -4 0.0001 0.0625 ….. ….
Decimal Number System
16
Binary Number system
18
Hexadecimal Number System
19
Numbers with different bases
20
Data Types
CONVERSION OF BASES
Base R to Decimal Conversion
(736.4)8 = 7 x 82 + 3 x 81 + 6 x 80 + 4 x 8-1
= 7 x 64 + 3 x 8 + 6 x 1 + 4/8 = (478.5)10
(110110)2 = ... = (54)10
(110.111)2 = ... = (6.875)10
(F3)16 = ... = (243)10
(0.325)6 = ... = (0.578703703 .................)10
EXAMPLE
Convert 41.687510 to base 2.
Fraction = 0.6875
Integer = 41
0.6875
41
x 2
20 1
1.3750
10 0
x 2
5 0
0.7500
2 1
x 2
1 0
1.5000
0 1
x 2
1.0000
(41)10 = (101001)2 (0.6875)10 = (0.1011)2
(41.6875)10 = (101001.1011)2
Exercise
Convert (63)10 to base 5: (223)5
Convert (1863)10 to base 8: (3507)8
Convert (0.63671875)10 to hexadecimal: (0.A3)16
Decimal to Octal Conversion
23
Decimal to Hex. Conversion
24
Binary to Hex. Conversion
25
Binary to Octal Conversion
26
Signed Numbers
27
Complements
COMPLEMENT OF NUMBERS
Two types of complements for base R number system:
- R's complement and (R-1)'s complement
Example
- 10's complement of 83510 is 16410 + 1 = 16510
- 2's complement of 10102 is 01012 + 1 = 01102
SIGNED NUMBERS Representation
Need to be able to represent both positive and negative numbers
- Following 3 representations
6 + (- 9) -6 + (-9)
9 1001 6 0110
-) 6 0110 +) 9 1001
- 3 0011 -> 10011 -15 1111 -> 11111
Overflow 9 + 9 or (-9) + (-9)
9 1001
+) 9 1001
overflow (1)0010
ARITHMETIC ADDITION:
SIGNED 2’s COMPLEMENT
Add the two numbers, including their sign bit, and discard any carry out of
leftmost (sign) bit - Look out for an overflow
Example
6 0 0110 -6 1 1010
+) 9 0 1001 +) 9 0 1001
15 0 1111 3 0 0011
6 0 0110 -9 1 0111
+) -9 1 0111 +) -9 1 0111
-3 1 1101 -18 (1)0 1110
(cn-1 cn)
9 0 1001 overflow
+) 9 0 1001
18 1 0010
(cn-1 cn)
Fixed Point Representations
ARITHMETIC ADDITION:
SIGNED 1’s COMPLEMENT
Add the two numbers, including their sign bits.
- If there is a carry out of the most significant (sign) bit, the result is
incremented by 1 and the carry is discarded.
-9 1 0110 9 0 1001
+) -9 1 0110 +) 9 0 1001
(1)0 1100 1 (1)0010
+) 1
0 1101
overflow
(cn-1 cn)
COMPARISON OF REPRESENTATIONS
* Hardware
* Speed of Arithmetic
ARITHMETIC SUBTRACTION
(A)-(-B) =(A)+ B
(A)- B=(A)+( -B)
36
Cont. Binary Codes
Given n binary digits (called bits), there
are 2n distinct elements that can be
represented.
But, you can represent m elements, m <
2n
Examples:
You can represent 4 elements with n = 2
bits: (00, 01, 10, 11).
You can represent 4 elements with n = 4
digits: (0001, 0010, 0100, 1000).
This second code is called a "one hot" code.
Non-numeric Binary Codes
Example: A
binary code
for the seven
colors of the
rainbow Color Binary Code
Code 100 is Red 000
Orange 001
not used Yellow 010
Green 011
Blue 101
Indigo 110
Violet 111
External Representations
Chapter 1 40
Warning: Conversion or Coding?
coding)
BCD Addition
BCD addition of two numbers involve following rules:-
1) Maximum value of the sum for two digits = 9 (max digit 1)
+ 9 (max digit 2) + 1 (previous addition carry) = 19
2) If sum of two BCD digits is less than or equal to 9 (1001)
without carry then the result is a correct BCD number.
3) If sum of two BCD digits is greater than or equal to 10
(1010) the result is in-correct BCD number. Perform steps
4 for correct BCD sum.
4) Add 6 (0110) to the result.
42
Example -BCD addition
Add 599 and 984 using BCD numbers
1 2 3
599 0101 1001 1001
+984 1001 1000 0100
1110 10001 1101
carry 1 1
Result 1110 10001 1101
+6 0110 0110 0110
1 0101 1000 0011
End Carry
Answer. Result of BCD addition is 1583
Exercise: add 599 + 484 using BCD addition 43
GRAY CODE – Decimal
ALPHANUMERIC CODES - ASCII Character
Codes
45
ASCII Code
PARITY BIT Error-Detection Codes
beven = b6 b5 ... b0
b6
b5 beven
b4
b3
b2
b1
b0
Parity Checker
beven
b6
b5
b4
b3
b2
b1 Even Parity
error indicator
b0