2016/2/17 Jackie Kan - 2007 12016/2/17NTU DSD (Digital System

Embed Size (px)

DESCRIPTION

2016/2/17 Jackie Kan 卡諾圖的相鄰性 第一個 Column 與最後一個 Column 是相鄰的 第一個 Row 與最後一個 Row 是相鄰的 AB CD AB CD AB CD A BC A BC ABC A C B ABC A C B A BC

Citation preview

2016/2/17 Jackie Kan /2/17NTU DSD (Digital System Design) Karnaugh Map; K-Map 2016/2/17 Jackie Kan Karnaugh Map (K-Map; ) K-Map (Min-Term Based) 5 Numbering Scheme: 00, 01, 11, 10 Gray Code: only a single bit changes from code word to next code word A B A BC AB CD Variable K-Map 3 Variable K-Map 4 Variable K-Map 2016/2/17 Jackie Kan Column Column Row Row AB CD AB CD AB CD A BC A BC ABC A C B ABC A C B A BC 2016/2/17 Jackie Kan K-Map Example A B A B A B A B A B F(A,B) = A'B' + A'B = A'(B'+B) = A B A F(A,B) = A'B + AB = B(A'+A) = B 2016/2/17 Jackie Kan K-Map Example A BC A BC A BC A BC A BC A BC F(A,B,C) = A'B'C' + A'BC' = A'C'(B'+B) = AC' F(A,B,C) = A'B'C' + A'B'C+A'BC+ABC' = A' (B'C'+B'C+BC+BC') = A F(A,B,C) = A'B'C' + AB'C'+A'BC'+ABC' = C' (A'B'+AB'+A'B+AB) = C 2016/2/17 Jackie Kan K-Map Example : Multiple Grouping 1 1 A BC A BC A BC F(A,B,C) = (A'B'C' + A'B'C)+(A'B'C + AB'C) = (A'B'(C'+C)) + (B'C(A'+A)) = A'B' + B'C A BC A BC F(A,B,C) = (A'B'C' + A'B'C)+ABC' = (A'B'(C'+C)) + ABC' = A'B' + ABC' 2016/2/17 Jackie Kan K-Map Example : Illegal Grouping ABC ABC product term A BC A BC F(A,B,C) = A'B'C' + AB'C 2016/2/17 Jackie Kan K-Map Example AB CD AB CD AB CD AB CD AB CD F(A,B,C,D) = AC'D' + AB'D'+AB'C+ABCD 2016/2/17 Jackie Kan K-Map Example AB CD AB CD F(A,B,C,D) = D' AB CD AB CD F(A,B,C,D) = B'D' AB CD AB CD F(A,B,C,D) = D + ABD + ABD AB CD F(A,B,C,D) = D + B 2016/2/17 Jackie Kan Don't Care Terms Don't Care Terms( ) 0 1 Face Marked by "X" in K-Map 2016/2/17 Jackie Kan K-Map Example F= m(8,9,12)+D(3,7,10,11,14,15) AB CD X0 0X XX XX AB CD X0 0X XX XX AB CD X0 0X XX XX AB CD X0 0X XX XX AB CD X0 0X XX XX F(A,B,C,D) = AD' + AB' F(A,B,C,D) = AC'D' + AB'C' 2016/2/17 Jackie Kan K-Map Example F= m(4,5,6,8,9,10,13)+D(0,7,15) X AB CD 00 1X X X AB CD 00 1X X X AB CD 00 1X X X AB CD 00 1X X F(A,B,C,D) = AB + ACD + ABD 2016/2/17 Jackie Kan Inputs K-Map BC DE BC DE A=0 A=1 2016/2/17 Jackie Kan K-Map Example F(A,B,C,D,E) = m(2,5,7,8,10,13,15,18,20,21,23,28,29,31) BC DE BC DE A=0 A= BC DE BC DE A=0 A= BC DE BC DE A=0 A=1 F(A,B,C,D,E) = CE + ABCE + ACD + BCDE 2016/2/17 Jackie Kan /2/17NTU DSD (Digital System Design) From K-Map to Max-Terms and Min-Terms 2016/2/17 Jackie Kan Using K-Map Find Min-term and Max-term We have been using K-maps to find the minimum sum-of-products form of a function ( _ _ _ ) + ( _ _ ) + ( _ _ _ ) minterm + minterm + minterm You can also use K-maps to find the minimum product-of-sums form of a function ( _ + _ + _ ) ( _ ) ( _ + _ ) maxterm * maxterm * maxterm 2016/2/17 Jackie Kan Min-term and Max-term from K-Map A BC Min-Term ABCMax-Term A'B'C'm0000M0A+B+C A'B'Cm1001M1A+B+C' A'BC'm2010M2A+B'+C A'BCm3011M3A+B'+C' AB'C'm4100M4A'+B+C AB'Cm5101M5A'+B+C' ABC'm6110M6A'+B'+C ABCm7111M7A'+B'+C' 2016/2/17 Jackie Kan F(A,B,C,D) = (B'+D') ( A ) Finding POS/ & SOP/ Form from K-Map AB CD X0 0X XX XX AB CD X0 0X XX XX AB CD X0 0X XX XX AB CD X0 0X XX XX AB CD X0 0X XX XX F(A,B,C,D) = AD' + AB' 2016/2/17 Jackie Kan Quiz 1 Using K-Map method to minimize the following Boolean expressions in SOP and POS form: F(X,Y,Z) = m(0,2,5,6) F(X,Y,Z) = M(1,3,6) F(W,X,Y,Z) = m(0,1,2,3,4,8,9,10,15) F(V,W,X,Y,Z) = M(0,3,4,8,9,14,15,18,22,24,26,28) A BC AB CD 2016/2/17 Jackie Kan /2/17NTU DSD (Digital System Design) Tabular Minimization Method / Quine-McCluskey Method ( ) 2016/2/17 Jackie Kan F SOP (Sum of Product) XY + XY = X 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Find all the prime implicants group 0 group 1 group 2 group Group the min-terms according to the number of 1s in the min-term. This way we only have to compare min-terms from adjacent groups. 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example group 0 group 1 group 2 group Column I Column II 0, , , , , , , , , , , , , 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example group 0 group 1 group 2 group Column I Column II 0, , , , , , , , , , , , , Grouping 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Column IColumn II group 0 group 1 group 2 group 0, , , , , , , , , , , , , Column III 0,1,8, ,2,8, ,8,1, ,8,2, ,6,10, ,10,6, 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Column IColumn II group 0 group 1 group 2 group , , , , , , , , , , , , , Column III 0,1,8, ,2,8, ,8,1, ,8,2, ,6,10, ,10,6, No more combinations are possible, thus we stop here. 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Column IColumn II group 0 group 1 group 2 group , , , , , , , , , , , , , Column III 0,1,8, ,2,8, ,8,1, ,8,2, ,6,10, ,10,6, We can eliminate repeated combinations 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Column IColumn II group 0 group 1 group 2 group 0, , , , , , , , , , , , , Column III 0,1,8, ,2,8, ,6,10, Now we form f with the terms not checked f = acd f = acd + abd f = acd + abd + abc 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Column IColumn II group 0 group 1 group 2 group 0, , , , , , , , , , , , , Column III 0,1,8, ,2,8, ,6,10, Now we form f with the terms not checked f = acd + abd + abc + bc + bd + cd 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example But, the form below is not minimized, using a Karnaugh map we can obtain: a b c d 1 f = acd + abd + abc + bc + bd + cd 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example But, the form below is not minimized, using a Karnaugh map we can obtain: a b c d 1 Thus, we need a method to eliminate this redundant terms from the Quine-McCluskey solution. f = acd + abd + abc + bc + bd + cd F = abd + cd + bc 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Question: Given the prime implicant chart above, how can we identify the essential prime implicants of the function? 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Step 1: Find the independent terms 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Once a term is included in the solution, all the minterms covered by that term are covered. Therefore we may now mark the covered minterms and find terms that are no longer useful. 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example As we have not covered all the minterms with essential prime implicants, we must choose enough non-essential prime implicants to cover the remaining minterms. We choose first prime implicants that cover the most minterms. 2016/2/17 Jackie Kan Quine-McCluskey Method - An Example Therefore our minimum solution is: f(a,b,c,d) = bc + cd + abd 2016/2/17 Jackie Kan /2/17NTU DSD (Digital System Design) Glitch and Hazard 2016/2/17 Jackie Kan Simulation Results of Example Circuit Not Always Low 2016/2/17 Jackie Kan Kinds of Hazards Input change causes output to go from 1 to 0 to 1 Input change causes output to go from 0 to 1 to 0 Input change causes a double change from 0 to 1 to 0 to 1 OR from 1 to 0 to 1 to 0 Static 0-hazard Dynamic hazards Static 1-hazard 2016/2/17 Jackie Kan Verilog Code for The Example module f1(a,b,c,d,y); input a,b,c,d; output y; wire w1,w2,w3,w4,w5,w6; or #10 or1(w1,a,b); not #5 not1(w2,b); not #5 not2(w3,a); or #20 or2(w4,c,w2); and #5 and1(w5,w1,w4); and #5 and2(w6,w2,w3,d); or #5 or3(y,w5,w6); endmodule module test1; reg w,x,y,z; wire f; f1 ff1(w,x,y,z,f); initial begin w=0; x=0; y=0; z=0; #100 z=1; #100 x=1; end endmodule 2016/2/17 Jackie Kan Simulation Result Dynamic Hazard 2016/2/17 Jackie Kan Static1-Hazard (Also called SOP hazard) X = A' B + A C 2016/2/17 Jackie Kan Static 1-Hazard Consider ABC change from 111 to 011 A n1A n2AB n3AC X A and A are 0 at the same time 2016/2/17 Jackie Kan Solution for Eliminate the Static1-Hazard Coupled terms = A'B, AC Residues = B, C Residues ( ) is that part of a coupled term that remains after removing the coupled variable Hazard Cover Independent with coupled variable X = A' B + A C + B C 2016/2/17 Jackie Kan Static 0-Hazard (Also called POS hazard) X = (A+B)(A+C) 2016/2/17 Jackie Kan Static 0-Hazard Consider ABC change from 000 to 100 A n1A n2A + B n3A + C Y A and A are 1 at the same time 2016/2/17 Jackie Kan Solution for Eliminate the Static 0-Hazard Coupled terms = A+B, A+C Residues = B, C Residues ( ) is that part of a coupled term that remains after removing the coupled variable Hazard Cover Independent with coupled variable X = (A+B)(A+C)(B+C) 2016/2/17 Jackie Kan Multiplexer ABY 00I0 01I1 10I2 11I3 Multiplex Y Select S1S0 2016/2/17 Jackie Kan Multi-Bits Multiplexer A B Y ES bits 2X1 MUX 4 E (Enable) S (Select) Y 1XAll 0 00A 01B 2016/2/17 Jackie Kan Demultiplexer Demultiplexer( ) Demultiplexer ( ) m Control Signal n Output Signal 1 Input Signal 2016/2/17 Jackie Kan Demultiplexer S0S1Y0Y1Y2Y3 00D D D D DeMultiplex D Select S1S0 2016/2/17 Jackie Kan Decoder Decoder( ) Demultiplexer( ) Demultiplexer ( ) m Control Signal n Output Signal 1 Input Signal Decoder ( ) m Control Signal n Output Signal 2016/2/17 Jackie Kan to-16 Decoder 4-of-16 decoder(4 16 ) binary-to-decimal decoder ( ) ABCD=0001 Y1=H Others=L ABCD=0100 Y4=H Others=L 2016/2/17 Jackie Kan Encoder (encoder) Encoder ( ) m input signal n Output Signal 2016/2/17 Jackie Kan BCD 5 ABCD=0101 2016/2/17 Jackie Kan ROM (read-only memory, ROM) SOP( ) ROM AddressData 2016/2/17 Jackie Kan Logic Functions Made By ROM ROM AND-OR 2016/2/17 Jackie Kan On-Chip Decoding (on-chip decoding) 3 8 ABC=100 Y 3 Y 2 Y 1 Y 0 =0110 ABC=110 Y 3 Y 2 Y 1 Y 0 =0011 n 2 n 2016/2/17 Jackie Kan Mask ROM (word) 32 ROM 8 4 8X4 ROM TTL ROM 7488 IC 32X8 256 ROM IC 256X4 1024 ROM 74S370 IC 512X4 2048 ROM (mask) 2016/2/17 Jackie Kan PROM - Programmable ROM ROM (programmable ROM, PROM) PROM (burning in) PROM ROM X (fusible link) PROM AND OR 2016/2/17 Jackie Kan PROM - Programmable ROM PROM EPROM PROM ROM 2016/2/17 Jackie Kan PAL - Programmable Array Logic PAL (Programmable Array Logic) PAL AND OR PROM OR 2016/2/17 Jackie Kan Programmable Logic Devices PLA (Programmable Logic Array) AND OR PROM PAL PLA (Programmable Logic Device, PLD) 2016/2/17 Jackie Kan PLA - Programmable Logic Array 2016/2/17 Jackie Kan CPLD - Complex PLD CPLD PLD PAL 2016/2/17 Jackie Kan Summery PLA (Programmable Logic Array) PLD AND-OR AND OR PAL (Programmable Array Logic) PLA PAL AND OR PLA PAL GAL (Generic Array Logic) PAL EEPROM PAL Fuse/PROM OTP One-Time-Programmable EPROM PAL Fuse GAL 2016/2/17 Jackie Kan Summery PEEL (Programmable Electrically Erasable Logic) GAL 1,000 10 EEPROM EPLD (Electronic Programmable Logic Device) PLD Fuse PLD PLD EPLD CPLD (Complex Programmable Logic Device) PLD PLD PLD PLD CPLD SPLD (Simple Programmable Logic Device) PLD PLD SPLD Small PLD SPLD 2016/2/17 Jackie Kan Summary FPGA (Field Programmable Gate Array) GAL PLD Xilinx PLD CPLD FPGA FPGA CPLD FPGA SPLD CPLD PLD PLD CPLD FPGA 2016/2/17 Jackie Kan Quiz 2 Please implement these functions using PROM & PAL 2016/2/17 Jackie Kan /2/17NTU DSD (Digital System Design) Tri-State of Logic Device 2016/2/17 Jackie Kan Buses Concept is to link together multiple functional units over a common data highway at a lower cost than using multiple point to point links A B D E C P bus Q bus A B E C OR D 2016/2/17 Jackie Kan Bus - Essential Part of Any Computer CPU Primary Memory Secondary Memory I/O Data Bus Address Bus Control Bus 2016/2/17 Jackie Kan Logic State What is the logic state at point A? 2016/2/17 Jackie Kan Tri-state Logic Outputs Since we can have multiple masters on a bus, we need Tri-state logic for attachment to a bus so that each device can choose to drive or not drive the bus depending on whether it is the bus master for a given bus cycle Tri-state logic outputs prevent bus conflicts 2016/2/17 Jackie Kan TTL Output Stage 2016/2/17 Jackie Kan Tri-State Bus 2016/2/17 Jackie Kan Tri-State Buffer in Verilog module tri_buf_using_assign (x, oe); reg x, oe; wire pad; assign pad = (oe) ? x : 1'bz; endmodule; oe y x 2016/2/17 Jackie Kan Tri-State Buffer in VHDL ENTITY Buffer_Tri_State IS PORT(x: INstd_logic; y:OUTstd_logic; oe:INstd_logic ); END; ARCHITECTURE Buffer3 OF Buffer_Tri_State IS BEGIN WITH oe SELECT y