Presentation is loading. Please wait.

Presentation is loading. Please wait.

مدار منطقی Logic Circuits

Similar presentations


Presentation on theme: "مدار منطقی Logic Circuits"— Presentation transcript:

1

2 مدار منطقی Logic Circuits
Gate Level Minimization

3 Introduction Gate-level minimization refers to the design task of finding an optimal gate-level implementation of Boolean functions describing a digital circuit. This task is well understood, but is difficult to execute by manual methods when the logic has more than a few inputs.

4 The Map Method The complexity of the digital logic gates
The complexity of the algebraic expression Logic minimization Algebraic approaches: lack of specific rules The Karnaugh map (K-map) A simple straight forward procedure A pictorial form of a truth table Applicable if the # of variables < 7 A diagram made up of squares Each square represents one minterm A pictorial form of truth table

5 Review of Boolean Function
Sum of minterms or Product of maxterms Sum of products (or product of sum) in the simplest form A minimum number of terms A minimum number of literals The simplified expression may not be unique It will be assumed that the simplest algebraic expression is an algebraic expression with a minimum number of terms and with the smallest possible number of literals in each term

6 K-map Another way of venn diagram Squares instead of circles X′ X

7 Two variable K-map Four minterms m0 = X′Y′ m1 = X′Y m2 = XY′ m3 = XY 1
1 X X′ X′Y′ m0 X′Y m1 X 1 m2 XY′ m3 XY

8 Two variable K-map 1 1 1 F = XY = m3 Y X
1 X 1 1 به ازای هر تابع در جدول کارنو می توان عین جدول صحت محل صفرها و یک ها را مشخص کرد. البته مرسوم است که فقط محل مینمم ترمهایی که یک هستند را مشخص میکنند و سایر جاها که مشخص نشده است صفر در نظر می گیرند F = XY = m3

9 Two variable K-map 1 1 1 1 1 F = X+Y = X′Y+ XY′+ XY = m1 + m2 + m3 Y
X′Y + XY = Y 1 X 1 1 1 1 XY′ + XY = X F = X+Y = X′Y+ XY′+ XY = m1 + m2 + m3

10 Three Variable K-Map Eight Minterms
Any two adjacent squares in the map differ by only on variable Primed in one square and unprimed in the other e.g., m5 and m7 can be simplified m5+ m7 = xy'z + xyz = xz (y'+y) = xz The Gray code sequence Y′ Y YZ 00 01 11 10 X X′Y′Z′ m0 X′Y′Z m1 X′YZ m3 X′YZ′ m2 مشخصا کدی که دارای این ویژگی منحصر به فرد بود که دو کد کناری در یک متغییر متفاوت هستند کد گری است. X′ XY′Z′ m4 XY′Z m5 XYZ m7 XYZ′ m6 X 1 Z′ Z Z′

