לוגיקה צרופית Combinatorial Logic מעגל צירופי לוגי n m

Slides:



Advertisements
Similar presentations
Chapter 4 -- Modular Combinational Logic. Decoders.
Advertisements

Comparator.
Lecture Adders Half adder.
Fast Adders See: P&H Chapter 3.1-3, C Goals: serial to parallel conversion time vs. space tradeoffs design choices.
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Arithmetic See: P&H Chapter 3.1-3, C.5-6.
CS 140 Lecture 14 Professor CK Cheng 11/14/02. Part II. Standard Modules A.Interconnect B.Operators. Adders Multiplier Adders1. Representation of numbers.
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
© Yohai Devir 2007 Fast Arithmetics. © Yohai Devir 2007 Full Adder Cout AiAi BiBi SiSi Cin.
Homework Reading Machine Projects Labs
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
Calculator Lab Overview Note: Slides Updated 10/8/12
Adders and Multipliers Review. ARITHMETIC CIRCUITS Is a combinational circuit that performs arithmetic operations, e.g. –Addition –Subtraction –Multiplication.
Morgan Kaufmann Publishers
Digital Arithmetic and Arithmetic Circuits
Carry look ahead adder P (I) = a(I) xor b(I); G(I) = a(I) and b(I); S(I) = p(I) xor c(I); Carry(I+1) = c(I)p(I) + g(I)
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
Arithmetic Functions BIL- 223 Logic Circuit Design Ege University Department of Computer Engineering.
COE 202: Digital Logic Design Combinational Circuits Part 2 KFUPM Courtesy of Dr. Ahmad Almulhem.
1 Lecture 12 Time/space trade offs Adders. 2 Time vs. speed: Linear chain 8-input OR function with 2-input gates Gates: 7 Max delay: 7.
Sneha.  A combinational circuit that performs the addition of two bits is called a half adder.  It has two inputs.  It has two outputs.
08 ARTH Page 1 ECEn/CS 224 Number Representation and Binary Arithmetic.
Building a Faster Adder
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
1 Carry Lookahead Logic Carry Generate Gi = Ai Bi must generate carry when A = B = 1 Carry Propagate Pi = Ai xor Bi carry in will equal carry out here.
C-H1 Lecture Adders Half adder. C-H2 Full Adder si is the modulo- 2 sum of ci, xi, yi.
CHAPTER 2 Digital Combinational Logic/Arithmetic Circuits
1 Lecture 11: Hardware for Arithmetic Today’s topics:  Logic for common operations  Designing an ALU  Carry-lookahead adder.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1.
UNIT 8 COMBINATIONAL CIRCUIT DESIGN AND SIMULATION USING GATES
Presented by A. Maleki Fall Semester, 2010
Lecture 12 Logistics Last lecture Today HW4 due today Timing diagrams
Chapter 4 -- Modular Combinational Logic
Lecture Adders Half adder.
CS2100 Computer Organisation
Single Bit ALU 3 R e s u l t O p r a i o n 1 C y I B v b 2 L S f w d O
Homework Reading Machine Projects Labs
Part 4 Combinational Logic.
Addition and multiplication
Space vs. Speed: Binary Adders
Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables, logic gates,
Carry Look Ahead (CLA).
ECE/CS 552: Carry Lookahead
Unit5 Combinational circuit and instrumentation system.
Combinational Circuits
CSE Winter 2001 – Arithmetic Unit - 1
Topic 3b Computer Arithmetic: ALU Design
Lecture 14 Logistics Last lecture Today
ELL100: INTRODUCTION TO ELECTRICAL ENGG.
Instructor: Alexander Stoytchev
INTRODUCTION TO LOGIC DESIGN Chapter 4 Combinational Logic
Instructor: Alexander Stoytchev
Unit 5 COMBINATIONAL CIRCUITS-1
Topic 3b Computer Arithmetic: ALU Design
CS 140 Lecture 14 Standard Combinational Modules
Chapter 5 – Number Representation and Arithmetic Circuits
Digital System Design Combinational Logic
Homework Reading Machine Projects Labs
CSE 140 Lecture 14 Standard Combinational Modules
Addition and multiplication
Instructor: Mozafar Bag-Mohammadi University of Ilam
Lecture 14 Logistics Last lecture Today
Addition and multiplication
Instructor: Alexander Stoytchev
74LS283 4-Bit Binary Adder with Fast Carry
Arithmetic Circuits.
ECB2212-Digital Electronics Numbering Systems
Number Representation
Lecture 2 Adders Half adder.
Presentation transcript:

