S1 - Cse231 - Summer 2024 - Muu

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 75

CSE231 Digital Logic

July 11 2024
Prof. Dr. Muhammad Shahin Uddin
Email: [email protected]
Textbook:
Digital Design
Morris Mano and Michae D. Ciletti, 2012, 5th Edition Pearson Education, ISBN-13:
978-0-13-277420-8

Reference Books:
1. Digital Design: Principles and Practices, J F Wakerly, 4thed, Prentice Hall, 2005
2. Digital Logic Techniques, T J Stonham, 3rded, Chapman & Hall, 1996
Class Structure:
1. Lecture : Attendance and participation of all of them are strongly encouraged.

2. Laboratory : You must pass in your lab to attain a passable grade in theory. 20%
marks from your lab will be directly added to your theory

3. Creative Assignment : You will be given some design assignments. You will use
pen and papers and tools to solve those problems.

4. Viva/Presentation: You will have to face viva or present your work any suitable
time assigned by course teacher.

5. Quiz: There will be several quizzes.

5. Examination: There will be one midterm, one final examination.


Marks Distribution:
Assessment Tools Weightage (%)
Attendance 10
Viva/Presentation 10
Quizzes 20
Creative Assignment 05
Midterm 25
Final Term 30
Lecture Outlines:
Course Contents:
• This course provides an introduction to logic design and basic tools for the design
of digital logic systems. A basic idea of number systems will be provided,
followed by a discussion on combinational logic: logic gates, Boolean algebra,
minimization techniques, arithmetic circuits (adders, subtractors), basic digital
circuits (decoders, encoders, multiplexers, shift registers), programmable logic
devices (PROM, PAL, PLA). The course will then cover sequential circuits: flip-
flops, state transition tables and diagrams, state minimization, state machines,
design of synchronous/asynchronous counters, RAM/ROM design. An
introduction to programmable logic will also be provided. Hands-on experience
will be provided through project on design of a sequential logic system. This
course has separate mandatory laboratory session every week as CSE 231L.
Lecture Outlines:
 Course Objective:
• The objectives of this course are:
• To introduce different number system and their application
• To introduce Boolean logic operation and Boolean Algebra
• To teach students how to use Boolean Algebra and K-maps to realize two-level
minimal/optimal combinational circuits
• To exposed students in the introductory design process of combinational and sequential
circuits
• To teach the operation of latches, flip-flops, counters and registers.
• To explain how to analyze and design sequential circuits built with various flip-flops.
• To understand the importance of state diagram representation of sequential circuits.
• To analyze and design clocked sequential circuits.
• To introduce using simulation tool for digital system design.
Important Dates:

• Quizzes After completion of every topic

• Mid Term Examination

• Final Examination Department will publish the date


Digital Logic Design
• Let me ask you few questions first…..(prerequisite knowledge?)

• Did you take course on electrical circuits ??

• Did you take course on electronics (Analog) ??

• Do you know about signals (Analog/digital) ??


Digital Systems and Numbers
 Digital Systems
 Binary Numbers
 Number-base Conversions
 Octal and Hexadecimal Numbers
 Complements
 Signed Binary Numbers
 Binary Codes
Digital Systems
Takes a set of discrete information inputs and discrete internal information
(system state) and generates a set of discrete information outputs.

Discrete Discrete
Inputs Information
Processing Discrete
System Outputs

System State
Digital Systems
 Application of Digital System
 Communication  Digital TV
 Business transactions  Digital telephones
 Traffic control  Digital televisions
 Spacecraft guidance  Digital versatile discs
 Medical treatment  Digital cameras
  Handheld devices, and
Weather monitoring
  Digital computers
Internet
 Many other commercial, industrial, and
 Telephone switching exchanges
scientific enterprises.
 Digital camera
 Electronic calculators, PDA's
Analog and Digital Signal
Analog system
• The physical quantities or signals may vary continuously over a specified range.
Digital system
• The physical quantities or signals can assume only discrete values.
• Greater accuracy
Binary Digital Signal
 An information variable represented by physical quantity.
 For digital systems, the variable takes on discrete values.
• Two level, or binary values are the most prevalent values.
 Binary values are represented abstractly by:
• Digits 0 and 1
• Words (symbols) False (F) and True (T)
• Words (symbols) Low (L) and High (H)
• And words on and off
 Binary values are represented by values or
ranges of values of physical quantities.
Number System
Non-Positioned Number
System

Roman Number
Positioned Number System

I = 1, V = 5, X = 10, L = 50, C = 100, D = 500,


M = 1000.

1999 is MCMXCIX, or M (1000) + CM


(1000-100) + XC (100-10) + IX (10-1).
Decimal Number System
 Base (also called radix) = 10
• 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
 Digit Position
• Integer & fraction
 Digit Weight
• Weight = (Base) Position
 Magnitude
• Sum of “Digit x Weight”
 Formal Notation
Octal Number System
 Base = 8
• 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
 Weights
• Weight = (Base) Position
 Magnitude
• Sum of “Digit x Weight”
 Formal Notation
Binary Number System
 Base = 2
• 2 digits { 0, 1 }, called binary digits or “bits”
 Weights
• Weight = (Base) Position
 Magnitude
• Sum of “Bit x Weight”
 Formal Notation
 Groups of bits
8 bits = Byte
Binary Number
Hexadecimal Number System
 Base = 16
 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
 Weights
 Weight = (Base) Position
 Magnitude
 Sum of “Digit x Weight”
 Formal Notation
The Power of 2
Number Base Conversions
Decimal (Integer) to Binary Conversion
 Divide the number by the ‘Base’ (=2)
 Take the remainder (either 0 or 1) as a coefficient
 Take the quotient and repeat the division
 Example:
Decimal (Fraction) to Binary Conversion
 Multiply the number by the ‘Base’ (=2)
 Take the integer (either 0 or 1) as a coefficient
 Take the resultant fraction and repeat the division
 Example:
Decimal (Fraction) to Binary Conversion
 Multiply the number by the ‘Base’ (=2)
 Take the integer (either 0 or 1) as a coefficient
 Take the resultant fraction and repeat the division
 Example:
Decimal to Octal Conversion
Binary− Octal Conversion
Binary−Hexadecimal Conversion
Prof. Dr. Muhammad Shahin Uddin
Email: [email protected]
Out
Ashraful.sarker@nort
Octal−Hexadecimal Conversion
Decimal, Binary, Octal and Hexadecimal
Addition
Binary Addition
Binary Subtraction
Binary Multiplication
Base Conversion
• Examples:
• (11010)2 =( ? )10
N = 1´24 + 1´23 + 0´22 + 1´21 + 0´20
= (16)10 + (8)10 + 0 + (2)10 + 0
= (26)10
• (627)8 = ( ? )10
N = 6´82 + 2´81 + 7´80
= (384)10 + (16)10 + (7)10
= (407)10

34
Base Conversion

• (11010)2 ®( ? )10
N = 1´24 + 1´23 + 0´22 + 1´21 + 0´20
= (16)10 + (8)10 + 0 + (2)10 + 0
= (26)10
• (627)8 ® ( ? )10
N = 6´82 + 2´81 + 7´8 0

= (384)10 + (16)10 + (7)10


= (407)10

35
Examples of Base Conversion (3)

• (315)10 = (473)8

• (315)10 = (13B)16
Base Conversion (5)
• (0.479)10 = (0.3651…)8
MSD 3.832 ¬ 0.479 ´ 8
6.656 ¬ 0.832 ´ 8
5.248 ¬ 0.656 ´ 8
LSD 1.984 ¬ 0.248 ´ 8

• (0.479)10 = (0.0111…)2
MSD 0.9580 ¬ 0.479 ´ 2
1.9160 ¬ 0.9580 ´ 2
1.8320 ¬ 0.9160 ´ 2
LSD 1.6640 ¬ 0.8320 ´ 2

