SlideShare a Scribd company logo
1 of 21
Download to read offline
Department of Communication Engineering, NCTU 1
Unit 1 Introduction
1. Digital Systems
2. Number System and Conversion
3. Binary Arithmetic
Department of Communication Engineering, NCTU 2
1.1 Digital Systems
Department of Electrical Engineering, NCTU 3
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Digital Systems:
 A system that can perform data computation, storage and data
input and output in digital formats
 Why digital systems instead of analog systems?
 Easy and reliable control of data precision (number of bits)
 Easy and reliable circuit implementations (on/off switch)
 Applications of Digital Systems:
 Computation, data processing, signal acquisition and processing,
automatic control, communications and measurements, etc
Input/Output
Interface
Arithmetic/Logic Unit
Data Storage
Control Unit
Department of Electrical Engineering, NCTU 4
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Design of digital systems includes 3 phases:
 System design: design functions to meet specific applications
 Logic design : implement functions in logic gates
 Circuit design : design and implement logic gates
 System design involves functional definitions and system
partitions. The aspect of system design varies a lot
 Logic design means coming up with methods to
implement the defined functions, using basic logic units
 Circuit design here refers to the implementations of basic
logic units such as AND, OR, Flip-Flops, etc. with
resistors, diodes and transistors
 We will not cover circuit design in this course
Department of Electrical Engineering, NCTU 5
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 A simple digital system : Y = max { C, A+B}
 If C > A+B
Y=C
else
Y=A+B
 A simple logic implementation of the above system
Yes, C1=1
Start
A+B > C
Save Y
No, C1=0
C2
A B C
Adder
Comp
Mux
Y
C1
C2
Department of Electrical Engineering, NCTU 6
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Logic circuits can be categorized into two classes:
 Combinational logic
 Sequential Logic
 Combinational logic’s outputs depend only on the
present inputs:
 E.g. Adder, multiplier, comparator, multiplexer
 Sequential logic’s output depend on both the present
and the past outputs. In general, a sequential circuit is
composed of a combinational circuit with added
memory elements.
 E.g. C = A+B
E = C+D
F = CD
Department of Communication Engineering, NCTU 7
1.2 Number Systems and
Conversion
Department of Electrical Engineering, NCTU 8
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Base R representation of a rational number
 Any positive integer R > 1 can be chosen as the base of a
number
 E.g. : converting an octal number to decimal
3 82 + 2 81 + 1 80 + 1 8-1
= 192 + 16 + 1 + 0.125
= 208.125
4 3 2 1 0 1 2 3
4 3 2 1 0
4 3 2 1 0
1 2 3
1 2 3
( . )
0 1i
N a a a a a a a a
a R a R a R a R a R
a R a R a R
a R
  
  
  

          
      
  
 


其中where
Department of Electrical Engineering, NCTU 9
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 For bases greater than 10, more than 10 symbols are
needed to represent the digits
 Letters are usually used to represent digits greater than 9
 E.g., for a hexadecimal number, we have digits
0,1,2,3,…9,A,B,C,D,E,F
 E.g. : converting a hexadecimal to decimal
A 162 + 2 161 + B 160 + F 16-1
= 10 256 + 2 16 + 11 + 15/16
= 2603.9375
Department of Electrical Engineering, NCTU 10
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Conversion of a decimal number to base R
10 2
For integer,
53 110101
53 2 26 1
26 2 13 0
13 2 6 1
6 2 3 0
3 2 1 1

 
 
 
 
 





使用除法
10 2
For fraction,
.625 .101
.625 2 1.25 1
.25 2 0.5 0
.5 2 1.0 1

 
 
 
使用乘法use division use multiplication
Department of Electrical Engineering, NCTU 11
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Conversion between two bases R1 & R2 other than
decimal
 Convert from base R1 to decimal first, then convert the
decimal number to base R2
4 10 7231.3 45.75 63.5151
45 7 6 3
.75 7 5.25 5
.25 7 1.75 1
.75 7 5.25 5
 
 
 
 
 


Department of Communication Engineering, NCTU 12
1.3 Binary Arithmetic
Department of Electrical Engineering, NCTU 13
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Arithmetic operations in digital systems are usually done
in binary because design of logic circuits to perform
binary arithmetic is much simpler than decimal arithmetic
 We only need switches: On  1, OFF  0
 Binary addition
0 0 0
0 1 1
1 0 1
1 1 0 carry 1 to the next column
 
 
 
 
10
10
10
Ex.
1111 carries
13 = 1101
11 = 1011
24 11000