לוגיקה צרופית Combinatorial Logic מעגל צירופי לוגי n m משתני כניסה m משתני יציאה נוהל תכנון: Design Principles תאור הבעיה. קביעת מספר משתני הכניסה הקיימים ומספר משתני היציאה הנדרשים. התאמת סמלים למשתני הכניסה והיציאה. בניית טבלת אמת המגדירה את היחסים הנדרשים בין הכניסות ליציאות. פישוט הפונקציה הבוליאנית עבור כל יציאה. "קיבוץ" ופישוט של הפונקציה הכוללת. תיאור וכתיבת הדיאגרמה הלוגית.

BCD => Seven -Segment - Decoder a Seven Segment f g b e c d קלט: מספר בן 4 ביטים ב –BCD פלט: 7 פונקציות בוליאניות כך שכל פונקציה הינה "1" אמ"מ ה- Segment המתאים צריך לדלוק. נבנה את טבלת האמת. נחשב את a…g ע"י מפות קרנו. נצמצמם את המעגלים ע"י חיפוש שערים חוזרים.

טבלת אמת  :BCD  7 Seg 1  D (A,B,C,D)=>a a = B’D’ + C + A + BD B n BCD IN 7 Seg Out A B C D a b c d e f g 1 2 3 4 5 6 7 8 9 other  D 00 a = B’D’ + C + A + BD 1  (A,B,C,D)=>a a =(B’+D+C) (A+B+C+D’) 01 B 11 A 10 AB CD C

1 e = D’B’ + CD’ = D’(B’+C)  e = (B’+C)D’ D B A AB CD C  B A D C AB CD 00 01 11 10 e = D’B’ + CD’ = D’(B’+C) e = (B’+C)D’ (A,B,C,D) =>e

חצי מחבר – Half Adder HA S = X  Y (a  b) C = X • Y (a • b) חצי מחבר: מקבל 2 סיביות ומחזיר את סכומן (mod 2) ואת הנשא. HA b0 a0 C S a b s c 1 S = X  Y (a  b) C = X • Y (a • b) A B S C (a+b)’=a’b’ (a’b’ + c)’= =(a’b’)’•(a•b)’ =(a+b)•(a’+b’) =aa’ + ab’ + ba’ +bb’ a S b C (ab)’ ab חובר בספטמבר 2001

מחבר מלא – Full Adder 1 1 FA S C bn an Sn Cn Cn-1 x y z c s 1 הפונקציות s,c סימטריות ב x,y,z "תפקידי" x,y,z הינם זהים S = x’y’z + x’yz’ + xy’z’ + xyz C = xy + yz + xz Y Y 1 1 X X S C Z Z

Ripple Carry Adder

4-Bit Adder

מחבר / מחסר 1

שמוש במחבר להמרת קודים (X)BCD = (X+3)Excess-3 “O” “I” 1 2 3 4 5 6 7 8 9 * Self complementary to 9’s comp. (X)BCD = (X+3)Excess-3 S4 S3 S2 S1 (לא בשמוש) C5 C1 “O” 4 3 2 A1 4 3 2 B1 BCD “I” ממיר Excess-3 <= BCD

משווה גודל - Comparator 1 “1” A<0 B0 השער יוציא "1" כאשר A0 ו- B<0. “1” A0 B<0 השער יוציא "1" כאשר A<0 ו- B0. S3=1: אין overflow ו – A-B<0 S3=0: אין overflow ו – A-B0 A>B: AB וגם AB

