Finite State Machines מבוסס על הרצאות של יורם זינגר, האוניברסיטה העברית י"ם יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.

Slides:



Advertisements
Similar presentations
Another Implementation Style
Advertisements

1  1998 Morgan Kaufmann Publishers Summary:. 2  1998 Morgan Kaufmann Publishers How many cycles will it take to execute this code? lw $t2, 0($t3) lw.
1 זכרון 1 2 Q’ Q זכרון Q’ Q = = 1 קלט פלט קלט פלט 0.
מבוסס על הרצאות של יורם זינגר, האוניברסיטה העברית י"ם
1 Chapter Five The Processor: Datapath and Control.
1 Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. The single cycle CPU.
Processor Design 5Z032 Processor: Datapath and Control Chapter 5 Henk Corporaal Eindhoven University of Technology 2009.
The Processor Data Path & Control Chapter 5 Part 3 - Microprogrammed Control Unit N. Guydosh 3/1/04+
Microprogramming Andreas Klappenecker CPSC321 Computer Architecture.
1 5.5 A Multicycle Implementation A single memory unit is used for both instructions and data. There is a single ALU, rather than an ALU and two adders.
CS 161Computer Architecture Chapter 5 Lecture 12
1 Chapter Five. 2 We're ready to look at an implementation of the MIPS Simplified to contain only: –memory-reference instructions: lw, sw –arithmetic-logical.
Pipeline Exceptions & ControlCSCE430/830 Pipeline: Exceptions & Control CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
1  1998 Morgan Kaufmann Publishers & Ing-Jer Huang Chapter Five last upate: 6/24/2015.
EECE476 Lectures 10: Multi-cycle CPU Control Chapter 5: Section 5.5 The University of British ColumbiaEECE 476© 2005 Guy Lemieux.
Preparation for Midterm Binary Data Storage (integer, char, float pt) and Operations, Logic, Flip Flops, Switch Debouncing, Timing, Synchronous / Asynchronous.
Computer Structure - Datapath and Control Goal: Design a Datapath  We will design the datapath of a processor that includes a subset of the MIPS instruction.
Advanced Computer Architecture 5MD00 / 5Z033 MIPS Design data path and control Henk Corporaal TUEindhoven 2007.
Lecture 16: Basic CPU Design
1  1998 Morgan Kaufmann Publishers We're ready to look at an implementation of the MIPS Simplified to contain only: –memory-reference instructions: lw,
Class 9.1 Computer Architecture - HUJI Computer Architecture Class 9 Microprogramming.
1 We're ready to look at an implementation of the MIPS Simplified to contain only: –memory-reference instructions: lw, sw –arithmetic-logical instructions:
S. Barua – CPSC 440 CHAPTER 5 THE PROCESSOR: DATAPATH AND CONTROL Goals – Understand how the various.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Computing Systems The Processor: Datapath and Control.
George Mason University Finite State Machines Based on lectures from George Mason and CMU יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
ECE/CS 552: Microprogramming and Exceptions Instructor: Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Multi-Cycle Processor.
1 For some program running on machine X, Performance X = 1 / Execution time X "X is n times faster than Y" Performance X / Performance Y = n Problem:
Chapter 5 Processor Design. Spring 2005 ELEC 5200/6200 From Patterson/Hennessey Slides We're ready to look at an implementation of the MIPS Simplified.
EECS 322: Computer Architecture
1 Computer Organization & Design Microcode for Control Sec. 5.7 (CDROM) Appendix C (CDROM) / / pdf / lec_3a_notes.pdf.
CPE232 Basic MIPS Architecture1 Computer Organization Multi-cycle Approach Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides
Exam 2 Review Two’s Complement Arithmetic Ripple carry ALU logic and performance Look-ahead techniques Basic multiplication and division ( non- restoring)
Gary MarsdenSlide 1University of Cape Town Stages.
מבוסס על הרצאות של יורם זינגר, האוניברסיטה העברית י"ם
Overview of Control Hardware Development
1  1998 Morgan Kaufmann Publishers Value of control signals is dependent upon: –what instruction is being executed –which step is being performed Use.
Multicycle Implementation
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 16 - Multi-Cycle.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
MIPS Processor.
1  2004 Morgan Kaufmann Publishers No encoding: –1 bit for each datapath operation –faster, requires more memory (logic) –used for Vax 780 — an astonishing.
CDA 3101 Spring 2016 Introduction to Computer Organization Microprogramming and Exceptions 08 March 2016.
1. 2 MIPS Hardware Implementation Full die photograph of the MIPS R2000 RISC Microprocessor. The 1986 MIPS R2000 with five pipeline stages and 450,000.
Design a MIPS Processor (II)
CS161 – Design and Architecture of Computer Systems
CS161 – Design and Architecture of Computer Systems
Chapter 5 The Processor: Datapath and Control
Systems Architecture I
Computer Organization & Design Microcode for Control Sec. 5
Extensions to the Multicycle CPU
CS/COE0447 Computer Organization & Assembly Language
Multiple Cycle Implementation of MIPS-Lite CPU
Chapter Five.
CSCE 212 Chapter 5 The Processor: Datapath and Control
Processor: Finite State Machine & Microprogramming
Computer Architecture
Chapter Five The Processor: Datapath and Control
ECE/CS 552: Microprogramming and Exceptions
The Multicycle Implementation
Chapter Five The Processor: Datapath and Control
The Processor Data Path & Control Chapter 5 Part 3 - Microprogrammed Control Unit N. Guydosh 3/1/04+
The Multicycle Implementation
The Processor Lecture 3.1: Introduction & Logic Design Conventions
Processor (II).
Multi-Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
Chapter Four The Processor: Datapath and Control
Presentation transcript:

Finite State Machines מבוסס על הרצאות של יורם זינגר, האוניברסיטה העברית י"ם יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב

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

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

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

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

טבלת המצבים – Moore AtAt BtBt I=0I=1 A t+1 B t+1 A t+1 B t+1 OtOt /0 01/0 11/0 10/ A t AB I B t AB

דוגמא - Moore כניסה אחת ויציאה אחת 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

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

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

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

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

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

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

המצב הנוכחי קלט X המצב הבא פלט Y A BAB טבלת המצבים + מעברים :

פונקציות יציאה + מצב הבא : מימוש עבור 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

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

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

Finite State Machine for Control

Execution Cycle Instruction Fetch Instruction Decode Operand Fetch Execute Result Store Next Instruction Obtain instruction from program storage Determine required actions and instruction size Locate and obtain operand data Compute result value or status Deposit results in storage for later use Determine successor instruction

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.

The state machine “next state calc.” logic R-type=000000, lw=100011, sw=101011, beq=000100, bne=000101, lui=001111, j= , jal=000011, addi= 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 X0XXXXX X X1 0X XXX XXX X XXXXX R-type lw sw lw+sw

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

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

Handling exceptions

Fetch Jump WBR Load Branch ALU AdrCmp Store Decode WB lw+sw R-type be q j swsw lw SavePC 10 IRET 1 JumpInt 11 Handling interrupts:

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

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

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

Where are We Going?? מבנה מחשבים  Arithmetic Single/multicycle Datapaths IFetchDcdExecMemWB IFetchDcdExecMemWB IFetchDcdExecMemWB IFetchDcdExecMemWB PipeliningMemory Systems I/O

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

Microprogramming What are the “microinstructions” ?

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

Details

Microinstruction format

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

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

“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

The Big Picture