Example 1
Convert decimal 41 to binary. First, 41 is divided by 2 to give an integer quotient of 20
and a remainder of . Then the quotient is again divided by 2 to give a new quotient and
remainder. The process is continued until the integer quotient becomes 0. The
coefficients of the desired binary number are obtained from the remainders as follows:
Example 1
Convert decimal 41 to binary. First, 41 is divided by 2 to give an integer quotient of 20
and a remainder of . Then the quotient is again divided by 2 to give a new quotient and
remainder. The process is continued until the integer quotient becomes 0. The
coefficients of the desired binary number are obtained from the remainders as follows:
Example 1
Convert decimal 41 to binary. First, 41 is divided by 2 to give an integer quotient of 20
and a remainder of . Then the quotient is again divided by 2 to give a new quotient and
remainder. The process is continued until the integer quotient becomes 0. The
coefficients of the desired binary number are obtained from the remainders as follows:
Example 2
Example 2
Complements
 r’s complements
 (r-1)’s complements

r’s (r-1)’s
r=10 10’s com 9’s
r=2 2’s com 1’s
r=8 8’s com 7’s
r=16 16’s com 15’s
Complements
 Complement number system:
• An alternative representation of numbers in a fixed-radix number
system.
 Why complement of a number is used?
• Simplify the subtraction operation
• Logical manipulations.
 For each radix-r system (radix r represents base
of number system) there are two types of complements.
Binary Subtraction using 1’s complement
 Step 1: Convert number to be subtracted to it’s 1’s complement.
 Step 2: Perform addition
 If the final carry is 1 then add it to the results obtained in step 2 is negative in
step 2
 Example: Perform (1100)2 –(0101)2
A=1100 and B=0101
1’s complement of B =1010=-B
1100
1010
101 1 0
1
01 1 1
Complements
 There are two types of complements for each base-r system: the radix complement and
diminished radix complement.
 Diminished Radix Complement - (r-1)’s Complement
• Given a number N in base r having n digits, the (r–1)’s complement of N is defined as:
(rn –1) – N
 Example for 6-digit decimal numbers:
• 9’s complement is (rn – 1)–N = (106–1)–N = 999999–N
• 9’s complement of 546700 is 999999–546700 = 453299
 Example for 7-digit binary numbers:
• 1’s complement is (rn – 1) – N = (27–1)–N = 1111111–N
• 1’s complement of 1011000 is 1111111–1011000 = 0100111
 Observation:
• Subtraction from (rn – 1) will never require a borrow
• Diminished radix complement can be computed digit-by-digit
• For binary: 1 – 0 = 1 and 1 – 1 = 0
Complements
Complements
Radix Complement:
The r’s complement of an n digit number in base r is defined as (r n-N) for N≠0
and as 0 for N=0. Comparing the (r-1)’s complement, we note that the r’s
complement is obtained by adding 1 to the (r-1)’s complement, since
(rn-N)=[(rn-1)-N]+1.
Complements
Radix Complement:
The r’s complement of an n digit number in base r is defined as (r n-N) for N≠0
and as 0 for N=0. Comparing the (r-1)’s complement, we note that the r’s
complement is obtained by adding 1 to the (r-1)’s complement, since
(rn-N)=[(rn-1)-N]+1.

1000000-1=9999999
999999-
012398=987601+1

1 1 1 1 1 1 1
-1 1 0 1 1 0 0
= ------------------------
0 0 1 0 1 0 0
+ 1
0 0 1 0 1 0 0
Complements
Complements
 Subtraction with Complements
• The subtraction of two n-digit unsigned numbers M – N in base r can be done
as follows:
Complements
Complements
Signed Binary Numbers
Signed Binary Numbers
Signed Binary Numbers
Binary Codes
Binary Code
Binary Code
Binary Codes
 Other Decimal Codes – weighted representation of decimal numbers in
binary.
Gray Code
 Definition: Gray Code is the minimum-change code category of coding in
which, the two consecutive values changes by only a single bit. More
specifically we can say, it is a binary number system where while moving
from one step to the next, only a single bit shows variation.

 The advantage is that only bit in the code group changes in going from one
number to the next.
• Error detection.
• Representation of analog data.
• Low power design
Gray Code
The conversion process from binary code to a gray involves
theBinary to Gray Code Conversion
following steps:
 Firstly, record the most significant bit or MSB or the
leftmost bit of the given
 binary data as it is, to have MSB of gray equivalent.
 Now, proceed towards adding the adjacent bits of the
binary data starting from MSB with its adjacent bit to
LSB. While adding, put the summation obtained in place
of next bit and ignoring the carry.
 Repeat the same process for all the bits in the sequence