11 Three Variable K-Map Adjacent squares  any two squares that differ only in one variable m0 and m2 (m4 and m6) are adjacent m0+ m2 = x'y'z' + x'yz' = x'z' (y'+y) = x'z' m4+ m6 = xy'z' + xyz' = xz' (y'+y) = xz' YZ 00 01 11 10 X مطابق تغریف همة مربع های کنار هم همسایه هستند چون فقط در یک متغییر متفاوت هستند. ولی بعضی از مربع ها با وجود اینکه در شکل کنار هم نیستند نیز باز هم همسایه هستند چون فقط در یک متغییر متفاوت هستند. به بیان دیگر جدول کارنو را باید برروی خط تقارن آن نسبت به یک متغییر تا زد تا مربع های همسایه که در آن متغییر متفاوت هستند به دست آید. اگر جدول کارنو را برروی خط تقارن آن نسبت به یک متغییر تا بزنیم مربع هایی که روی هم میفتند فقط در آن متغییر متفاوت هستند. 1 3 2 4 5 7 6 1

12 Example1 simplify the Boolean function F(x, y, z) = S(2, 3, 4, 5)
F(x, y, z) = S(2, 3, 4, 5) = x'y + xy' X′Y YZ 00 01 11 10 X 1 1 1 1 1 XY′

13 Example2 simplify F(x, y, z) = S(3, 4, 6, 7)
F(x, y, z) = S(3, 4, 6, 7) = yz+ xz' YZ YZ 00 01 11 10 X در ساده سازی جدول کارنو باید تمام یک ها را در نظر گرفت و اگر یکی وجود داشت که با هیچ یک موجود دیگر همسایه نبود باید عینا معادلة خودش را بنویسیم 1 1 1 1 1 XZ′

14 Four adjacent squares simplify F(x, y, z) = S(0, 2, 4, 6)
F(x, y, z) = S(0, 2, 4, 6) = Z′ Z′ YZ 00 01 11 10 X 1 در جدول کارنو هرچه تعداد یکهای بیشتری همسایه باشند منجر به ساده تر شدن عبارت میشود. اگر 2n یک همسایه داشته باشیم n متغییر حذف میشوند. 1 1 1 1

15 Example3 simplify F(x, y, z) = S(0, 2, 4, 5, 6)
F(x, y, z) = S(0, 2, 4, 5, 6) = z'+ xy‘ Based on what rule we can use a minterm more than once? mi + mi = mi Using a minterm as many times as required to simplify the function Z′ YZ 00 01 11 10 X میتوان از یک ها به هر تعدد دفعاتی که لازم است استفاده کرد تا عبارت ساده تر شود. چون X + X = X بنابراین میتوان یک مینمم ترم را چندین بار نوشت و با مینمم ترم های دیگر ترکیب کرد تا عبارت را ساده تر بیان کنیم(در صورت نیاز) 1 1 1 1 1 1 XY′ m4 has been used twice

16 Example4 simplify F(x, y, z) = S(0, 2, 5)
F(x, y, z) = S(0, 2, 5) = x′z'+ xy′z X′Z′ YZ 00 01 11 10 X 1 1 1 1 No adjacent minterm  can not be simplified XY′Z

17 Example5 let F(A,B,C) = A'C + A'B + AB'C + BC
a) Express it in sum of minterms. b) Find the minimal sum of products expression. Ans.a) F(A, B, C) = S(1, 2, 3, 5, 7) Ans.b) F(A, B, C) = S(1, 2, 3, 5, 7) = C + A′B A′C? A′B? BC? AB′C? A′B BC 00 01 11 10 A به راحتی میتوان از روی جدول کارنو تابع را به فرم مجموع مینمم ترم ها در آورد و ساده کرد. جدول کارنو در واقع همان جدول صحت است. مثلا برای ترم A’C باید تمام خانه هایی که در آن A صفر و C یک است را علامت زد. 1 1 1 1 1 1 1 1 C 17

18 Four variable K-Map 16 minterm
Combinations of 2, 4, 8, and 16 adjacent squares YZ Y′ Y 00 01 11 10 WX 00 1 3 2 X′ W′ 01 4 5 7 6 X One square represents one minterm, giving a term with four literals. Two adjacent squares represent a term with three literals. Four adjacent squares represent a term with two literals. Eight adjacent squares represent a term with one literal. Sixteen adjacent squares produce a function that is always equal to 1. 11 12 13 15 14 W 10 8 9 11 10 X′ Z Z′ Z′

19 Example6 simplify F(w, x, y, z) = S(0, 1, 2, 4, 5, 6, 8, 9, 12, 13, 14) F = y'+w'z'+xz' YZ 00 01 11 10 W′Z′ WX 00 1 1 1 1 1 1 01 در ترکیب کردن یک ها حتما باید تعداد یک ها توانی از 2 باشد مثلا ترکیب 6 تایی فایده ندارد. XZ′ 1 11 1 1 10 1 1 Y′

20 Example7 simplify F(A,B,C,D) = ABC + BCD + ABCD + ABC
F = B′D′+B′C′ B′C′ CD 00 01 11 10 AB 00 1 1 1 01 B′D′ 11 10 1 1 1

