Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 זכרון 1 2 Q’ Q 0 1 1 0. 2 זכרון 1 2 0 0 Q’ Q 0 1 1 0 1 = = 1 קלט פלט קלט פלט 0.

Similar presentations


Presentation on theme: "1 זכרון 1 2 Q’ Q 0 1 1 0. 2 זכרון 1 2 0 0 Q’ Q 0 1 1 0 1 = = 1 קלט פלט קלט פלט 0."— Presentation transcript:

1 1 זכרון 1 2 Q’ Q 0 1 1 0

2 2 זכרון 1 2 0 0 Q’ Q 0 1 1 0 1 = = 1 קלט פלט קלט פלט 0

3 3 SR Latch with NAND SRQ’Q 0110 1110 1001 1101 0011 Set State Reset State Undefined Set Command Reset Command 1 0 1 0 R S Q’ Q 1 0 1 0

4 4 D (data) Latch D Q’ Q CP Q = 1 (Set) Q = 0 (Reset) No change Next State of Q 11 10 0  CD Latch D הינו יחידה שאוגרת / " זוכרת " ביט יחיד. נמנעים ממצב לא מוגדר. אבן בניין בסיסית של אוגרים (Registers). D'D' 11 0 1 1 0 01 1 0

5 5 Flip - Flops הזמן שלוקח עד שהמוצא של Latch מתייצב יכול ליצור בעיות כאשר מחברים שתי יחידות זיכרון. המוצא אינו צריך להיות תלוי בתזמון וצריך להימנע " ממצבים מתהפכים " (JK). פתרון צריך לדאוג שהמוצא יהיה יציב לפרק זמן מובטח. Flip-Flop פתרון מבוסס על Latch: שימוש בשני Latch בצורה שתבטיח שהפלט יהיה מבודד מהכניסות המשתנות : Master-Slave Flip-Flop

6 6 Master – Slave Flip - Flop כאשר (master) M פעיל S (slave) אינו פעיל והינו זוכר את היציאות של M מהשלב ש – M היה סביל. C S Y Q אין השפעה ! S R C Q Q’ ג ב ר תג ב ר ת S R C Q ע ב דע ב ד SM S R C Q Y Y’

7 7 Master – Slave Flip - Flop כאשר M פעיל S אינו פעיל והינו זוכר את היציאות של M מהשלב ש – M היה סביל. C S Y Q אין השפעה ! 1 0 10100101 נשאר 1 נעשה פעיל 0101 S R C Q Q’ ג ב ר תג ב ר ת S R C Q ע ב דע ב ד SM S R C Q Y Y’

8 8 D Flip Flop כן מספיק !! Combinatorial Circuit מעגל צירופי Input כניסות S R C Q Q’Q’ ג בר תג בר ת S R C Q Q’Q’ ע בדע בד SM S R C Q Q’ Y Y’

9 9 FSM – III: 00 01 10 1 האוטומט פולט 1 אחרי ש " ראה " לפחות 3 1 - ים מאז ה - 0 האחרון. פלט מצוייר על הקשתות Mealy FSM 0/00/0 0/00/0 0/00/0 1/01/0 1/01/0 1/01/0 0/00/0 1/11/1 קלט ( כמקודם ) פלט

10 10 FSM – III: האוטומט פולט 1 אחרי ש " ראה " לפחות 3 1 - ים מאז ה - 0 האחרון. פלט מצוייר במצבים Moore FSM 00/0 01/0 11/0 10/1 0 0 0 1 1 1 0 1 =I קלט ( כמקודם ) =O פלט

11 11 טבלת המצבים – Moore III AtAt BtBt I=0I=1 A t+1 B t+1 A t+1 B t+1 OtOt 0000010 0100110 1100100 1000101 הפלט תלוי ב – A & B 00/0 01/0 11/0 10/1 0 0 0 1 1 1 0 1

12 12 טבלת המצבים - Mealy III AtAt BtBt X=0X=1 X=0X=1 A t+1 B t+1 A t+1 B t+1 OtOt OtOt 00000100 01001000 10001100 11001101 הפלט תלוי ב - X

13 13 טבלת המצבים – Moore III AtAt BtBt I=0I=1 A t+1 B t+1 A t+1 B t+1 OtOt 0000010 0100110 1100100 1000101 0 00/0 01/0 11/0 10/1 0 0 1 1 1 0 1 10110100A t+1 0 1 AB I 10110100B t+1 0 1 AB

