Cs302_Lec01

Post on 23-Nov-2014

61 views 3 download

Tags:

transcript

Digital Logic & Design

Dr. Waseem Ikram

Lecture 01

Analogue QuantitiesAnalogue Quantities

Continuous QuantityContinuous Quantity Intensity of LightIntensity of Light TemperatureTemperature VelocityVelocity

Digital ValuesDigital Values

Discrete set of valuesDiscrete set of values

Continuous SignalContinuous Signal

0

5

10

15

20

25

30

35

40

45

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

time

tem

per

atu

re

0 C

Continuous SignalContinuous Signal

1 24

7

34

2523

37

29

42 41

2522

18

35

0

5

10

15

20

25

30

35

40

45

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

time

tem

per

atu

re

0 C

Digital RepresentationDigital Representation

1 24

7

18

34

2523

3537

29

42 41

2522

0

5

10

15

20

25

30

35

40

45

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

samples

tem

per

atu

re

0 C

Under SamplingUnder Sampling

0

5

10

15

20

25

30

35

40

45

1 3 5 7 9 11 13 15

samples

tem

per

atu

re

0 C

Electronic ProcessingElectronic Processing

Analogue SystemsAnalogue Systems Digital SystemsDigital Systems Representing quantities in Digital SystemsRepresenting quantities in Digital Systems

Representing Digital ValuesRepresenting Digital Values

39 39 00C ?C ?

a1

1

a2

2 3a

3

4a

4

b1

b2

b3

b4

5 6 7 8

Vcc

10

GN

D 01mV = 1

39mV39mV

6.25 x 106.25 x 101515 V !! V !!

DigitalDigital SystemSystem

6.25 x 106.25 x 101818 ? ?

Digital SystemsDigital Systems

Two Voltage LevelsTwo Voltage Levels Two StatesTwo States

– On/Off– Black/White– Hot/Cold– Stationary/Moving

Binary Number SystemBinary Number System

Binary NumbersBinary Numbers Representing Multiple ValuesRepresenting Multiple Values Combination of 0v & 5vCombination of 0v & 5v

Merits of Digital SystemsMerits of Digital Systems

Efficient Processing & Data StorageEfficient Processing & Data Storage Efficient & Reliable TransmissionEfficient & Reliable Transmission Detection and Correction of ErrorsDetection and Correction of Errors Precise & Accurate ReproductionPrecise & Accurate Reproduction Easy Design and ImplementationEasy Design and Implementation Occupy minimum spaceOccupy minimum space

Information ProcessingInformation Processing

NumbersNumbers TextText Formula and EquationsFormula and Equations Drawings and PicturesDrawings and Pictures Sound and MusicSound and Music

Logic GatesLogic Gates

Building BlocksBuilding Blocks AND, OR and NOT GatesAND, OR and NOT Gates NAND, NOR, XOR and XNOR GatesNAND, NOR, XOR and XNOR Gates Integrated Circuits (ICs)Integrated Circuits (ICs)

Logic Gate Symbol and ICsLogic Gate Symbol and ICs

AND Gate OR Gate NOT Gate

1 2 3 4 5 6

GN

D

Vcc 13 12 11 10 9 8

7400

NAND Gate NOR Gate XOR Gate XNOR Gate

NAND Gate IC

Combinational CircuitsCombinational Circuits

Combination of Logic GatesCombination of Logic Gates Adder Combinational CircuitAdder Combinational Circuit

Adder Combinational CircuitAdder Combinational Circuit

Sum

Carry

Functional DevicesFunctional Devices

Functional DevicesFunctional Devices– Adders– Comparators– Encoders/Decoders– Multiplexers/Demultiplexers

Sequential CircuitsSequential Circuits

Memory ElementMemory Element Current & Previous StateCurrent & Previous State Flip-FlopsFlip-Flops Counters & RegistersCounters & Registers

Block Diagram of a Sequential Block Diagram of a Sequential CircuitCircuit

a11

a22

b1

b2

5

6CombinationalLogic Circuit

OutputInput

a11

b15

