0% found this document useful (0 votes)
43 views

Logic Design - Slide - 1

Digital product design is an iterative design process used to solve a functional problem with a formal solution.[1] A digital product designer identifies an existing problem, offers the best possible solution, and launches it to a market that demonstrates demand for the particular solution.[2] The field is considered a subset of product design. Some digital products have both digital and physical components (such as Nike+ and Fitbit), but the term is mainly used for products produced through

Uploaded by

mansoor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Logic Design - Slide - 1

Digital product design is an iterative design process used to solve a functional problem with a formal solution.[1] A digital product designer identifies an existing problem, offers the best possible solution, and launches it to a market that demonstrates demand for the particular solution.[2] The field is considered a subset of product design. Some digital products have both digital and physical components (such as Nike+ and Fitbit), but the term is mainly used for products produced through

Uploaded by

mansoor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

CE1111 :Digital Logic Design

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

small components (logic gates)

EEG 481 Lec. 1 Introduction 3


Chapter 1 4
Course Outlines
 Number Systems (conversion and coding)
 Boolean Algebra
 Gate Level minimization
 Combinational Logic Design
 Synchronous sequential logic
 Registers and counters
 Memories and Programmable logic
5
What is the Meaning of Digital
Logic Design?
 Digital means:

6
7
Why Digital?
 Digital systems are easier to design and
implement than analog systems.

EEG 481 Lec. 1 Introduction 8


9
Digital Logic circuit

10
11
12
13
NUMBER SYSTEMS – Representation

 A number with radix r is represented by a string


of digits:
An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m + 1 A- m
in which 0 Ai < r and . is the radix point.
 The string of digits represents the power series:

(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

EEG 481 Lec. 1 Introduction 17


Octal Number system

18
Hexadecimal Number System

19
Numbers with different bases

The first 17 numbers


in decimal, Binary,
octal , and
Hexadecimal

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

Decimal to Base R number


- Separate the number into its integer and fraction parts and convert
each part separately.
- Convert integer part into the base R number
→ successive divisions by R and accumulation of the remainders.
- Convert fraction part into the base R number
→ successive multiplications by R and accumulation of integer digits
Data Types

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

The (R-1)'s Complement


Subtract each digit of a number from (R-1)
Example
- 9's complement of 83510 is 16410
- 1's complement of 10102 is 01012(bit by bit complement operation)

The R's Complement


Add 1 to the low-order digit of its (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

Signed magnitude representation


Signed 1's complement representation
Signed 2's complement representation
Example: Represent +9 and -9 in 7 bit-binary number

Only one way to represent +9 ==> 0 001001


Three different ways to represent -9:
In signed-magnitude: 1 001001
In signed-1's complement: 1 110110
In signed-2's complement: 1 110111
SIGNED NUMBERS Representation
Decimal Signed-2’s Signed-1’s Signed
complement complement Magnitude

-Range of Signed 2’s +7 0111 0111 0111


complement : -2n-1 to 2n-1-1 +6 0110 0110 0110
+5 0101 0101 0101
+4 0100 0100 0100
-Range of Signed 1’s
+3 0011 0011 0011
complement: -2n-1 +1 to 2n-1-1 +2 0010 0010 0010
+1 0001 0001 0001
-Range of Signed Magnitude: +0 0000 0000 0000
-2n-1 +1 to 2n-1-1 -0 - 1111 1000
-1 1111 1110 1001
-2 1110 1101 1010
-3 1101 1100 1011
-4 1100 1011 1100
-5 1011 1010 1101
-6 1010 1001 1110
-7 1001 1000 1111
-8 1000 - -
ARITHMETIC ADDITION:
SIGNED MAGNITUDE

[1] Compare their signs


[2] If two signs are the same, ADD the two magnitudes - Look out for an overflow
[3] If not the same , compare the relative magnitudes of the numbers and
then SUBTRACT the smaller from the larger --> need a subtractor to add
[4] Determine the sign of the result
6+9 -6 + 9
6 0110 9 1001
+) 9 1001 - ) 6 0110
15 1111 -> 01111 3 0011 -> 00011

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.

Example end-around carry