21 Example8 simplify F(A,B,C,D) = ABC + BCD + ABCD + ABC
F = B′D′+B′C′+A′CD′ B′C′ CD 00 01 11 10 AB A′CD′ 00 1 1 1 01 1 B′D′ 11 10 1 1 1

22 Prime Implicants In choosing adjacent terms A prime implicant:
All the minterms must be covered. Minimize the number of terms. No redundant term A prime implicant: a product term obtained by combining the maximum possible number of adjacent squares (combining all possible maximum numbers of squares). Essential P.I.: a minterm is covered by only one prime implicant. The essential P.I. must be included. First we should find all essential P.I.

23 Example9 Simplify F(A, B, C, D) = S(0, 2, 3, 5, 7, 8, 9, 10, 11, 13, 15) First we should Find essential P.I. F = BD + B′D′+??? CB′ CD CD B′D′ CD 00 01 11 10 AB 1 1 00 1 BD 01 1 1 اول از همه باید سراغ مینمم ترم هایی رفت که فقط میتوانند در یک گروه با حداکثر همسایه قرار گیرند که همان Essential prime implicant نامیده میشوند. در مقابل بعضی از مینمم ترم ها را مثلا میتوان در دو یا سه گروه 4 تایی مختلف قرار داد بنابراین ابتدا به سراغ آنها نمیرویم AD AD F= BD + B′D′+ AB′+CD F= BD + B′D′+ AD+CD F= BD + B′D′+ AD+CB′ F= BD + B′D′+ AB′+CB′ 1 1 11 AB′ 1 1 1 1 10

24 Five variable K-map Map for more than four variables becomes complicated Five-variable map: two four-variable map (one on the top of the other). یک راه نشان دادن جدول 5 متغییره استفاده از دو جدول مجزای 4 متغییره است که به صورت مجازی روی هم قرار گرفته اند. در این صورت خانه هایی که روی هم قرار دارند مجاور محسوب می شوند. راه دیگر نیز همان راهی است که تا به حال دنبال کردیم به این صورت که بک جدول 32 تایی درست کرده و متغییرها را به صورت گری کد گذاری میکنبم

25 Five variable K-map CDE AB 1 3 2 6 7 5 4 000 001 011 010 110 111 101
1 3 2 6 7 5 4 000 001 011 010 110 111 101 100 AB 00 1 3 2 6 7 5 4 8 9 11 10 14 15 13 12 8 01 بهتر است برای یافتن محل مینمم ترمها ارزش کدها را در کنار هر سطر و ستون بنویسیم و محل هر مینمم ترمی از جمع سطرها وستون ها بدست می اید. 24 25 27 26 30 31 29 28 24 11 16 17 19 18 22 23 21 20 16 10

26 Example10 F = A'B'E'+BD'E+ACE
simplify F = S(0, 2, 4, 6, 9, 13, 21, 23, 25, 29, 31) F = A'B'E'+BD'E+ACE A′B′E′ CDE 1 3 2 6 7 5 4 000 001 011 010 110 111 101 100 AB 1 1 1 1 00 1 1 8 01 هر محور تقارنی یک متغییر را حذف می کند. ترکیب 4 تایی دو محور تقارن دارد. ترکیب 8 تایی 3 محور تقارن دارد و الی آخر. 1 1 1 24 11 1 1 16 10 BD′E ACE

27 Example 10 F = S(0, 2, 4, 6, 9, 13, 21, 23, 25, 29, 31) روشهای بسیار متفاوتی در نمایش جدول وجود دارد، فقط باید به این نکته توجه کرد که خانه های کنار هم در یک متغییر متفاوت باشند.

28 Example 10 Another Map for Example 10