Memory Element

Programmable Logic Devices (PLDs)Programmable Logic Devices (PLDs)

Configurable HardwareConfigurable Hardware Combinational CircuitsCombinational Circuits Sequential CircuitsSequential Circuits Low chip countLow chip count Lower CostLower Cost Short development timeShort development time

MemoryMemory

Storage Storage RAM (Random Access Memory)RAM (Random Access Memory)

– Read-Write– Volatile

ROM (Read-Only Memory)ROM (Read-Only Memory)– Read-Only– Non-Volatile

A/D & D/A ConvertersA/D & D/A Converters

Processing of Continuous values Processing of Continuous values Conversion Conversion

– Analogue to Digital A/D– Digital to Analogue D/A

Industrial Control ApplicationIndustrial Control Application

Digital Industrial ControlDigital Industrial Control

DigitalDigital

ControllerController

ThermocoupleThermocouple

A/DA/DConverterConverter

u1x1

* / *

D/AD/AConverterConverter

u1x1

* / *

ReactionReactionVesselVessel

HeaterHeater

ControlControl

SummarySummary

Continuous SignalsContinuous Signals Digital Representation in BinaryDigital Representation in Binary Information ProcessingInformation Processing Logic GatesLogic Gates

Combinational & Sequential CircuitsCombinational & Sequential Circuits Programmable Logic Devices (PLDs)Programmable Logic Devices (PLDs) Memory (RAM & ROM)Memory (RAM & ROM) A/D & D/A ConvertersA/D & D/A Converters

SummarySummary

Number Systems and CodesNumber Systems and Codes

Decimal Number SystemDecimal Number System Caveman Number SystemCaveman Number System Binary Number SystemBinary Number System Hexadecimal Number SystemHexadecimal Number System Octal Number SystemOctal Number System

Decimal Number SystemDecimal Number System

Ten unique numbers 0,1..9Ten unique numbers 0,1..9 Combination of digitsCombination of digits Positional Number SystemPositional Number System 275 = 2 x 10275 = 2 x 1022 + 7 x 10 + 7 x 1011 + 5 x 10 + 5 x 1000

– Base or Radix 10– Weight 1, 10, 100, 1000 ….

Representing FractionsRepresenting Fractions

Fractions can be represented in decimal Fractions can be represented in decimal number system in a mannernumber system in a manner

= 3 x 10= 3 x 1022 + 8 x 10 + 8 x 1011 + 2 x 10 + 2 x 1000 + 9 x 10 + 9 x 10-1-1

+ 1 x 10+ 1 x 10-2-2

= 300 + 80 + 2 + 0.9 + 0.01 = 300 + 80 + 2 + 0.9 + 0.01

= 382.91= 382.91

Caveman Number SystemCaveman Number System

∑∑, ∆, >, Ω and ↑, ∆, >, Ω and ↑ Base – 5 Number SystemBase – 5 Number System ∆∆Ω↑∑ = 220Ω↑∑ = 220

Caveman Number SystemCaveman Number System

Decimal Decimal NumberNumber

Caveman Caveman NumberNumber

Decimal Decimal NumberNumber

Caveman Caveman NumberNumber

00 ∑∑ 1010 >∑>∑

11 ∆∆ 1111 >∆>∆

22 >> 1212 >>>>

33 ΩΩ 1313 >Ω>Ω

44 ↑↑ 1414 >↑>↑

55 ∆∑∆∑ 1515 Ω∑Ω∑

66 ∆∆∆∆ 1616 Ω∆Ω∆

77 ∆∆>> 1717 Ω>Ω>

88 ∆∆ΩΩ 1818 ΩΩΩΩ

99 ∆↑∆↑ 1919 Ω↑Ω↑

Caveman Number SystemCaveman Number System

Mr. Caveman is using a base 5 number Mr. Caveman is using a base 5 number system. Thus the number ∆Ω↑∑ in system. Thus the number ∆Ω↑∑ in decimal isdecimal is

= ∆ x 5= ∆ x 533 + Ω x 5 + Ω x 522 + ↑ x 5 + ↑ x 511 + ∑ x 5 + ∑ x 500