Department of Electrical Engineering, NCTU 14
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Binary subtraction
0 0 0
0 1 1 borrow 1 from the next column
1 0 1
1 1 0
 
 
 
 
Ex.
1 borrow
11101
10011
1010


Department of Electrical Engineering, NCTU 15
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Binary multiplication
0 0 0
0 1 0
1 0 0
1 1 1
 
 
 
 
Ex.
1101
1011
1101
1101
0000
1101
10001111

Department of Electrical Engineering, NCTU 16
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Binary division is similar to decimal division
Ex.
1101
1011 10010001
1011
1110
1011
1101
1011
10
Department of Communication Engineering, NCTU 17
1.4 Representation of Negative
Numbers
Department of Electrical Engineering, NCTU 18
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 For signed integer (both positive and negative integers), the first bit
in a word is used as a sign bit, with 0 for plus and 1 for minus
 There are 3 types of representations of negative numbers:
sign and magnitude, 2’s complement and 1’s complement
Department of Electrical Engineering, NCTU 19
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Sign and magnitude:
For an n-bit word, the first bit, the most significant bit (MSB), is the
sign and the remaining n-1 bits represent the magnitude
Ex. 0011=+3, 1011=-3
 2’s complement:
 A positive number is represented by a 0 followed by the magnitude
 A negative number is represented by its 2’s complement N*:
N* = 2n –N
 1’s complement:
 A negative number, -N, is represented by its 1’s complement of N
defined as
 Notice
 Therefore, if
 N* = 2n –N
(2 1)n
N N  
2 1 111 11 (n bits)n
  
00110001100111  NN
00110011*
 NN
Department of Electrical Engineering, NCTU 20
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Addition of 2’s complement numbers:
 E.g. 4-bit word, n = 4
5 –6 = –1
 5 + (2n –6) = 2n –1  2’s complement of 1
 So the addition is carried out just as if the numbers were positive
 The addition of two 4-bit words becomes a 5-bit word in general
 Do sign extension before addition
E.g. 5 + 6 = 11
By sign extension 5 = 00101, 6 = 00110
 5+6 = 01011
E.g. –5 –6 = –11
By sign extension, –5  24 –5 = 11010+1 = 11011
–6  24 –6 = 11001+1 = 11010
–11  25 –6 –5 = 10101  2’s complement of 11
Department of Electrical Engineering, NCTU 21
Logic Design Unit 1 Introduction Sau-Hsuan Wu
 Addition of 1’s complement numbers:
 Similar to 2’s complement except that instead of discarding the
last carry, it is added to the n-bit sum in the position furthest to
the right, least significant bit (LSB).
This is referred to as an end-around carry
 –A+B (B > A)  (2n 1 A) + B
= B A + (2n 1)  removing (2n 1)
 –A –B (A+B < 2n-1) 
(2n 1 A) + (2n 1 B) = [2n 1 (A+B)] + (2n 1)
 Similarly, do sign extension to protect from overflow
( 5) ( 6)
1010
0110
10000
1
0001
 
End-around carry

More Related Content

What's hot

Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversion
kanyuma jitjumnong
 

What's hot (20)

multiplexers and demultiplexers
 multiplexers and demultiplexers multiplexers and demultiplexers
multiplexers and demultiplexers
 
Subtractor
SubtractorSubtractor
Subtractor
 
Multiplexers & Demultiplexers
Multiplexers & DemultiplexersMultiplexers & Demultiplexers
Multiplexers & Demultiplexers
 
Digital electronics
Digital electronicsDigital electronics
Digital electronics
 
Design half ,full Adder and Subtractor
Design half ,full Adder and SubtractorDesign half ,full Adder and Subtractor
Design half ,full Adder and Subtractor
 
Digital logic design part1
Digital logic design part1Digital logic design part1
Digital logic design part1
 
Digital Logic Circuits
Digital Logic CircuitsDigital Logic Circuits
Digital Logic Circuits
 
Combinational circuit
Combinational circuitCombinational circuit
Combinational circuit
 
dld 01-introduction
dld 01-introductiondld 01-introduction
dld 01-introduction
 
Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoder
 
Encoder
EncoderEncoder
Encoder
 
SHIFT REGISTERS
SHIFT REGISTERSSHIFT REGISTERS
SHIFT REGISTERS
 
BCD ADDER
BCD ADDER BCD ADDER
BCD ADDER
 
Sequential circuits
Sequential circuitsSequential circuits
Sequential circuits
 
Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversion
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
 