חיבור מהיר – Carry Look Ahead : במחבר רגיל הנשא nC מיוצר ע”י 2n רמות של שערים: cn cn-1 c1 c1 2 דרגות שערים 2 דרגות שערים זמן החיבור תלוי בגודל המספר או לפחות במספר ביטי הייצוג. “פתרון” אפשרי: שימוש במעגלים מהירים יותר לצורך החיבור. פתרון “אלגוריתמי”: משתמש בתכונות של חיבור. נסתכל על שער i: א. אם ai=1 ו-bi=1 אזי יהיה נשא (ci+1=1) ללא תלות בערך ci. ב. אם ai=1 או bi=1 (אך לא שניהם) קיים “פוטנציאל” לקיום נשא: אם ci=1 אזי ci+1=1. ai bi Ci+1 Ci Si

מחברים מהירים – המשך: bi=1, ai=1 => נשא ודאי: פונקציה יוצרת נשא Gi = ai • bi ai  bi=1 => נשא אפשרי: Pi = ai  bi פונקציה מקדמת נשא bi ai Pi Gi נרשום עתה את Si, Ci+1 כפונקציה של Ci,Gi,Pi: Si = Pi  Ci Ci+1 = Gi+PiCi Pi, Gi מחושבות “מייד” ללא תלות בנשא מדרגה קודמת. נפתח עתה את ci באופן רקורסיבי.

פיתוח רקורסיבי: C1 = G0 + P0•C0 = G0 C2 = G1 + P1•C1 = G1 + P1•G0 = 0 C1 = G0 + P0•C0 = G0 C2 = G1 + P1•C1 = G1 + P1•G0 C3 = G2 + P2•C2 = G2 + P2•(G1 + P1•G0) = G2 + P2•G1 + P2•P1•G0 C4 = G3 + P3•C3 = G3+P3•(G2 + P2•G1 + P2•P1•G0) = G3 + P3G2 + P3P2G1 + P3P2P1G0 Ci+1 = Gi + PiGi-1 + PiPi-1Gi-2 + … +PiPi-1 … P1G0 = מימוש C4: G0 P1 P2 P3 G1 P2 P3 G2 P3 G3 C4

מימוש ריבוי כניסות ע"י שערים עם דרגת כניסה של 2 : G0 G0 P1 P1 P2 To C4 P2 To C4 P3 P3 מימוש בשערים "רגילים" מצמצם את זמן החישוב של הנשא (ולכן זמן החיבור הכולל) מ - O(n) ל – O(log2n). ניתן לממש שערים עם דרגת כניסה גבוהה קבוע ע"י שימוש בתכונות מתגים

מימוש ריבוי כניסות ע"י מתגים חשמליים

מימוש ריבוי כניסות ע"י מתגים חשמליים

Adder w/ Carry Look Ahead * *

מימוש מחברBCD ע"י FAs: שלבים: לשרותינו 4-bit FAs ושערי AND, OR א. חבר A+BT ע"י 4-bit FA. ב. מקרה א': 0T 9. סיימנו => התוצאה (S1,S0)=(0,T) . ג. מקרה ב': 10 T 18. I. 1 S1. II. עלינו להפחית 10 מ – T כדי לקבל את התוצאה הנכונה.

FA שלב א': :10T18 <= 10T Cout = 1 OR S3 = 1 AND (S2=1 OR S1=1) Cin “O” B2 B3 B0 B1 FA :10T18 Cout S3 S2 S1 S0   1 10 11 12 13 14 15 16 17 18 “over flow” <= 10T Cout = 1 OR S3 = 1 AND (S2=1 OR S1=1) Cout + S3·(S2 + S1) ספרת העשרות:

+ - שלב ב': “-10” אם T10 עלינו להפחית 10 )Cout S3 S2 S1 S0)2 (10 (10 (10 (10 ( X3 X2 X1 X)2 מספר  9 ממוש מלא ב 2’sCo: + Cout S3 S2 S1 S0 “-10” 2s’ Comp 1 X3 X2 X1 X0 מספיקים 4 ביטים לייצג את התוצאה. שני ביטי MSB בשני המספרים אינם משפיעים על התוצאה ב – (X3X2X1X0). ניתן לבצע החיסור ע"י חיבור: (S3S2S1S0) + (0110)!