6 0 0110 -6 1 1001
+) -9 1 0110 +) 9 0 1001
-3 1 1100 (1) 0(1)0010
+) 1
3 0 0011
not overflow (cn-1  cn) = 0

-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

* Easiness of negative conversion

S + M > 1’s Complement > 2’s Complement

* Hardware

- S+M: Needs an adder and a subtractor for Addition


- 1’s and 2’s Complement: Need only an adder

* Speed of Arithmetic

2’s Complement > 1’s Complement(end-around C)


Fixed Point Representations

ARITHMETIC SUBTRACTION

Arithmetic Subtraction in 2’s complement

Take the complement of the subtrahend (including the sign bit)


and add it to the minuend including the sign bits.

(A)-(-B) =(A)+ B
(A)- B=(A)+( -B)

Example : (-6) – (-13) = +7 in 8-bit representation

11111010 – 11110011 = 11111010 + 00001101 = 00000111 (+7)


Binary codes
 Binary codes are used to represent
discrete elements of information
 The codes must be in binary that the
computer can only hold 0’s or 1’s.

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

DECIMAL CODES - Binary


Codes for Decimal Digits
Decimal BCD(8421) 2421 84-2-1 Excess-3
0 0000 0000 0000 0011 Note: 8,4,2,-2,1,-1 in this table is the weight
1 0001 0001 0111 0100 associated with each bit position.
2 0010 0010 0110 0101 d3 d2 d1 d0: symbol in the codes
3 0011 0011 0101 0110
4 0100 0100 0100 0111 BCD: d3 x 8 + d2 x 4 + d1 x 2 + d0 x 1
5 0101 1011 1011 1000  8421 code.
6 0110 1100 1010 1001 2421: d3 x 2 + d2 x 4 + d1 x 2 + d0 x 1
7 0111 1101 1001 1010 84-2-1: d3 x 8 + d2 x 4 + d1 x (-2) + d0 x (-1)
8 1000 1110 1000 1011 Excess-3: BCD + 3
9 1001 1111 1111 1100
Binary Coded Decimal (BCD)
 The BCD code is the 8,4,2,1 code.
 8, 4, 2, and 1 are weights
 BCD is a weighted code
 This code is the simplest, most
intuitive binary code for decimal digits
and uses the same powers of 2 as a
binary number, but only encodes the
first ten values from 0 to 9.

Chapter 1 40
Warning: Conversion or Coding?

 Do NOT mix up conversion of a


decimal number to a binary
number with coding a decimal
number with a BINARY CODE.
 1310 = 11012 (This is
conversion)
 13  0001|0011 (This is

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

 Binary Sum 1, 2 and 3 are greater than 1010.


 So, from Step 3 and 4 add ‘6’ to the sum.

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

 ASCII means “American Standard Code for Information


Interchange”
 The ASCII code assigns binary patterns for
- Numbers 0 to 9
- All the letters of English alphabet, uppercase and lowercase
- Many control functions (E.g. BS = Backspace, CR = Carriage
Return) and punctuation marks.
 The ASCII system uses 7 bits to represent each code

45
ASCII Code
PARITY BIT Error-Detection Codes

 parity, an extra bit appended onto the


code word to make the number of 1’s
odd or even.
 A code word has even parity if the
number of 1’s in the code word is even.
 A code word has odd parity if the
number of 1’s in the code word is odd.
4-Bit Parity Code Example
Even Parity Odd Parity
Message - Parity Message - Parity
000 - 0 000 - 1
001 - 1 001 - 0
010 - 1 010 - 0
011 - 0 011 - 1
100 - 1 100 - 0
101 - 0 101 - 1
110 - 0 110 - 1
111 - 1 111 - 0

 The codeword "1111" has even parity and the codeword


"1110" has odd parity. Both can be used to represent 3-bit
data.
PARITY BIT GENERATION

Parity Bit Generation

For b6b5... b0(7-bit information); even parity bit beven

beven = b6  b5  ...  b0

For odd parity bit

bodd = beven  1 = beven


Error Detecting codes

PARITY GENERATOR AND PARITY CHECKER

Parity Generator Circuit (even parity)

b6
b5 beven
b4
b3
b2
b1

b0

Parity Checker
beven
b6
b5
b4
b3
b2
b1 Even Parity
error indicator
b0

You might also like