29 Product of Sums Simplification
In all previous simplification the final result is in form of Sum of product(SOP) For POS there is two approach: Approach #1 Simplified F' in the form of sum of products Apply DeMorgan's theorem F = (F')' F': sum of products → F: product of sums تا به حال هر چه ساده سازی انجام میشد به SOP منجر میشد. حال اگر بخواهیم با استفاده از جدول به POS برسیم دو راهکار داریم 1- به جای یک ها به سراغ صفر ها برویم و آنها را دسته بندی و ساده کنیم. درواقع به صورت ذهنی صفرها را یک در نظر بگیریم. در این صورت تابع متمم F به فرم SOP بدست می آید. سپس با متمم گرفتن از این تابع طبق قضیة دمورگان به تابع F که در فرم POS هست خواهیم رسید. 2- مستفیما در جدول کارنو در فضای ماکس ترم ها فکر کنیم. یعنی هر خانة جدول را یک Maxterm در نظر بگیریم و با ساده سازی صفرها مستقیما Maxtermها را بدست آوریم. همان قوانینی که برروی Mintermها حاکم بود برروی Maxtermها هم حاکم است. یعنی دو Maxterm همسایه فقط در یک متغییر متفاوت هستند و اگر در تابعی این دو Maxterm صفر بود آن متغییر ذر آن جمله حذف می شود.

30 Product of Sums Simplification
Approach #2: duality Combinations of maxterms M0M1 = (A+B+C+D)(A+B+C+D') = (A+B+C)+(DD') = A+B+C CD AB 00 01 11 10 00 M0 M1 M3 M2 M4 M5 M7 M6 M12 M13 M15 M14 M8 M9 M11 M10 01 11 10

31 Example 11 Simplify F (A, B, C, D) = S(0, 1, 2, 5, 8, 9, 10) in form of POS F' = AB+CD+BD′  DeMorgan  F = (A′+B′)(C′+D′)(B′+D) CD 00 01 11 10 CD C′+D′ AB Essential P.I. 00 1 1 1 B′+D BD′ 01 1 Essential P.I. برای ساده سازی ابتدا باید به سراغ essential Prime implicants برویم. ترم قرمز و سبز خیلی راحت محاسبه میشوند. وقتی در کل ستون ها ترم قرمز وجود دارد یعنی اصلا به متغییرهای ستون که همان CD هستند وابسته نیست. و همینطور برای ترم سبز وقتی در کل سطرها مقدار یکسان دارد یعنی اصلا به متغییر سطرها که AB است وابسته نیست. در روش اول فرض کردیم صفرها یک هستند و بنابراین حاصل ساده سازی گروه ها را به صورت مینمم ترمهای ساده شده نوشتیم(ضربهای ساده شده) در روش دوم صفرها را همان صفر در نظر میگیرم و هنگام ساده سازی حاصل را به صورت Maxtermهای ساده شده مینویسیم(جمع های ساده شده) 11 1 10 1 1 AB A′+B′ Essential P.I.

32 Example 12 Simplify F (A, B, C, D) = S(0, 1, 2, 5, 8, 9, 10) in form of SOP F = B′D′ + B′C′ + A′C′D B′C′ B′D′ A′C′D CD 00 01 11 10 AB 00 1 1 1 01 1 11 10 1 1 1

33 Two level implementation
Gate implementation در جملة SOP یک ترم 3 ورودی داریم که کمی پیاده سازی را سخت تر می کند. بنابراین در این تابع فرم POS از نظر پیاده سازی ارجحیت دارد. تعداد ورودی کمتری دارد. هر دو فرم POS و ُSOP را Two level implementation مینامیم که ممکن است از نظر عملی غیرممکن باشد. چون با اضافه شدن تعداد جمله ها، تعداد ورودی های گیت مرحلة دوم افزایش می یابد. Sum-of products form Product-of sums form Two level implementation

34 From Truth table 1 1 1 1  F=X′Z + XZ′  F=(X+Z)(X′+Z′) X′Z YZ X+Z 00
01 11 10 X 1 1 XZ′ 1 1 1 X′+Z′  F=X′Z + XZ′  F=(X+Z)(X′+Z′)

35 From POS to K-Map Insert F(A,B,C,D) = (A′+B′+C′)(B+C) into K-Map
Approach #1 Complement the function  F′ = ABC + B′C′ Insert 0 in the mintems of F′, and the remaining squares are 1 Approach #2 Thinking of Maxterms directly CD 00 01 11 10 AB 00 1 1 دقت کنید که Maxterm صفر یکتا درست می کند و Minterm یک یکتا 01 1 1 1 1 B+C B′C′ 11 1 1 ABC A′+B′+C′ 10 1 1

