Download Presentation
## EEE-241 Digital Logic Designe

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Textbook**• Digital Design by Morris Mano , 2 nd Edition/ 3rd Edition/Digital Fundamentals.**Introduction to concepts of digital logic, gates, and the**digital circuits Design and analysis of combinational and sequential circuits Basics of logic design of computer hardware What’s Course About?**Digital Systems**• Digital Computer follow a sequence of instructions, Digital System play a prominent role in this digital age • Communication, medical treatment, internet, DVD, CD, Space ,Programme.Scientific &Educational field ,ATC commercial etc. • called programs, that operate on given data • User can specify and change program or data according to needs • 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 chessboard**Course Outline**• Binary Systems • Binary Algebra • Simplification of Boolean Functions • Combinational Logic • Sequential Logic • MSI Sequential Circuits**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**Verilog**/* * A 32-bit counter with only 4 bits of output. The idea is * to select which of the counter stages you want to pass on. * * Anselmo Lastra, November 2002 */ module cntr_32c(clk,res,out); input clk; input res; output [3:0] out; reg [31:0] count; always @ (posedge res or posedge clk) if(res) count <= 0; else count <= count + 1; assign out[3] = count[28]; assign out[2] = count[27]; assign out[1] = count[26]; assign out[0] = count[25]; endmodule**COMPUTER**Analog Computer,. It respnds to continous signals. Digital compuyer. It responds to 0 and 1. also called Binary. Main Modules. Memory Unit Processor Unit Control Unit Input Device / Output Device CPU Processor combined with Control Unit Micro Processor. CPU in a Small integrated cct Micro Computer. CPU combined with Memory and Interface control for i/p and o/p devices form a micro computer.**DATA FLOW**• Fetch Time. Getting data and instrs from ALU and then issue command .Fix time • Execute Time. ALU carries out execution. Time is variable • Master clock. It is in con unit and con all functions • Memory • RAM Semi conductor memory & Feritte core memory • Sequential Memory . Mag tape, mag disk, CD Foppy Mag Drum. • Address Each info has a loc and an address.**DEFINATIONS MEMORY**• Random Access Memory,. Access time to a loc is constant. • Sequential access memory. Access time to all locs are different • Main memory and Secondry memory. How we store • Semi coductor Magnetic Material (Hystersis loop) • Binary Req. as material can store only 1 and 0 • Three things are stored, Instructions, Data, Address.**Decimal Number**• 7,392= 7x103 +3x102 + 9x101 + 2x100 • Thousands, hundreds, etc…power of 10 implied by position of coefficient • 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 • aj cofficient are any of the 10 digit (0,1,2…9) • Decimal number are base 10**Binary Number**• Digital Systems manipulate discrete quantities of information in binary form • Operands in calculations • Decimal Digits • Results • Strings of binary digits (“bits”) • Two possible values 0 and 1**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 1’s and 0’s • Each coefficient aj is multiplied by 2j • So 101 binary is 1 x 22 + 0 x21 + 1 x 20 or 1 x 4 + 0 x 2 + 1 x 1 = 5**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 • Binary Arithmic. Addition, Substraction MutiplicatioiGive example**Octal**• 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,2…7) • 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**Hexadecimal**• 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**Converting Binary to Decimal**• Easy, just multiply digit by power of 2 • Just like a decimal number is represented • Example follows**Binary Decimal Example**What is 10011100 in decimal? 128 + 0 + 0 + 16 + 8 + 4 + 0 + 0 = 156**Decimal to Binary**• A little more work than binary to decimal • Some examples • 3 = 2 + 1 = 11 (that’s 1•21 + 1•20) • 5 = 4 + 1 = 101 (that’s 1•22 + 0•21 + 1•20)**Algorithm – Decimal to Binary**• Find largest power-of-two smaller than decimal number • Make the appropriate binary digit a ‘1’ • Subtract the power of 2 from decimal • Do the same thing again**Decimal Binary Example**• Convert 28 decimal to binary 32 is too large, so use 16 Binary 10000 Decimal 28 – 16 = 12 Next is 8 Binary 11000 Decimal 12 – 8 = 4 Next is 4 Binary 11100 Decimal 4 – 4 = 0**Decimal Binary (Fraction)**• Convert decimal 0.6875 to binary Integer Fraction Coefficient 0.6875 X 2= 1 0.3750 a-1=1 0.3750 X 2= 0 0.7500 a-2=0 0.7500 X 2= 1 0.5000 a-3=1 0.5000 X 2= 1 0.0000 a-4=1 (0.6875)10 = (0.1011)2**Decimal to Octal**Similar to decimal binary. • Find largest power-of-8 smaller than decimal number • Divide by power-of-8. The integer result is Octal digit. • The remainder is new decimal number. • Do the same thing again**Decimal Octal**512 is too large, so use 64 • Convert decimal 153 to Octal Octal 200 Decimal 153 – 64X2 = 25 Next is 8 Decimal 25 – 8X3= 1 Octal 230 Decimal 1 – 1X1 = 0 Next is 1 Octal 231**Decimal Octal (Fraction)**• Convert decimal 0.513 to Octal Integer Fraction Coefficient 0.513 X 8 = 4 + 0.104 a-1=4 0.104 X 8 = 0 + 0.832 a-2=0 0.832 X 8 = 6 + 0.656 a-3=6 0.656 X 8 = 5 + 0.248 a-4=5 0.248 X 8 = 1 + 0.984 a-5=1 0.984 X 8 = 7 + 0.872 a-5=7 (0.513)10= (0.406517)8**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 100)2 • (10 110 001 101 011 . 111 100 000 100)2 = (26153.7460)8**Octal to Binary**• Each Octal digit is converted to its three digit binary equivalent • (26153.7460)8 = (010 110 001 101 011 . 111 100 000 100)2**0010**1010 1100 Hex to Binary • Convention – write 0x before number • Hex to Binary – just convert digits 0x2ac 0x2ac = 001010101100 No magic – remember hex digit = 4 bits**5**3 7 b Binary to Hex • Just convert groups of 4 bits 101001101111011 1011 0101 0011 0111 101001101111011 = 0x537b**Hex to Decimal**• Just multiply each hex digit by decimal value, and add the results. 0x2ac 2 • 256 + 10 • 16 + 12 • 1 = 684**Decimal to Hex**Similar to decimal binary. • Find largest power-of-16 smaller than decimal number • Divide by power-of-16. The integer result is hex digit. • The remainder is new decimal number. • Do the same thing again**Decimal to Hex**684 0x2__ 684/256 = 2 684%256 = 172 0x2a_ 172/16 = 10 = a 0x2ac 172%16 = 12 = c**Arithmetic -- addition**• Binary similar to decimal arithmetic No carries Carries 1+1 is 2 (or 102), which results in a carry**Arithmetic -- subtraction**No borrows Borrows 0 - 1 results in a borrow Borrow makes it (10)2 =(2)10**Arithmetic -- multiplication**Successive additions of multiplicand or zero, multiplied by 2 (102). Note that multiplication by 102 just shifts bits left.**Complements**• Simply Subtraction (Subtraction by addition) • R’s Complement • In Binary 2’s complement • In Decimal 10’s complement • (R-1) Complement • In Binary 1’s complement • In Decimal 9’s Complement**R, complement/2,s/10,s complement**For a given positive no N in base r with integer part of n digits. The r,s complement of N is defined as rn-N for N not =0 and 0 forN=0 Example 10,s Complement of(52520) is 105-52520=47480 (0.3267)=(1-0.3267=0.6733 No integer so 100=1 2,s Complement of(101100)2= 26-(101100)2=010100 0.01101 = (1-0.0110)=0.1010**(r-1),s, complement/1,s/9,s complement**For a given positive no N in base r with integer part of n digits and a fraction part of m digits. The( r-1),s complement of N is defined as (rn – rm- N) Example 9,s Complement of(52520) is( 105-100- 52520)=47479 (0.3267)=(1- 10-4- 0.3267=0.6732 No integer so 100=1 1,s Complement of(101100)2= (26- 1)-(101100)2=010011 0.0110 = (1-2-4)- (0.0110)=( 0.1111-0.0110) = 0.1001**DUALITY METHOD**• 1,S COMPLEMENT OF (10111) • REPLACE 1 BY 0 & O BY 1 • (10111)= (01000) • 2,S COMPLEMENT • REPLACE BY 1,S COMPLEMENT +1 • (10111)=01000+1=01001**Subtraction with r-Complement**• M-N • Add the minuend, M to r’s complement of Subtrahend, N • M+ (rn -N)= M-N+ rn • If M GTE N then sum will produce end carry . Ignore it • If M LT N (No Carry) then take r’s complement of answer (Negative)**Subtraction with r’s Complement**• Using 10’s complement subtract 72532-03250 • Using 10’s complement subtract 03250 -72532 • Using 2’s complement subtract 1010100 -1000011 • Using 2’s complement subtract 1000011- 1010100**Subtraction with r-1 Complement**• Similar to r’s 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 negative1’s complement to get the answer • 1010100-1000011 • 1000000-1010100**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) • Signed Complement (Store negative as comps) • Signed 1’s complement (8 bits)11110110 • Signed 2’s complement (8 bits)11110111 • Signed Magnitude (8 bits) 10001001**BCD**• Binary Coded Decimal • Decimal digits stored in binary • Four bits/digit (Use 10 instead of 16) • Like hex, except stops at 9 • Example 931 is coded as 1001 0011 0001 • People understand decimal system better • Written differently but decimal value is same • Decimal 15 in BCD 0001 0101 in Binary it is 1111 Since most computers store data in eight-bit , bytes • Ignore 4 extra bits • one can store two digits per byte, called "packed" BCD**BCD Addition**• 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) • Addition of 6=(0110)2 make a correct BCD and produces a carry • Binary Sum carry and Decimal Carry differ by 16-10=6 • 4+5, 4+8, 8+9 • 184+576**Binary Codes for Numbers**• Binary codes for decimal digits require 4 bits per digit • Many codes use 4 bits in 10 distinct possible combinations (out of 16) • 2421 and Excess 3 are self complementing (1 and 0 9’s Comp of decimal) • Contents can be interpreted differently. • What decimal value does 1100001111001001 represent in different binary codes? Dec Binary BCD Excess-3 2421 84-2-1 Octal Hexadecimal 0 0 0000 0011 0000 0000 000 0000 1 1 0001 0100 0001 0111 001 0001 2 10 0010 0101 0010 0110 010 0010 3 11 0011 0110 0011 0101 011 0011 4 100 0100 0111 0100 0100 100 0100 5 101 0101 1000 1011 1011 101 0101 • 110 0110 1001 1100 1010 110 0110 • 111 0111 1010 1101 1001 111 0111 • 1000 1000 1011 1110 1000 - 1000 • 1001 1001 1100 1111 1111 - 1001 • 1010 - - - - - 1010 A • 1011 - - - - - 1011 B …**Other Codes Exist**Gray Code/Reflected Code • 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?The no changes by one digit. It is used to represent the digital data converted from Analog data.Where as in Binary all numbers changes. • 01111000 (All Four bits need to be changed)**Character Codes**• 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 code • This encoding system not only lets a computer store a document as a series of numbers, but also lets it share such documents with other computers that use the ASCII system.