14 14 דוגמא - Moore III כניסה אחת ויציאה אחת 2FF מסוג Data  4 מצבים. A B D DQ Q’ Q A t+1 = A*I + B * I= I(A+B) I B t+1 = A*I O = A*B O

15 15 דוגמא – Mealy III כניסה אחת ויציאה אחת היציאה תלויה ב - Q A, Q B ו - X. 2FF מסוג Data  4 מצבים. A B X Out D DQ Q’ Q

16 16 Moore Vs. Mealy פלט : Moore – פונקציה של המצב לבד Mealy – פונקציה של המצב והקלט אוטומט : Moore – הפלט " רשום " על המצב Mealy – הפלט " רשום " על הקשת ( מעבר ) שיקולים : Moore – לא תלוי ב " יציבות " הקלט ( מספיק שיהיה קבוע T s + T h ) אך ידרשו FFs נוספים אם דרושה תלות היציאה בקלט. Mealy – פשוט לממוש אם יש תלות של היציאה בקלט אך נדרשת יציבות. Moore שקול ל – Mealy ( ולהפך )

17 17 נוהל עיצוב 1. הגדר במילים את פעולת המעגל. 2. בנה את טבלת המצבים ( אוטומט ) 3. צמצם / מצא ייצוג קטן של אוטומט המצבים. 4. קבע משתנים אשר ייצגו את המצבים ( בצורה וקטורית ). קבע את מספר הדלגלגים והתאם אות לכל דלגלג. 5. בחר בסוג הדלגלג להשתמש בו. 6. קבל טבלאות העירור והיציאות של המעגל מטבלת המצבים. 7. חשב את פונקציות היציאה של המעגל ואת פונקציות הכניסה של FF ( בעזרת מפות קרנו או כל שיטה אחרת ) 8. צייר הדיאגרמה הלוגית. *

18 18 דוגמת תכנון מזרחמרכזמערב " שמאלה " " ימינה " " שמאלה " " ימינה "" שמאלה " " תקין " " תקוע " I Robot

19 19 אוטומט המצבים – תיאור סמלי : מרכז מערבמזרח תקין / שמאל תקין / ימין תקין / שמאל תקין / ימין תקוע / ימין תקוע / שמאל

20 20 אוטומט המצבים : " ימין ": 0 " שמאל ": 1 תקין : 0 תקוע : 1 00 0110 מזרח מערב מרכ ז 1/0 0/0 1/0 0/0 0/1 1/1 BA קלט פלט 3 מצבים  נזדקק ל – 2FF  2FF יכולים " לזכור " 4 מצבים.  מצב שלא משתמשים בו (" 11") המצב הנוכחי קלט X המצב הבא פל ט Y A BAB 000100 001010 010000 011011 100101 101000

21 21 המצב הנוכחי קל ט X המצב הבא פלט Y A BAB 000100 001010 010000 011011 100101 101000 טבלת המצבים + מעברים :

22 22 פונקציות יציאה + מצב הבא : מימוש עבור D-FF 1 1  BtBt XtXt AtAt 11  BtBt XtXt AtAt 1 1  BtBt XtXt AtAt A(t+1) = B’X’ = (B+X)’ B(t+1) = A’X Y(t) = AX’ + BX

23 23 דיאגרמה לוגית : A B Q Q’ D C Q D C X B’X’ A’X y BX AX’ מימוש עבור DFF ( שעון מושמט )

24 How many state bits will we need? Graphical Specification of FSM

25 25 Finite State Machine for Control 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 0 0 1 1 0 1 1 1 0 1 1 1

26 26 The control signals decoder We just implement the table of slide 54: Let’s look at ALUSrcA: it is “0” in states 0 and 1 and it is “1” in states 2, 6 and 8. In all other states we don’t care. let’s look at PCWrite: it is “1” in states 0 and 9. In all other states it must be “0”. And so, we’ll fill the table below and build the decoder.

27 27 The state machine “next state calc.” logic R-type=000000, lw=100011, sw=101011, beq=000100, bne=000101, lui=001111, j=0000010, jal=000011, addi=001000 Fetch 0 Jump 9 WBR 7 Load 3 Branch 8 ALU 6 AdrCmp 2 Store 5 Decode 1 WB 4 lw+sw R-type beq j swlw IR31IR30IR29IR28IR27IR26 opcode S3S2S1S0 current state S3S2S1S0 next state X0XXXXX0000001 00010110000000 X X1 0X XXX XXX X 0010 0010 0011 0101 10XXXXX0010010 R-type lw sw lw+sw