36 Don’t-Care condition The value of a function is not specified for certain combinations of variables BCD; : don't care The don't-care conditions can be utilized in logic minimization Can be implemented as 0 or 1 ورودی های بی اهمیت ورودی هایی هستند که می دانیم به هیچ وجه در سیستم اتفاق نمی افتند. این ورودیها در شرایط کار عادی در مدار اتفاق نمی افتند. بنابراین می توان آنها را اصلا در نظر نگرفت و یا اینکه بهتر است اگر باعث ساده سازی مدار می شوند آنها را به دلخواه صفر و یا یک در نظر گرفت. نکته: اگر برای ساده سازی از یک ورودی بی اهمیت استفاده کردیم و آنرا یک در نظر گرفتیم اگر به هر دلیلی آن ورودی به مدار اعمال شود خروجی مدار ما یک می شود. بنابراین باید بتوانیم خروجی ها را به ازای مقادیر بی اهمیت پیش بینی کنیم. در حالت ساده سازی SOP اگر از حالت بی اهمیتی استفاده شود یعنی تابع به ازای آن حالت یک در نظر گرفته شده است. و در نتیجه با رخ داد آن حالت بی اهمیت خروجی یک میشود. در حالت ساده سازی POS اگر از حالت بی اهمیتی استفاده شود یعنی تابع به ازای آن حالت صفر در نظر گرفته شده است. و در نتیجه با رخ داد آن حالت بی اهمیت خروجی صفر میشود.

37 Example 13(SOP) simplify F(w, x, y, z) = S(1, 3, 7, 11, 15), d(w, x, y, z) = S(0, 2, 5). F = YZ + W′Z = S(1, 3, 5, 7, 11, 15) F = YZ + W′X′ = S(0, 1, 2, 3, 7, 11, 15) W′Z YZ YZ W′X′ 00 01 11 10 WX x 00 1 1 1 x 1 01 1 x 1 Safe implementation اگر تابع کار بسیار مهمی برای ما انجام می دهد مثلا چاشنی انفجاری آنگاه در طراحی عملی هیچ موقع از حالت های بی اهمیت برای ساده سازی استفاده نمی شود چون حالت بی اهمیت ممکن است بر اثر نویز به وجود آید. بنابراین در این مثال تابع اولی چون فقط از یک حالت بی اهمیت استفاده کرده قابلیت اطمینان بالاتری دارد. 11 1 10 1

38 Example 14(POS) simplify F(w, x, y, z) = S(1, 3, 7, 11, 15), d(w, x, y, z) = S(0, 2, 5). F = Z(Y+W′) Z YZ 00 01 11 10 WX x 00 1 1 x 01 x 1 Y + W′ 11 1 10 1

39 NAND and NOR Implementation
Digital circuits are frequently constructed with NAND or NOR gates rather than with AND and OR gates. NAND and NOR gates are easier to fabricate with electronic components and are the basic gates used in all IC digital logic families. Rules and procedures have been developed for the conversion from Boolean functions given in terms of AND, OR, and NOT into equivalent NAND and NOR logic diagrams.

40 NAND gate The NAND gate is said to be a universal gate because any logic circuit can be implemented with it. To show that we must show that AND, OR, NOT gate can be implemented with only NAND gate Q = A′ Q = AB Q = A+B

41 NAND Gate Two graphic symbols for a NAND gate DeMorgan’s Theorem

42 NOR Gate The NOR gate is also said to be a universal gate because any logic circuit can be implemented with it. To show that we must show that AND, OR, NOT gate can be implemented with only NOR gate Q = A′ Q = A+B Q = AB

43 NOR Gate Two graphic symbols for a NOR gate DeMorgan’s Theorem

