# Chapter 01 Lec 01

Post on 27-Nov-2014

133 views

TRANSCRIPT

<p>DLF Digital Logic FundamentalsTheory (3 credit hr) Capt Mariam Kayani Practicle (1 credit hr) Ms Amin Akif</p>
<p>1</p>
<p>Instructor Instructor: Capt Mariam Kayani mariam.signals@gmail.com Telephone :119 ext 33246 Office Hours:</p>
<p>2</p>
<p>Course Resources Digital Design (3rd/4th Edition) By Morris Mano</p>
<p> Topics from different sources will be indicated during the semester</p>
<p>3</p>
<p>RULES Submit your assignments to class senior before start of class on due date No Late submissions. (No exceptions!) Assignments with too much similarity will be penalized appropriately If u miss a quiz/Exam College SOP will be followed</p>
<p>4</p>
<p>Objective of Course Introduction to concepts of digital logic, gates, and the digital circuits Design and analysis of combinational circuits Design and analysis of sequential circuits</p>
<p>5</p>
<p>Lecture - 01 June 11, 2011</p>
<p>6</p>
<p>Digital Systems Digital System play a prominent role in this digital age Communication, medical treatment, internet, DVD, CD, etc</p>
<p> Digital Computer follow a sequence of instructions, called programs, that operate on given data User can specify and change program or data according to needs</p>
<p> Like Digital Computers, most digital devices are programmable Digital Systems have the ability to Manipulate discrete elements of information. Any set that is restricted to a finite number of elements contains discrete information 10 Decimal digits 26 Alphabet letters 52 Playing cards 64 squares of a chessboard7</p>
<p>Digital Systems Digital Systems can do hundreds of millions of operations per second Extreme reliability due to error-correcting codes A Digital System is interconnection of digital modules To understand Digital module, we need to know about digital circuits and their logical functions Hardware Description Language (HDL) is a programming language that is suitable for describing digital circuit in a textual form Simulate a digital system to verify operation before it is built 8</p>
<p>Decimal Number 7,392= 7x103 + 3x102 + 9x101 + 2x100 Thousands, hundreds, etcpower of 10 implied by position of coefficient</p>
<p> Generally a decimal number is represented by a series of coefficients a6 a5 a4 a3 a2 a1 a0 (.) a-1 a-2 a-3 a-4</p>
<p> aj cofficient are any of the 10 digit (0,1,29) Decimal numbers are base 10.9</p>
<p>Binary Number Digital Systems manipulate discrete quantities of information in binary form Strings of binary digits (bits) Two possible values 0 and 1</p>
<p>10</p>
<p>Binary Numbers Each digit represents a power of 2 Coefficient have two possible values 0 and 1 Strings of binary digits (bits) n bits can store numbers from 0 to 2n -1 n bits can store 2n distinct combinations of 1s and 0s</p>
<p> Each coefficient aj is multiplied by 2j So 101 binary is 1 x 2 2 + 0 x 2 1 + 1 x 20 or 1x4 + 0x2 + 1x1=5</p>
<p>11</p>
<p>BITs & Bytes A bit (short for binary digit) is the smallest unit of data in a computer. A bit can hold only one of two values: 0 or 1, corresponding to the electrical values of off or on, respectively. Because bits are so small, you rarely work with information one bit at a time A byte is a unit of measure for digital information. A single byte contains eight consecutive bits</p>
<p>12</p>
<p>Special Powers of 2 210 (1024) is Kilo, denoted "K"</p>
<p> 220 (1,048,576) is Mega, denoted "M" 230 (1,073, 741,824)is Giga, denoted "G" 240 (1,099,511,627,776 ) is Tera, denoted T"</p>
<p>13</p>
<p> Octal is base 8 A number is represented by a series of coefficients a6 a5 a4 a3 a2 a1 a0. a-1 a-2 a-3 a-4 aj cofficient are any of 8 digit (0,1,27) Need 3 bits for representation Example: (127.4)8= 1 X 82 +2 X 81 +7 X 80 + 4 X 8-1 64+16+7+.5= (87.5)10</p>
<p>Octal</p>
<p>Dec 0 1 2 3 4 5 6 7</p>
<p>Bin 000 001 010 011 100 101 110 111</p>
<p>Octal 0 1 2 3 4 5 6 7</p>
<p>14</p>
<p> Hexadecimal is base 16 A number is represented by a series of coefficients a6 a5 a4 a3 a2 a1 a0. a-1 a-2 a-3 a-4 aj cofficient are any of 16 digit (0,1,2,3,4,5, 6,7,8, 9,A,B,C,D,E,F) Need 4 bits for representation (B65F)16 11 X 163 +6 X 162 + 5 X 161 +15 X 160 = 11x4096 + 6x256 +5x16 +15 = 45056 + 1536 + 80 +15 = 46,687</p>
<p>HexadecimalDec Bin 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F15</p>
<p> A number in one base (10,2,8, 16) can be converted into its equivalent in another base.</p>
<p>Number-base Conversion</p>
<p>16</p>
<p>Converting Binary to Decimal The conversion of a num in base r to decimal is done by expanding the num in a power series and adding all the terms Multiply digit by power of 2.7 27 128 6 26 64 5 25 32 4 24 16 3 23 8 2 22 4 1 21 2 0 20 1</p>
<p>17</p>
<p>ExampleWhat is 10011100 in decimal?27 26 25 24 23 22 21 20</p>
<p>1</p>
<p>0</p>
<p>0</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>0</p>
<p>0</p>
<p>128+ 0 + 0 + 16 + 8 + 4 + 0 + 0 = 156 Since a 0 bit does not contribute anything in the sum, therefore a binary no. can be converted to decimal by adding only the 1 bits.18</p>
<p>Converting Decimal to Binary Example 41 41 divided by 2, giving quotient of 20 and reminder 1 20/2 , giving quotient of 10 and reminder 0 10/2 , giving quotient of 5 and reminder 0 5/2 , giving quotient of 2 and reminder 1 2/2 , giving quotient of 1 and reminder 0 , giving quotient of 0 and reminder 1 a0 a1 a2 a3 a4 a5</p>
<p>Therefore, the answer is (41)10= (a5a4a3a2a1a0)=(101001)219</p>
<p>Number With Radix Point If the number includes a radix point, it is necessary to separate the number into an integer part and a fraction part. The conversion of a fractional part in base r is done by multiplying the number and all successive integers are accumulated instead of reminders.20</p>
<p>Example (0.6875)10 integer fraction 0.6875 * 2 = 0.3750 * 2 = 0.7500 * 2 = 0.5000 * 2 = 1 0 1 1</p>
<p>coefficient</p>
<p>+ 0.3750 a-1 = 1 + 0.7500 a-2 =0 + 0.500 a-3 =1 + 0.000 a-4 =1</p>
<p>(0.1011)221</p>
<p>Octal Decimal Convert (231)8 to decimal</p>
<p>82 2</p>
<p>813</p>
<p>801</p>
<p>153</p>
<p>Decimal Octal Convert decimal 153 to Octal 153 divided by 8, giving quotient of 19 , reminder 1 a0 19/8 , giving quotient of 2 and reminder 3 a1 10/8 , giving quotient of 0 and reminder 2 a2 153 = (231)8</p>
<p>23</p>
<p>Decimal Octal (Fraction) Convert decimal 0.513 to OctalInteger Fraction 4 + 0.104 0 + 0.832 6 + 0.656 5 + 0.248 1 + 0.984 7 + 0.872 (0.513)10= (0.406517)8 Coefficient a-1=4 a-2=0 a-3=6 a-4=5 a-5=1 a-6=7</p>
<p>0.513 X 8 = 0.104 X 8 = 0.832 X 8 = 0.656 X 8 = 0.248 X 8 = 0.984 X 8 =</p>
<p>24</p>
<p>Dec</p>
<p>Hex 0 1 2 3 4 5 6 7 8 9 A B C D25</p>
<p>Hex Decimal Just multiply each hex digit by decimal value, and add the results.</p>
<p>0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15</p>
<p>0x2AC 2 x 256 163 4096</p>
<p>+ 10 x 16 + 12 x 1 = 684 162 256 161 16 160 1</p>
<p>E F</p>
<p>Decimal Hex(684)10684 divided by 16, giving quotient of 42 , reminder 12 a0 42/16 , giving quotient of 2 and reminder 10 a1 10/16 , giving quotient of 0 and reminder 2</p>
<p>2AC26</p>
<p>Binary to Octal Partition Binary number into group of three digits each The corresponding octal digit is then assigned to each group (10 110 001 101 011 . 111 100 000 110)2 (10 110 001 101 011 . 111 100 000 100)2 = (26153.7406)8</p>
<p>27</p>
<p>Octal to Binary Each Octal digit is converted to its three digit binary equivalent (26153.7406)8 = (010 110 001 101 011 . 111 100 000 110)2</p>
<p>28</p>
<p>Hex to Binary Convention write 0x before number Hex to Binary just convert digits</p>
<p>2ac0010 1010 1100</p>
<p>0x2ac = 001010101100</p>
<p>No magic remember hex digit = 4 bits</p>
<p>29</p>
<p>Binary to Hex Just convert groups of 4 bits</p>
<p>101001101111011 0101 0011 0111 10115 3 7 b</p>
<p>101001101111011 = 537B30</p>
<p>Arithmetic -- addition Binary similar to decimal arithmeticNo carries</p>
<p>0 1 1 0 0 + 1 0 0 0 1 1 1 1 0 1</p>
<p>1 0 1 1 0 0 Carries 1 0 1 1 0 + 1 0 1 1 1 1 0 1 1 0 1</p>
<p>1+1 is 2 (or 102), which results in a carry31</p>
<p>32</p>
<p>Arithmetic -- subtraction</p>
<p>No borrows</p>
<p>1 0 1 1 0 - 1 0 0 1 0 0 0 1 0 0</p>
<p>0 0 1 1 0 Borrows 1 1 1 1 0 - 1 0 0 1 1 0 1 0 1 1 0 - 1 results in a borrowBorrow makes it (10)2= (2) 1033</p>
<p>Arithmetic -- multiplication1 0 1 1 X 1 0 1 1 0 1 1 0 0 0 0 1 0 1 1 1 1 0 1 1 134</p>
<p>Successive additions of multiplicand or zero, multiplied by 2 (102). Note that multiplication by 102 just shifts bits left.</p>
<p>Complements Simply Subtraction (Subtraction by addition) Rs Complement In Binary 2s complement In Decimal 10s complement</p>
<p> (R-1) Complement In Binary 1s complement In Decimal 9s Complement</p>
<p>35</p>
<p>Diminished Radix Complement Given a number N in base r having n digits, it is (rn -1 )-N Decimal: (10n -1 )-N If n=6 then 106-1=1000000-1=999999 9s complement of 546700 is 999999-546700=453299 In simple words subtract each digit from 94 If n=4 then 2 = (16)10 = (10000)2 4 2 1 = (15)10 = (1111)2 Note: 1-0=1 and 1-1 =0 (Bit Changes) In simple words just change the bits</p>
<p> Binary: (2n -1 )-N</p>
<p>36</p>
<p>Radix Complement Given a number N in base r having n digits, it is (rn N) Simply add one to the radix-1 complement (rn N) = [(rn -1 )-N] +1 Decimal: 2389 7610+1=7611</p>
<p> Binary: (2n -1 )-N 101100010011+1=01010037</p>
<p>Subtraction with r-Complement M-N Add the minuend, M to rs complement of Subtrahend, N M+ (rn -N)= M-N+ rn</p>
<p> If M GTE N then sum will produce end carry rn. Ignore it If M LT N (No Carry) then take rs complement of answer (Negative)38</p>
<p>Subtraction with rs Complement Using 10s complement subtract 72532-03250 Using 10s complement subtract 03250 -72532 Using 2s complement subtract 1010100 -1000011 Using 2s complement subtract 1000011- 1010100</p>
<p>39</p>
<p>Subtraction with r-1 Complement Similar to rs complement But since r-1 complement is 1 less than r complement, Carry is added back to get the result If no carry, result is negative1s complement to get the answer 1010100-1000011 1000000-1010100</p>
<p>40</p>
<p>Signed Binary Numbers Need notation for negative values Everything must be represented by binary digits Signed magnitude convention Left most bit can be used 0 Positive 1 Negative 01001 is +9 and 11001 is -9 (Not 25. Convention known in advance)</p>
<p> Signed Complement (Store negative as comps) Signed 1s complement (8 bits)11110110 Signed 2s complement (8 bits)11110111 Signed Magnitude (8 bits) 1000100141</p>
<p>Complements Simply Subtraction (Subtraction by addition) Rs Complement In Binary 2s complement In Decimal 10s complement</p>
<p> (R-1) Complement In Binary 1s complement In Decimal 9s Complement</p>
<p>42</p>
<p>Diminished Radix Complement Given a number N in base r having n digits, it is (rn -1 )-N Decimal: (10n -1 )-N If n=6 then 106-1=1000000-1=999999 9s complement of 546700 is 999999546700=453299 In simple words subtract each digit from 9</p>
<p> Binary: (2n -1 )-N If n=4 then 24= (16)10= (10000)2 24 1 = (15)10= (1111)2 Note: 1-0=1 and 1-1 =0 (Bit Changes) In simple words just change the bits</p>
<p>43</p>
<p>Radix Complement Given a number N in base r having n digits, it is (rn N) Simply add one to the radix-1 complement (rn N) = [(rn -1 )-N] +1 Decimal: 2389 7610+1=7611</p>
<p> Binary: (2n -1 )-N 101100010011+1=01010044</p>
<p>Subtraction with r-Complement M-N Add the minuend, M to rs complement of Subtrahend, N M+ (rn -N)= M-N+ rn</p>
<p> If M GTE N then sum will produce end carry rn. Ignore it If M LT N (No Carry) then take rs complement of answer (Negative)45</p>
<p>Subtraction with rs Complement Using 10s complement subtract 72532-03250 Using 10s complement subtract 03250 -72532 Using 2s complement subtract 1010100 -1000011 Using 2s complement subtract 1000011- 1010100</p>
<p>46</p>
<p>Signed Binary Numbers Need notation for negative values Everything must be represented by binary digits Signed magnitude convention is where; Left most bit can be used 0 Positive 1 Negative 01001 is +9 and 11001 is -9 (Not 25. Convention known in advance)</p>
<p> Signed Complement sys (Store negative no is rep by its complement) Signed 1s complement (8 bits)11110110 Signed 2s complement (8 bits)11110111 Signed Magnitude (8 bits) 10001001</p>
<p>47</p>
<p>Arithmetic -- addition Binary similar to decimal arithmetic</p>
<p>No carries</p>
<p>0 1 1 0 0 + 1 0 0 0 1 1 1 1 0 1</p>
<p>1 0 1 1 0 0 Carries 1 0 1 1 0 + 1 0 1 1 1 1 0 1 1 0 1</p>
<p>1+1 is 2 (or 102), which results in a carry48</p>
<p>Arithmetic -- subtraction</p>
<p>No borrows</p>
<p>1 0 1 1 0 - 1 0 0 1 0 0 0 1 0 0</p>
<p>0 0 1 1 0 Borrows 1 1 1 1 0 - 1 0 0 1 1 0 1 0 1 1 0 - 1 results in a borrowBorrow makes it (10)2= (2) 1049</p>
<p>Arithmetic -- multiplication1 0 1 1 X 1 0 1 1 0 1 1 0 0 0 0 1 0 1 1 1 1 0 1 1 150</p>
<p>Successive additions of multiplicand or zero, multiplied by 2 (102). Note that multiplication by 102 just shifts bits left.</p>
<p>BCD (Binary Coded Decimal) Representing the decimal digits by mean of code that contains 1 , 0 i.e. Decimal digits stored in binary Four bits/digit (Use 10 instead of 16) Num with k decimal digit will require 4k bits BCD is base as its equivalent binary number 0 9 Binary combination 1010-111 are not used in BCD Example931 is coded as 1001 0011 0001 Decimal 15 is BCD 0001 0101 in Binary it was 1111</p>
<p>51</p>
<p> Since each digit is max 9 Sum will always be less than 19= 9+9+1(carry) Two BCD digits are added as binary numbers When binary sum is more than binary (1001)2, result is invalid (unlike Hex last 6 were ignored)</p>
<p>BCD Addition</p>
<p> Addition of 6=(0110)2 make a correct BCD and produces a carry Binary Sum carry and Decimal Carry differ by 16-10=6</p>
<p> 4+5, 4+8, 8+9 184+576</p>
<p>52</p>
<p>Decimal Arithmetic Representation of signed decimal number in BCD is similar to the rep of signed number in binary Sign and mag system Sign complement system</p>
<p> Designate a plus with 0 and minus with 9 For Addition, add all digits including the sign digit and discard the carry. This assumes that all ive no are in 10s complement form (+375) + (-240) = +135</p>
<p> Method for Subtraction is same as binary signed number53</p>
<p>Binary Codes for per digit Numbers Binary codes for decimal digits require 4 bitsMany codes are use 4 bits in 10 distinct possible combinations (out of 16) 2421 and Excess 3 are self complementing (1 and 0 9s Comp of decimal)</p>
<p> Dec 0 1 2 3 4 5 </p>
<p>Contents can be interpreted differently. What decimal value does 1100001111001001 represent in different binary codes?Binary 0 1 10 11 100 101 110 111 1000 1001 BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 Excess-3 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 2421 0000 0001 0010 0011 0100 1011 1100 1101 1110 1111 84-2-1 0000 0111 0110 0101 0100 1011 1010 1001 1000 1111</p>
<p>Other Codes ExistGray Code to represent te digital data when it is converted from analog data Only one bit changes at a time 0000,0001,0011,0010,0110,0111,0101,0100,1100 ,1101,1111,1110,1010,1011,1001,1000 Why is this useful? 01111000 All Four bits need to be changed, may cause intermediate erroneous number</p>
<p> Application of Gray code is when analog data are rep by a continuous change of shaft position55</p>
<p> ASCII Many applications require handling of not only numbers but letters and special characters Stands for American Standard Code for Information Interchange 7 Bits to store 128 characters In ASCII, every letter, number, and punctuation symbol has a corresponding number, or ASCII...</p>