coen 212: digital systems design lecture 1: numbersmsoleyma/coen212... · slide 11 department of...
TRANSCRIPT
Slide 1
Department of Electrical & Computer Engineering
COEN 212:DIGITAL SYSTEMS DESIGN
Lecture 1: Numbers
Instructor:Dr.RezaSoleymani,Office:EV‐5.125,Telephone:848‐2424ext.:4103.
Slide 2
Department of Electrical & Computer Engineering
Introductiontothecourse. Courseoutline. NumberSystems. BinaryNumbersandBinaryLogic.
Slide 3
Department of Electrical & Computer Engineering
Inthiscourse,weacquireanappreciationofthefactthatallmoderndigitalelectronicdevices,eventhoseascomplexascomputersandsmartphonesaredesignedbyafewbasicblockscalledlogicgates.
Slide 4
Department of Electrical & Computer Engineering
Wewillevenshowthattechnicallyspeakingonlyonetypeofgate,namelyaNANDgateisenoughtobuildalltheDigitalEmpire.
Two‐inputNANDgate:
Wewillseethat,wecanalsoexclusivelyuseanothertypeofgatecalledaNORgate.
Two‐inputNORgate:
Slide 5
Department of Electrical & Computer Engineering
• Mathematics of Digital Design.• Combinational Circuits.• Sequential Circuits.
Note: In this course, we are not concerned with the implementation of gates. You will learn how the gates are made out of transistors in a digital electronics course.
Slide 6
Department of Electrical & Computer Engineering
1. Introduction, Number System, Binary Numbers: Chapter 1.2. Boolean algebra and Functions: Chapter 2.3. Canonical and Standard Forms: Chapter 2.4. K-Map representation: Chapter 3.5. K-Map minimization: Chapter 3.6. 2-level, multilevel representation and minimization: Chapter 37. Introduction to HDL: Chapter 3.8. Timing Analysis of combinational circuits: Chapter 3.9. Analysis and design procedures: Chapter 4.10. Popular arithmetic and logical combinational circuits: Chapter 4.11. Decoders/Encoders and Multiplexers: Chapter 4.12. Introduction to sequential circuits, Latches and Flip Flops: Chapter 5.13. Analysis of sequential circuits: Chapter 5.14. The state diagram: Chapter 5.15. Synchronous circuit design: Chapter 5.16. Registers and counters: Chapter 617. Memory and Programmable Logic Devices: Chapter 7.
Slide 7
Department of Electrical & Computer Engineering
• Textbook:– Digital Design: With an Introduction to the Verilog HDL, VHDL, and
SystemVerilog, by M. Morris R. Mano and Michael D. Ciletti, 6th Edition, Pearson, 2018.
• Lab Manual.
Slide 8
Department of Electrical & Computer Engineering
Assignment:5% Lab:20% Midterm:25% Final:50%
Note1:FailingtowritetheMidtermresultsinlosingthe25%assignedtothetest.Note2:Inordertopassthecourse,youshouldgetatleast50%inthefinal.
Slide 9
Department of Electrical & Computer Engineering
Slide 10
Department of Electrical & Computer Engineering
Integersandrealnumberscanberepresentedusingafinitenumberofsymbolscalleddigits.
Forexample,indecimalsystemthenumber35987isrepresentedas:• 30000+5000+900+80+7 = 3 10 5 10 9 10 8 10 7 10 ,
and275.69isrepresentedas:• 200+70+5+ 2 10 7 10 5 10 6 10 9 10
Probably,weusebasetenbecausewehave10fingersandthefirstinstancesofcountingwasdonewithfingers.Infactthetermdigitmeansfinger.
Havewehadfourfingers liketheSimpsons ,mostlikely,wehaveusedbase8.Suchsystemiscalledoctal.
Thenumber253 indecimalsystem willberepresentedas375inoctalsystem:3 8 7 8 5 8 253.
Totranslatefromdecimal base10 tooctal base8 wedothefollowing:
Nowreadtheremainders thethirdcolumn frombottomtothetoptoget375.
Operation Result RemainderDivide 253 by 8 31 5
Divide 31 by 8 3 7Divide 3 by 8 0 3
Slide 11
Department of Electrical & Computer Engineering
BinaryNumbers:Arepresentationusuallyusedindigitalsystemsisbinary. Binarysystemusesanalphabetconsistingonlyoftwosymbols.Youmaycallthesetwo
digitszero 0 andone 1 . Anumbercanberepresentedinbinary base2 as:
∗ 2 ∗ 2 ⋯ 2 ∗ 2 2 ∗ 2 . . . Forexample,thenumber75inourfamiliardecimalsystemwillbe
transformedintobinaryusingthefollowingsteps:
Nowreadtheremainders thethirdcolumn frombottomtothetoptoget1001011 .
Operation Result Remainder
Divide 75 by 2 37 1Divide 37 by 2 18 1Divide 18 by 2 9 0Divide 9 by 2 4 1Divide 4 by 2 2 0Divide 2 by 2 2 0Divide 1 by 2 0 1
Slide 12
Department of Electrical & Computer Engineering
BinarytoOctalconversion
Wecandividebinarydigitsofabinarynumberintogroupsof3andrepresentthembytheiroctalvalue.
Example,thenumber1001011canbedividedinto001,001and011.Thiswillbe113inbase8.
Notethatweinsertedtwozerostothebeforethenumbertomakethenumberofbitsequalto9.
Let’schecktoseewhetherwhatwehavedoneiscorrectbytransforming75tooctaldirectly:
Nowreadtheremainders thethirdcolumn frombottomtothetoptoget113.
Operation Result Remainder
Divide 75 by 8 9 3Divide 9 by 8 1 1Divide 1 by 8 0 1
Slide 13
Department of Electrical & Computer Engineering
Thisisarepresentationinbase radix 16.Hereinadditiontozeroand1to9weuseA,B,C,D,E,Fas10,11,12,13,14,15,respectively.
Tochangeabinarynumberintohexa‐decimal,wedivideitsbitsintogroupsof4.
Ifthenumberofbitsbeforethe“decimal” Iavoidcallingitbinarypointinordernottocauseconfusion pointisnotamultipleof4,weaddextra0’sbeforethenumber.
Alsoifthenumberofbitsafterthepointisnotamultipleoffourweaddzerosafterthenumber.
Example:10110001101011.1111001willbewrittenas:
So,weget 2 6 . 2 .
0010 1100 0110 1011 . 1111 00102 C 6 B F 2
Slide 14
Department of Electrical & Computer Engineering
RadixComplement: IfwesubtractanumberXinradixrfrom weget ,theradix
complementofX. Forexample,10’scomplementof3250is10 3250 6750. Notethatten’scomplementcanbeformedbyleavingthezerosattheendof
thenumberintact,subtractthefirstnon‐zerodigitafterzerosfrom10andsubtracttherestofthedigitsfrom9.
Puttinganynumberofzerosbeforeanumberdoesnotchangeitsvalue.Forexample003250isnodifferentfrom3250.But10’scomplementof003250is996750.Thisshowsthatputtinganynumberof9’sbeforea10’scomplementdoesnotchangethevalueofthenumber.
Two’scomplementofanumberX inbinarysystem is2 -X.
ForexampleforX 1101100weget0010100andforX 0110111weget1001001.
Slide 15
Department of Electrical & Computer Engineering
DiminishedRadixComplement: IfwesubtractanumberXinfrom 1 weget 1 ,ther‐1
complementofX. Notethat 1 isanndigitnumberwithallitsdigitsequaltor‐1.For
example,the9’scomplementof546700is, 999999– 546700 453299. and9’scomplementof012398is987601.Weseethatthe9’scomplementofa
decimalnumberisfoundbysimplyreplacingeachdigitbytheresultsofsubtractionofthatdigita from9.
Inbinarycase,1’scomplementofabinarynumberisfoundbycomplementingeachbit,i.e.,subtractingitfrom1.Forexamplethe1’scomplementof1011000is0100111andthe1’scomplementof0101101is1010010.
Slide 16
Department of Electrical & Computer Engineering
Subtractioninradixcomplement: ToformM‐N: AddMtor’scomplementofNtoget: . IfM Ntheresultwillbegreaterthan andtherewillbeacarrythatcanbe
discarded. IfM N,therewouldbenocarryandtheresultwillbe -(N-M),i.e.,ther’s
complementofN‐M.So,wetakether’scomplementoftheresultandaddaminussign.
Example:FindX‐YandY‐XifX 1010100andY 1000011.
TofindX‐Y:1010100 0111101 10010001. Discardingthecarry,weget0010001.
TofindY‐X:1000011 0101010 1101111. Thereisnocarry.So,wefind2’scomplementtoget0010001andputaminus
signinfrontofittohave‐0010001.
Slide 17
Department of Electrical & Computer Engineering
Subtractionindiminishedradixcomplement: Ifweuse1’scomplement,sincethenumbersareonelessthan2’scomplement,
wehavetosubtractonewhenthereisacarry.Whenthereisnocarry,thefinal1’scomplementtakescareoftheone.
Example:LetX 1100101andY 1011010.FindX‐YandY‐X. ForX‐Y:1100101 0100101 10001010.Thereisacarryso,wetake
0001010andaddaonetoget0001011. ForY‐X:1011010 0011010 1110100.Justtake1’scomplement0001011
andaddaminussigntoget‐0001011. SignedBinaryNumbers: Indigital binary systemhavinganextrasymboltospecifythesignofa
numberisnotconvenient.Thatiswhyusuallythefollowingconventionisused:
Themostsignificantbitofanumberis1ifitisnegativeand0ifitispositive. Ofcourse,weneedtospecifythewordlengthinadvanceinordertoavoid
confusion.Forexample11100canbeeither‐12or 28dependingonwhetherwedealwith5‐bitsignednumber 1bitsignand4bitsmagnitude ora5‐bitunsignednumber.
Slide 18
Department of Electrical & Computer Engineering
SignedBinaryNumbers: Indigital binary systemhavinganextrasymboltospecifythesignofa
numberisnotconvenient.Thatiswhyusuallythefollowingconventionisused:
Themostsignificantbitofanumberis1ifitisnegativeand0ifitispositive. Ofcourse,weneedtospecifythewordlengthinadvanceinordertoavoid
confusion.Forexample11100canbeeither‐12or 28dependingonwhetherwedealwith5‐bitsignednumber 1bitsignand4bitsmagnitude ora5‐bitunsignednumber.
Slide 19
Department of Electrical & Computer Engineering
Basic building blocks of logical circuits
• A logical device, e.g., a computer, a digital phone, an IPOD,etc. consists of the following blocks:
1. Memory: to store information.2. A processing unit: to operate on information.3. A control unit: to specify the sequence of operations.4. Input and output units: to input data to the device or output
the result of processing: keyboard, scanners, monitors, andprinters.
Slide 20
Department of Electrical & Computer Engineering
Logic gates:NOT
• We said that, we can represent any number with only two symbols, i.e., transform it to a binary format. In this format any processing task can be broken down into operation on binary digits (bits). There are three basic operations for bit manipulation. These are AND, OR, and NOT. NOT operates on a single bit, i.e., it has one input. The output of a NOT is 1 if its input is 0 and vice versa.
0 11 0
Slide 21
Department of Electrical & Computer Engineering
Logic gates: AND
• NOT is a unitary operation (works on one input)• AND and OR are binary operations. • The output of an AND gate is 1 if both its inputs are 1 and 0
otherwise.
• Truth table for AND gate:.
0 0 00 1 01 0 01 1 1
Slide 22
Department of Electrical & Computer Engineering
Logic gates: OR
• The output of an OR gate is zero if both its inputs are zero. Otherwise itsoutput is 1.
• Truth table for OR gate:
0 0 00 1 11 0 11 1 1
Slide 23
Department of Electrical & Computer Engineering
De Morgan’s Theorem
• Note the similarity (duality) existing between the AND gate and the OR gate. If you exchange 0 and 1 in the truth table for one you get the other’s truth table. That is if we negate the inputs to an OR gate (before feeding them to it) and also invert the output we get the operation of an AND gate. That is:
• or • Similarly,• or • This is called De Morgan’s theorem. This duality property makes
the mathematics of binary systems (Boolean Algebra) different from the ordinary algebra.
Slide 24
Department of Electrical & Computer Engineering
Knowledge Check
1) is:a) , b) c) both a and b d) None2) Truth table for is:a) b) c) d)
3) For x y 0and 1find the output of:
0 0 10 1 01 0 11 1 0