= ∆ x 125 + Ω x 25 + ↑ x 5 + ∑ x 1 = ∆ x 125 + Ω x 25 + ↑ x 5 + ∑ x 1

= (1) x 125 + (3) x 25 + (4) x 5 + (0) x 1 = (1) x 125 + (3) x 25 + (4) x 5 + (0) x 1

= 125 + 75 + 20 + 0 = 220= 125 + 75 + 20 + 0 = 220

Binary Number SystemBinary Number System

Two unique numbers 0 and 1Two unique numbers 0 and 1 Base – 2Base – 2 A binary digit is a bitA binary digit is a bit Combination of bits to represent larger Combination of bits to represent larger

valuesvalues

Binary Number SystemBinary Number System

Decimal Decimal NumberNumber

Binary NumberBinary Number Decimal Decimal NumberNumber

Binary NumberBinary Number

00 00 1010 10101010

11 11 1111 10111011

22 1010 1212 11001100

33 1111 1313 11011101

44 100100 1414 11101110

55 101101 1515 11111111

66 110110 1616 1000010000

77 111111 1717 1000110001

88 10001000 1818 1001010010

99 10011001 1919 1001110011

Combination of Binary BitsCombination of Binary Bits

Combination of BitsCombination of Bits 100111001122 = 19 = 191010

= (1 x 2= (1 x 244) + (0 x 2) + (0 x 233) + (0 x 2) + (0 x 222) + (1 x 2) + (1 x 211) ) + (1 x 2+ (1 x 200))

= (1 x 16) + (0 x 8) + (0 x 4) + (1 x 2) = (1 x 16) + (0 x 8) + (0 x 4) + (1 x 2) + (1 x 1)+ (1 x 1)

= 16 + 0 + 0 + 2 + 1= 16 + 0 + 0 + 2 + 1= 19= 19

Fractions in BinaryFractions in Binary

Fractions in BinaryFractions in Binary 1011.1011011.10122 = 11.625 = 11.625

= (1 x 23) + (0 x 22) + (1 x 21) + (1 x 20) + (1 x 2-1) + (0 x 2-2) + (1 x 2-3)

= (1 x 8) + (0 x 4) + (1 x 2) + (1 x 1) + (1 x 1/2) + (0 x 1/4) + (1 x 1/8)

= 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125= 11.625

Floating Point NotationsFloating Point Notations

Decimal-Binary ConversionDecimal-Binary Conversion

Binary to Decimal ConversionBinary to Decimal Conversion– Sum-of-Weights– Adding weights of non-zero terms

Decimal to Binary ConversionDecimal to Binary Conversion– Sum-of-Weights (in reverse)– Repeated Division by 2

NumberNumber WeightWeight Result after subtractionResult after subtraction Binary Binary

392392 256256 392-256=136392-256=136 11

136136 128128 136-128=8136-128=8 11

88 5454 00

88 3232 00

88 1616 00

88 88 8-8=08-8=0 11

00 44 00

00 22 00

00 11 00

Decimal to binary conversion using

Sum of weight

Decimal-Binary ConversionDecimal-Binary Conversion

2

4 3 2 1

0

10011

(1 2 ) (0 2 ) (0 2 ) (1 2 )

(1 2 )

Terms 16,0,0.2 and 1

19

Binary to Decimal ConversionBinary to Decimal Conversion– Sum-of-Weights– Adding weights of non-zero terms

Decimal-Binary ConversionDecimal-Binary Conversion

Binary to Decimal ConversionBinary to Decimal Conversion– Sum-of-Weights– Adding weights of non-zero terms

Binary to Decimal ConversionBinary to Decimal Conversion– Sum-of-Weights– Adding weights of non-zero terms

Decimal-Binary ConversionDecimal-Binary Conversion

2

2

10011 16 2 1 19

1 11011.101 8 2 2 8511 8

11.625

Lecture No. 1Lecture No. 1

Number SystemsNumber Systems

A SummaryA Summary