Multiplexers and Demultiplexers
Multiplexers and DemultiplexersMultiplexers and Demultiplexers
Multiplexers and Demultiplexers
 
Encoders
EncodersEncoders
Encoders
 
Number systems ppt
Number systems pptNumber systems ppt
Number systems ppt
 
Types of flip flops ppt
Types of flip flops pptTypes of flip flops ppt
Types of flip flops ppt
 

Similar to Logic Design

100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt
namraashraf56
 
Computer organization and architecture lab manual
Computer organization and architecture lab manual Computer organization and architecture lab manual
Computer organization and architecture lab manual
Shankar Gangaju
 

Similar to Logic Design (20)

Module 4_Digital Electronics till complements.pdf
Module 4_Digital Electronics till complements.pdfModule 4_Digital Electronics till complements.pdf
Module 4_Digital Electronics till complements.pdf
 
Comp Arithmetic Basic.ppt
Comp Arithmetic Basic.pptComp Arithmetic Basic.ppt
Comp Arithmetic Basic.ppt
 
Unit-6 Computer Arithmetic.ppsx
Unit-6 Computer Arithmetic.ppsxUnit-6 Computer Arithmetic.ppsx
Unit-6 Computer Arithmetic.ppsx
 
Mazidi Presentation.pdf
Mazidi Presentation.pdfMazidi Presentation.pdf
Mazidi Presentation.pdf
 
DATA REPRESENTATION
DATA  REPRESENTATIONDATA  REPRESENTATION
DATA REPRESENTATION
 
About the computer of the important field
About the computer               of the important fieldAbout the computer               of the important field
About the computer of the important field
 
digital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptxdigital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptx
 
ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)
ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)
ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)
 
Numbersystemsppt 181023140730
Numbersystemsppt 181023140730Numbersystemsppt 181023140730
Numbersystemsppt 181023140730
 
Ch3
Ch3Ch3
Ch3
 
100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt
 
DLD-Introduction.pptx
DLD-Introduction.pptxDLD-Introduction.pptx
DLD-Introduction.pptx
 
Chapter_1_Digital_Systems_and_Binary_Numbers2.ppt
Chapter_1_Digital_Systems_and_Binary_Numbers2.pptChapter_1_Digital_Systems_and_Binary_Numbers2.ppt
Chapter_1_Digital_Systems_and_Binary_Numbers2.ppt
 
105_2_digitalSystem_Chap_3_part_3.ppt
105_2_digitalSystem_Chap_3_part_3.ppt105_2_digitalSystem_Chap_3_part_3.ppt
105_2_digitalSystem_Chap_3_part_3.ppt
 
digital systems and information
digital systems and informationdigital systems and information
digital systems and information
 
Digital Electronics and Computer Language
Digital Electronics and Computer Language Digital Electronics and Computer Language
Digital Electronics and Computer Language
 
Computer organization and architecture lab manual
Computer organization and architecture lab manual Computer organization and architecture lab manual
Computer organization and architecture lab manual
 
Okkkkk
OkkkkkOkkkkk
Okkkkk
 
Datarepresentation2
Datarepresentation2Datarepresentation2
Datarepresentation2
 
Data representation moris mano ch 03
Data representation   moris mano ch  03Data representation   moris mano ch  03
Data representation moris mano ch 03
 

More from Partha_bappa (13)

Alternative Vs Complementary Medicine
Alternative Vs Complementary MedicineAlternative Vs Complementary Medicine
Alternative Vs Complementary Medicine
 
Unit 07
Unit 07Unit 07
Unit 07
 
Unit 04
Unit 04Unit 04
Unit 04
 
Unit 03
Unit 03Unit 03
Unit 03
 
Unit 02
Unit 02Unit 02
Unit 02
 
Digital Communication
Digital CommunicationDigital Communication
Digital Communication
 
Media Literacy
Media LiteracyMedia Literacy
Media Literacy
 
Fourier supplementals
Fourier supplementalsFourier supplementals
Fourier supplementals
 
Biology questions answer
Biology questions answerBiology questions answer
Biology questions answer
 
INTERNAL Assign no 207( JAIPUR NATIONAL UNI)
INTERNAL Assign no   207( JAIPUR NATIONAL UNI)INTERNAL Assign no   207( JAIPUR NATIONAL UNI)
INTERNAL Assign no 207( JAIPUR NATIONAL UNI)
 
internal Assign no 206 ( JAIPUR NATIONAL UNI)
internal Assign no   206 ( JAIPUR NATIONAL UNI)internal Assign no   206 ( JAIPUR NATIONAL UNI)
internal Assign no 206 ( JAIPUR NATIONAL UNI)
 