ממוש מחבר BCD ע"י FAs: 4 bit FA 4 bit FA A + B = (S,C) מחבר BCD: {0,1,…,9} {0,1} S2 S3 S0 S1 A2 A3 A0 A1 Cout Cin “O” B2 B3 B0 B1 4 bit FA C(>9) T=A+B>9: Cout= 1(A+B16) S3 = 1 S2 = 1או S1 = 1 T וגם או “O” If T10 We need To Subtract 10 from the Input to the Second FA A2 A3 A0 A1 B2 B3 B0 B1 S2 S3 S0 S1 Cout Cin “O” 4 bit FA ignore א. אם 9=> התוצאה נכונה (סיכום בינארי). ב. אם >9=> המר ל - (A+b-9,1)

ממוש כפל ע"י מחברים:  0 A0B1 A0B0 + B1 B0 A1 A0 A1B1 A1B0 0 S3 S2 S1 S0 S0 = A0B0 S1 = Least Significant Bit ADD(A0B1,A1B0) S2 = 2nd bit of (0,A0B1) + (A1B1,A1B0) S3 = … S3 S2 S1 S0 A1 A0 B1 B0 A1B1 A1B0 A0B1 A0B0 HA C S add

כפל מספרים בינאריים: ? ? ? ? ? (b2 b1 b0) ? ? ? ? ? מבוסס על פירוק הנכפל השני לגורמיו: (b2 b1 b0) (1011)2 = 11 1000 8 0010 2 0001 1 דוגמא: + + + + הכפל יתבצע ע"י n חיבורים של הכפלים:

טענה: הינו: א. אם bi=0 ב. an-1an-2…a1a000…0 כאשר bi = 1. i אפסים הוכחה: א. מקרה א' הינו מיידי היות שהמספר השני הינו 0. ב. עבור מקרה ב' נוכיח באינדוקציה על i. בסיס: i=0 אנו מקבלים עם אפס ביטי אפס מובילים. i=1 אזי המספר השני הינו 2=…0010 . דהיינו אנו כופלים ב – 2. במקרה זה הדבר שקול לחיבור המספר לעצמו.

נסתכל על ביטי ה – least: כאשר: a0=0 אזי הסכום 0 והנשא 0. a0=1 אזי הסכום הינו 0 ונשא 1.  S=0, C=a0 בביט הבא כמקודם יהיה c2 = a1 אך הסכום הינו 0 + a0 ובאופן כללי נקבל כי: א. ci = ai-1 ב. si = ai-1 ובסה"כ:

+ + לכן כפל מספרים ניתן לבצע ע"י חיבור: b0an-1b0an-2…b0a0 bn-1an-1…bn-1a0…0 + + + סה"כ ידרשו 2n ביטים לתוצאה. היות ו - 22n – 2n+1 +1 = (2n – 1)(2n –1) דרושים 2n ביטים לייצוג.

 0 0 0 + + 0 0 שני המספרים אינם חייבים להיות בעלי אותו מספר סיביות. דוגמא:  0 0 0 + + 0 0 1 + 4 + 8 + 32 = 45 באופן כללי אם נכפול מספר בעל n ביטים במספר בעל m ביטים נזדקק ל - n + M ביטים לייצוג התוצאה.

דוגמא – כפל מספר 3B במספר 4B A0 B0 B3 B2 B1 A1 B2 B2 B1 B0 b3 b2 b1 b0 a3 a2 a1 a0 4 bit FA C4 C0 “O” S3 S2 S1 S0 A2 B3 B2 B1 B0 a2 a3 a0 a1 b2 b3 b0 b1 4 bit FA C4 C0 “O” S3 S2 S1 S0 O6 O5 O4 O3 O2 O1 O0