44 Two Level Implementation(NAND Gate)
The implementation of Boolean functions with NAND gates requires that the functions be in sum-of-products form. F = AB + CD برای اینکه تابعی که به فرم SOP است فقظ با گیت NAND پیاده سازی شود از مرحلة آخر شروع کرده و یکی یکی گیت ها را به فرم NAND در می آوریم: دقت کنیم که گیت OR را به صورت Inverted-Or که همان NAND است در می اوریم و گیت AND را به صورت AND-Invert. هر دایزه نشان دهندة یک متمم است و دایره ها باید هم دیگر را خنثی کنند تا تابع اصلی عوض نشود. اگر جایی فقط یک ورودی داشت و یا دایره با دایرة خروجی NAND خنثی نشود باید یک گیت NOT خودمان وارد کنیم.

45 Example15 Implement the Boolean function F (x, y, z) = S(1, 2, 3, 4, 5, 7) with NAND Gates. F = x′y + xy′ + z Z X′Y YZ 00 01 11 10 X 1 1 1 1 1 1 1 در مرحلة اول باید تابع را به فرم SOP خلاصه کرد. XY′

46 Two Level NAND Gate Implementation
1. Simplify the function and express it in sum-of-products(SOP) form. 2. Draw a NAND gate for each product term of the expression that has at least two literals. The inputs to each NAND gate are the literals of the term. This procedure produces a group of first-level gates. 3. Draw a single gate using the AND-invert or the invert-OR graphic symbol in the second level, with inputs coming from outputs of first-level gates. 4. A term with a single literal requires an inverter in the first level. However, if the single literal is complemented, it can be connected directly to an input of the second level NAND gate.

47 Extending the inputs of NAND Gate
Implement the Function F = ABC + A′B′DE with two inputs NAND Gate. (AB)′ AB A A B B C C A′ A′ B′ B′ D D E E

48 Multi Level NAND Circuits
AND-OR logic → NAND-NAND logic AND → AND + inverter OR: inverter + OR = NAND For every bubble that is not compensated by another small circle along the same line, insert an inverter. F = A (CD + B) + BC′ برای تبدیل مدار به فرم NAND از سمت راست به چپ حرکت می کنیم. به ازای گیت OR از سیمبل Inverted OR که نمادی از گیت NAND است استفاده می کنیم و همینطور به سمت چپ حرکت کرده و دایره های اضافی را خنثی می کنیم تا تابع عوض نشود.

49 Multi Level NAND Circuits
1. Convert all AND gates to NAND gates with AND-invert graphic symbols. 2. Convert all OR gates to NAND gates with invert-OR graphic symbols. 3. Check all the bubbles in the diagram. For every bubble that is not compensated by another small circle along the same line, insert an inverter (a one-input NAND gate) or complement the input literal.

50 Example F = (AB′ + A′B)(C + D′)

51 NOR Implementation NOR function is the dual of NAND function.
The NOR gate is also universal F = (A + B)(C + D)E چون پیاده سازی با NOR دوگان پیاده سازی با NAND است. بنابراین تمام مراحل نیز دوگان میشود. به این صورت که به جای گیت AND از INVERTED AND استفاده میشود. و OR ها تیدیل به NOR میشوند. و تمام NOT های اضافی باید جبران شوند.

52 Example F = (AB′ + A′B)(C + D′)

53 Other Two-level Implementations (Wired logic)
A wire connection between the outputs of two gates Only in special gates are possible(Take care) Not a physical gate Open-collector TTL NAND gates: wired-AND logic The NOR output of ECL gates: wired-OR logic AND-OR-INVERT function OR-AND-INVERT function

54 Non-degenerate Forms How many two level implementation is possible?
Four Gates  AND, OR, NAND, NOR 16 possible combination of two level forms Eight of them: degenerate forms = a single operation AND-AND, AND-NAND, OR-OR, OR-NOR, NAND-OR, NAND-NOR, NOR-AND, NOR-NAND. The eight non-degenerate forms AND-OR, OR-AND, NAND-NAND, NOR-NOR, NOR-OR, NAND-AND, OR-NAND, AND-NOR. AND-OR and NAND-NAND = sum of products. OR-AND and NOR-NOR = product of sums. NOR-OR, NAND-AND, OR-NAND, AND-NOR = ? اگر 4 گیت AND, OR, NAND, NOR را در نظر بگیریم و یکی از آنها را به مرحلة اول و دیگری را به مرحلة دوم بدهیم به 16 ترکیب میرسیم که هشت ترکیب آن به درد نمیخورد. چون گیت ها مشابه هستند. و فقط یک عملگر را دارند