INTERNATIONAL Assign no 205 (JAIPUR NATIONAL UNI)
INTERNATIONAL Assign no 205 (JAIPUR NATIONAL UNI)INTERNATIONAL Assign no 205 (JAIPUR NATIONAL UNI)
INTERNATIONAL Assign no 205 (JAIPUR NATIONAL UNI)
 
INTERNAL Assign no 4 ( JAIPUR INTERNAL UNI)
INTERNAL Assign no   4 ( JAIPUR INTERNAL UNI)INTERNAL Assign no   4 ( JAIPUR INTERNAL UNI)
INTERNAL Assign no 4 ( JAIPUR INTERNAL UNI)
 

Recently uploaded

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 

Recently uploaded (20)

Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Ghuma $ Russian Call Girls Ahmedabad ₹7.5k Pick Up & Drop With Cash Payment 8...
Ghuma $ Russian Call Girls Ahmedabad ₹7.5k Pick Up & Drop With Cash Payment 8...Ghuma $ Russian Call Girls Ahmedabad ₹7.5k Pick Up & Drop With Cash Payment 8...
Ghuma $ Russian Call Girls Ahmedabad ₹7.5k Pick Up & Drop With Cash Payment 8...
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
fitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .pptfitting shop and tools used in fitting shop .ppt
fitting shop and tools used in fitting shop .ppt
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 