till LSB.
 This is how the binary code is converted into gray
equivalent.
BCD-to-Excess-3 Code converter
BCD is a code for the decimal digits 0-9
Excess-3 is also a code for the decimal digits
 Specification of BCD-to-Excess3
Inputs: a BCD input, A,B,C,D with A as the most significant bit and D as the
least significant bit.
 Outputs: an Excess-3 output W,X,Y,Z that corresponds to the BCD input.
Internal operation – circuit to do the conversion in combinational logic.

 Formulation of BCD-to-Excess-3
 Excess-3 code is easily formed by adding a binary 3 to the binary or BCD
for the digit.
 There are 16 possible inputs for both BCD and Excess-3.
 It can be assumed that only valid BCD inputs will appear so the six
combinations not used can be treated as don’t cares.
ASCII Code
 ASCII is the acronym for the American Standard Code for Information
Interchange. It is a code for representing 128 English characters as numbers,
with each letter assigned a number from 0 to 127. For example, the ASCII
code for uppercase M is 77.
 ASCII, a standard data-transmission code that is used by smaller and less-
powerful computers to represent both textual data (letters, numbers, and
punctuation marks) and noninput-device commands (control characters).
ASCII Code
• American Standard Code for Information Interchange (ASCII) Character Code
ASCII Code
ASCII Character Codes
 American Standard Code for Information Interchange
 A popular code used to represent information sent as character-based data.
 It uses 7-bits to represent:
• 94 Graphic printing characters.
• 34 Non-printing characters.
 Some non-printing characters are used for text format (e.g. BS = Backspace,
CR = carriage return).
 Other non-printing characters are used for record marking and flow control
(e.g. STX and ETX start and end text areas).
ASCII Properties
 ASCII has some interesting properties:
• Digits 0 to 9 span Hexadecimal values 3016 to 3916
• Upper case A-Z span 4116 to 5A16
• Lower case a-z span 6116 to 7A16
 Lower to upper case translation (and vice versa) occurs by flipping bit
6.
Extended ASCII Code/ Error Detection Code
 To detect errors in data communication and processing, an eighth bit is sometimes
added to the ASCII character to indicate its parity.
 A parity bit is an extra bit included with a message to make the total number of 1’s
either even or odd.
 Consider the following two characters and their even and odd parity:

 The parity bit is helpful in detecting errors during the transmission of information.
 Handled by generating an even parity bit at the sending end for each character.
 The eight‐bit characters that include parity bits are transmitted to their destination.
 The parity of each character is then checked at the receiving end.
 If the parity of the received character is not even, then at least one bit has changed
value during the transmission.
Binary Codes
 In the coding, when numbers, letters or words are represented by a specific group of
symbols, it is said that the number, letter or word is being encoded.
 The group of symbols is called as a code.
 The digital data is represented, stored and transmitted as group of binary bits.
 This group is also called as binary code. The binary code is represented by the
number as well as alphanumeric letter.
Advantages of Binary Code
 Binary codes are suitable for the computer applications.
 Binary codes are suitable for the digital communications.
 Binary codes make the analysis and designing of digital circuits if we use the binary
codes.
 Since only 0 & 1 are being used, implementation becomes easy.
Classification of binary codes
The codes are broadly categorized into following four categories.
 Weighted Codes
 Non-Weighted Codes
 Binary Coded Decimal Code
 Alphanumeric Codes
 Error Detecting Codes
 Error Correcting Codes
Weighted Codes
 Weighted binary codes are those binary codes which obey the positional weight
principle. Each position of the number represents a specific weight. Several systems of
the codes are used to express the decimal digits 0 through 9. In these codes each
decimal digit is represented by a group of four bits.
Non-Weighted Codes
 In this type of binary codes, the positional weights are not assigned. The examples
of non-weighted codes are Excess-3 code and Gray code.
EXCESS-3 CODE
The Excess-3 code is also called as XS-3 code. It is non-weighted code used to
express decimal numbers. The Excess-3 code words are derived from the 8421
BCD code words adding (0011)2 or (3)10 to each code word in 8421. The excess-
3 codes are obtained as follows
THANKS

You might also like