55 AND-OR-Invert Implementation
AND-OR-INVERT (AOI) Implementation NAND-AND = AND-NOR = AOI F = (AB+CD+E)' F' = AB+CD+E (sum of products) با استفاده از AND-NOR و یا NAND-AND میتوان SOP را پیاده کرد که متمم شده است. چون این نوع پیاده سازی شبیه AND-OR که برای SOP بود است فقط طبقة آخر دارای گیت NOT نیز است. بنابراین در پیاده سازی تابع F به وسیلة AND-OR Invert باید F’ را به فرم SOP در بیاوریم و آنرا با این روش پیاده کنیم که منجر به پیاده سازی تابع F میشود. یعنی در جدول صحت برای ساده سازی تابع به سراغ صفرها میرویم تا F’ به فرم SOP در آید.

56 OR-AND-Invert Implementation
OR-AND-INVERT (OAI) Implementation OR-NAND = NOR-OR = OAI F = ((A+B)(C+D)E)' F' = (A+B)(C+D)E (product of sums) در این حالت نیز باید F’ را به فرم POS ساده کنیم تا بتوان تابع را در دو مرحله پیاده کرد.

57 Tabular Summary

58 Example Implement the function F = x'y'z'+xyz' with four two level implementation of previous table در این حالت باید به سراغ صفرها در جدول صحت رفت و آنها را یک در نظر گرفت و با ساده سازی آن تابع F’ را به فرم SOP بدست آورد.

59 Example در این حالت باید به سراغ یک ها در جدول صحت رفت و آنها را صفر در نظر گرفت تا با ساده سازی صفرها تابع F’ به فرم POS در آید.

60 Exclusive-OR Function
Exclusive-OR (XOR) xÅy = xy'+x'y Exclusive-NOR (XNOR) (xÅy)' = xy + x'y' Some identities xÅ0 = x xÅ1 = x' xÅx = 0 xÅx' = 1 xÅy' = x‘ Åy = (xÅy)' Commutative and associative AÅB = BÅA (AÅB) ÅC = AÅ (BÅC) = AÅBÅC

61 Exclusive-OR Implementations

62 Exclusive-OR Implementations
NAND Implementation (x'+y')x + (x'+y')y = xy'+x'y = xÅy

63 Odd Function AÅBÅC = (AB'+A'B)C' +(AB+A'B')C = AB'C'+A'BC'+ABC+A'B'C = S(1, 2, 4, 7) XOR is a odd function → an odd number of 1's, then F = 1. XNOR is a even function → an even number of 1's, then F = 1.

64 XOR and XNOR Logic diagram of odd and even functions

65 Four-variable Exclusive-OR function
AÅBÅCÅD = (AB'+A'B)Å(CD'+C'D) = (AB'+A'B)(CD+C'D')+(AB+A'B')(CD'+C'D) با توجه به اینکه می دانیم XOR تابع فرد و XNOR تابع زوج است، به راحتی می توان جدول کارنو را رسم کرد.

66 Parity Generation and Checking
A parity bit: P = xÅyÅz Parity check: C = xÅyÅzÅP C=1: one bit error or an odd number of data bit error C=0: correct or an even # of data bit error

67 HDL (Hardware Description Language)
Manual methods for designing logic circuits are feasible only when the circuit is small. Prototype integrated circuits are too expensive and time consuming to build, so all modern design tools rely on a hardware description language to: Describe Design Test a circuit in software

68 HDL VHDL : VHSIC(Very high speed integrated circuit) Hardware description language. Verilog V1995 V2001 V2005 VHDL: Strongly typed language Verilog: Loosely typed language

69 Verilog Case sensitive Single line comments start with //
Multiline comments is between /* and */ Program skeleton Module and Ports description Signals declaration Program body