Logic Design

  • 1. Department of Communication Engineering, NCTU 1 Unit 1 Introduction 1. Digital Systems 2. Number System and Conversion 3. Binary Arithmetic
  • 2. Department of Communication Engineering, NCTU 2 1.1 Digital Systems
  • 3. Department of Electrical Engineering, NCTU 3 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Digital Systems:  A system that can perform data computation, storage and data input and output in digital formats  Why digital systems instead of analog systems?  Easy and reliable control of data precision (number of bits)  Easy and reliable circuit implementations (on/off switch)  Applications of Digital Systems:  Computation, data processing, signal acquisition and processing, automatic control, communications and measurements, etc Input/Output Interface Arithmetic/Logic Unit Data Storage Control Unit
  • 4. Department of Electrical Engineering, NCTU 4 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Design of digital systems includes 3 phases:  System design: design functions to meet specific applications  Logic design : implement functions in logic gates  Circuit design : design and implement logic gates  System design involves functional definitions and system partitions. The aspect of system design varies a lot  Logic design means coming up with methods to implement the defined functions, using basic logic units  Circuit design here refers to the implementations of basic logic units such as AND, OR, Flip-Flops, etc. with resistors, diodes and transistors  We will not cover circuit design in this course
  • 5. Department of Electrical Engineering, NCTU 5 Logic Design Unit 1 Introduction Sau-Hsuan Wu  A simple digital system : Y = max { C, A+B}  If C > A+B Y=C else Y=A+B  A simple logic implementation of the above system Yes, C1=1 Start A+B > C Save Y No, C1=0 C2 A B C Adder Comp Mux Y C1 C2
  • 6. Department of Electrical Engineering, NCTU 6 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Logic circuits can be categorized into two classes:  Combinational logic  Sequential Logic  Combinational logic’s outputs depend only on the present inputs:  E.g. Adder, multiplier, comparator, multiplexer  Sequential logic’s output depend on both the present and the past outputs. In general, a sequential circuit is composed of a combinational circuit with added memory elements.  E.g. C = A+B E = C+D F = CD
  • 7. Department of Communication Engineering, NCTU 7 1.2 Number Systems and Conversion
  • 8. Department of Electrical Engineering, NCTU 8 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Base R representation of a rational number  Any positive integer R > 1 can be chosen as the base of a number  E.g. : converting an octal number to decimal 3 82 + 2 81 + 1 80 + 1 8-1 = 192 + 16 + 1 + 0.125 = 208.125 4 3 2 1 0 1 2 3 4 3 2 1 0 4 3 2 1 0 1 2 3 1 2 3 ( . ) 0 1i N a a a a a a a a a R a R a R a R a R a R a R a R a R                                    其中where
  • 9. Department of Electrical Engineering, NCTU 9 Logic Design Unit 1 Introduction Sau-Hsuan Wu  For bases greater than 10, more than 10 symbols are needed to represent the digits  Letters are usually used to represent digits greater than 9  E.g., for a hexadecimal number, we have digits 0,1,2,3,…9,A,B,C,D,E,F  E.g. : converting a hexadecimal to decimal A 162 + 2 161 + B 160 + F 16-1 = 10 256 + 2 16 + 11 + 15/16 = 2603.9375
  • 10. Department of Electrical Engineering, NCTU 10 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Conversion of a decimal number to base R 10 2 For integer, 53 110101 53 2 26 1 26 2 13 0 13 2 6 1 6 2 3 0 3 2 1 1                 使用除法 10 2 For fraction, .625 .101 .625 2 1.25 1 .25 2 0.5 0 .5 2 1.0 1        使用乘法use division use multiplication
  • 11. Department of Electrical Engineering, NCTU 11 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Conversion between two bases R1 & R2 other than decimal  Convert from base R1 to decimal first, then convert the decimal number to base R2 4 10 7231.3 45.75 63.5151 45 7 6 3 .75 7 5.25 5 .25 7 1.75 1 .75 7 5.25 5            
  • 12. Department of Communication Engineering, NCTU 12 1.3 Binary Arithmetic
  • 13. Department of Electrical Engineering, NCTU 13 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Arithmetic operations in digital systems are usually done in binary because design of logic circuits to perform binary arithmetic is much simpler than decimal arithmetic  We only need switches: On  1, OFF  0  Binary addition 0 0 0 0 1 1 1 0 1 1 1 0 carry 1 to the next column         10 10 10 Ex. 1111 carries 13 = 1101 11 = 1011 24 11000 
  • 14. Department of Electrical Engineering, NCTU 14 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Binary subtraction 0 0 0 0 1 1 borrow 1 from the next column 1 0 1 1 1 0         Ex. 1 borrow 11101 10011 1010  
  • 15. Department of Electrical Engineering, NCTU 15 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Binary multiplication 0 0 0 0 1 0 1 0 0 1 1 1         Ex. 1101 1011 1101 1101 0000 1101 10001111 
  • 16. Department of Electrical Engineering, NCTU 16 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Binary division is similar to decimal division Ex. 1101 1011 10010001 1011 1110 1011 1101 1011 10
  • 17. Department of Communication Engineering, NCTU 17 1.4 Representation of Negative Numbers
  • 18. Department of Electrical Engineering, NCTU 18 Logic Design Unit 1 Introduction Sau-Hsuan Wu  For signed integer (both positive and negative integers), the first bit in a word is used as a sign bit, with 0 for plus and 1 for minus  There are 3 types of representations of negative numbers: sign and magnitude, 2’s complement and 1’s complement
  • 19. Department of Electrical Engineering, NCTU 19 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Sign and magnitude: For an n-bit word, the first bit, the most significant bit (MSB), is the sign and the remaining n-1 bits represent the magnitude Ex. 0011=+3, 1011=-3  2’s complement:  A positive number is represented by a 0 followed by the magnitude  A negative number is represented by its 2’s complement N*: N* = 2n –N  1’s complement:  A negative number, -N, is represented by its 1’s complement of N defined as  Notice  Therefore, if  N* = 2n –N (2 1)n N N   2 1 111 11 (n bits)n    00110001100111  NN 00110011*  NN
  • 20. Department of Electrical Engineering, NCTU 20 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Addition of 2’s complement numbers:  E.g. 4-bit word, n = 4 5 –6 = –1  5 + (2n –6) = 2n –1  2’s complement of 1  So the addition is carried out just as if the numbers were positive  The addition of two 4-bit words becomes a 5-bit word in general  Do sign extension before addition E.g. 5 + 6 = 11 By sign extension 5 = 00101, 6 = 00110  5+6 = 01011 E.g. –5 –6 = –11 By sign extension, –5  24 –5 = 11010+1 = 11011 –6  24 –6 = 11001+1 = 11010 –11  25 –6 –5 = 10101  2’s complement of 11
  • 21. Department of Electrical Engineering, NCTU 21 Logic Design Unit 1 Introduction Sau-Hsuan Wu  Addition of 1’s complement numbers:  Similar to 2’s complement except that instead of discarding the last carry, it is added to the n-bit sum in the position furthest to the right, least significant bit (LSB). This is referred to as an end-around carry  –A+B (B > A)  (2n 1 A) + B = B A + (2n 1)  removing (2n 1)  –A –B (A+B < 2n-1)  (2n 1 A) + (2n 1 B) = [2n 1 (A+B)] + (2n 1)  Similarly, do sign extension to protect from overflow ( 5) ( 6) 1010 0110 10000 1 0001   End-around carry