28 28 Interrupt and exception Type of event From Where ? MIPS terminology Interrupt External I/O device request ------------------------------------------------------------------------------------ Invoke Operation system Internal Exception From user program ------------------------------------------------------------------------------------- Arithmetic Overflow Internal Exception ------------------------------------------------------------------------------------- Using an undefined Instruction Internal Exception -------------------------------------------------------------------------------------- Hardware malfunctions Either Exception or interrupt

29 29 Exceptions handling Exception typeException vector address (in hex) Undefined instruction c0 00 00 00 Arithmetic Overflow c0 00 00 20 We have 2 ways to handle exceptions: Cause register or Vectored interrupts MIPS – Cause register

30 30 Handling exceptions

31 31 Handling exceptions

32 32 Fetch Jump WBR Load Branch ALU AdrCmp Store Decode WB 1 5 28 6 9 0 74 3 lw+sw R-type be q j swsw lw SavePC 10 IRET 1 JumpInt 11 Handling interrupts:

33 33 PLA Implementation If I picked a horizontal or vertical line could you explain it?

34 34 ROM = "Read Only Memory" –values of memory locations are fixed ahead of time A ROM can be used to implement a truth table –if the address is m-bits, we can address 2 m entries in the ROM. –our outputs are the bits of data that the address points to. m is the "heigth", and n is the "width" ROM Implementation mn 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 0 0 1 1 0 1 1 1 0 1 1 1

35 35 How many inputs are there? 6 bits for opcode, 4 bits for state = 10 address lines (i.e., 2 10 = 1024 different addresses) How many outputs are there? 16 datapath-control outputs, 4 state bits = 20 outputs ROM is 2 10 x 20 = 20K bits (and a rather unusual size) Rather wasteful, since for lots of the entries, the outputs are the same — i.e., opcode is often ignored ROM Implementation

36 36 Break up the table into two parts — 4 state bits tell you the 16 outputs, 2 4 x 16 bits of ROM — 10 bits tell you the 4 next state bits, 2 10 x 4 bits of ROM — Total: 4.3K bits of ROM PLA is much smaller — can share product terms — only need entries that produce an active output — can take into account don't cares Size is (#inputs  #product-terms) + (#outputs  #product-terms) For this example = (10x17)+(20x17) = 460 PLA cells PLA cells usually about the size of a ROM cell (slightly bigger) ROM vs PLA

37 37 Microprogramming What are the “microinstructions” ?

38 38 A specification methodology –appropriate if hundreds of opcodes, modes, cycles, etc. –signals specified symbolically using microinstructions Will two implementations of the same architecture have the same microcode? What would a microassembler do? Microprogramming

39 39 Details

40 Microinstruction format

41 41 No encoding: –1 bit for each datapath operation –faster, requires more memory (logic) –used for Vax 780 — an astonishing 400K of memory! Lots of encoding: –send the microinstructions through logic to get control signals –uses less memory, slower Historical context of CISC: –Too much logic to put on a single chip with everything else –Use a ROM (or even RAM) to hold the microcode –It’s easy to add new instructions Maximally vs. Minimally Encoded

42 42 Microcode: Trade-offs Distinction between specification and implementation is sometimes blurred Specification Advantages: –Easy to design and write –Design architecture and microcode in parallel Implementation (off-chip ROM) Advantages –Easy to change since values are in memory –Can emulate other architectures –Can make use of internal registers Implementation Disadvantages, SLOWER now that: –Control is implemented on same chip as processor –ROM is no longer faster than RAM –No need to go back and make changes

43 43 “Macro and micro - instruction” Interpretation Main Memory execution unit control memory CPU ADD SUB AND DATA...... User program plus Data this can change! AND microsequence e.g., Fetch Calc Operand Addr Fetch Operand(s) Calculate Save Answer(s) one of these is mapped into one of these

44 44 The Big Picture


Download ppt "1 זכרון 1 2 Q’ Q 0 1 1 0. 2 זכרון 1 2 0 0 Q’ Q 0 1 1 0 1 = = 1 קלט פלט קלט פלט 0."

Similar presentations


Ads by Google