70 Program skeleton (V1995) module [Name] (prot_name1, port_name2, ….); [mode] [prot_name1]; [mode] [prot_name2]; [mode] [prot_name3]; … [type] [prot_name1]; [type] [prot_name2]; // signals declaration [data_Type] [Name]; .. // Program body endmodule به طور کلی هر خط زیان verilog با ; تمام میشود به غیر از خطوطی که با end یک چیزی را میبندند.

71 Mode and Type Mode date type input output inout wire reg integer time
real realtime

72 Example V1995 حتی اگر تعریف نکنیم خودش تعریف میکتد

73 Program skeleton (V2001) module [Name] ( [mode] [type] [width] prot_name1, [mode] [type] [width] port_name2, …. [mode] [type] [width] Port_nameN); //Signal declaration [type] [width] signal_name1; //Program body endmodule

74 Example V2001 module simple_circuit2( input wire A, input wire B, C, output wire D, E); //signals declaration wire w1; and G1(w1, A, B); not G2(E,C); or G3(D, w1, E); endmodule ترتیب نوشتن مهم نیست نوع wire پیش فرض است و میتوان ننوشت. instantiations of a gate The output of a primitive gate is always listed first, followed by the inputs.

75 Verilog primitives Gate primitives

76 Verilog primitives Transmission gate primitives

77 Verilog primitives Switch Primitives

78 primitive instantiation
first signal is output, others are input [Primitive name] [user_name](output, input1, input2, …); Only not and buf primitive can have more than one output buf [user_name](output1, output2, output3, …, input); not [user_name](output1, output2, output3, …, input);

79 Gate delays(only for simulation)
All physical circuits exhibit a propagation delay between the transition of an input and a resulting transition of an output. In Verilog, the propagation delay of a gate is specified in terms of time units and by the symbol #. The numbers associated with time delays in Verilog are dimensionless. Compiler directives start with the (`) back quote symbol

80 Gate delays

81 Test bench In order to simulate a circuit with an HDL, it is necessary to apply inputs to the circuit so that the simulator will generate an output response. An HDL description that provides the stimulus to a design is called a test bench. In its simplest form, a test bench is a module containing a signal generator and an instantiation of the model that is to be verified. Note that the test bench has no input or output ports, because it does not interact with its environment. Within the test bench, the inputs to the circuit are declared with keyword reg and the outputs are declared with the keyword wire.

82 Test bench

83 Test waveform

84 Test bench The initial keyword is used with a set of statements that begin executing when the simulation is initialized. The signal activity associated with initial terminates execution when the last statement has finished executing. The set of statements to be executed is called a block statement and consists of several statements enclosed by the keywords begin and end. $finish system task to specify termination of the simulation. All system task are started with $ sign.

85 Boolean expression Boolean equations describing combinational logic are specified in Verilog with a continuous assignment statement consisting of the keyword assign followed by a Boolean expression. &  bitwise and |  bitwise or ^  bitwise xor ~  bitwise not assign c = a & b; assign d = (a | b)& ~c;

86 User defined primitives
The logic gates used in Verilog descriptions with keywords and, or, etc., are defined by the system and are referred to as system primitives. The user can create additional primitives by defining them in tabular form. These types of circuits are referred to as user-defined primitives (UDPs). they are declared with the keyword pair primitive endprimitive.

87 UDPs It is declared with the keyword primitive, followed by a name and port list. There can be only one output, and it must be listed first in the port list and declared with keyword output. There can be any number of inputs. The order in which they are listed in the input declaration must conform to the order in which they are given values in the table that follows. The truth table is enclosed within the keywords table and endtable. The values of the inputs are listed in order, ending with a colon (:). The output is always the last entry in a row and is followed by a semicolon (;). The declaration of a UDP ends with the keyword endprimitive.

88 UDPs

89 Instantiation of UDPs M1 G1 M1 G1

90 Home works 3.1, 3.4, 3.5, 3.8, 3.9, 3.10, 3.14, 3.15, 3.16, 3.20, 3.23,


Download ppt "مدار منطقی Logic Circuits"

Similar presentations


Ads by Google