DOC PREVIEW
Berkeley COMPSCI 150 - Using FSMs

This preview shows page 1-2-3-21-22-23-43-44-45 out of 45 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 45 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

EECS 150 - Components and Design Techniques for Digital Systems Lec 06 – Using FSMs 9-13-07OutlineReview: Typical Controller: stateTypical Controller: state + outputTypical Controller: state + output + inputReview: Two Kinds of FSMsReview: Finite State Machine RepresentationsReview: Formal Design ProcessFormal Design ProcessFormal Design ProcessReview: What’s an FSM?How to quickly implement the State Transition Diagram?One Answer: Xilinx 4000 CLBTwo 4-input functions, registered output5-input function, combinational outputRecall: Parallel to Serial ConverterExample: Byte-bit streamByte-bit stream with Rate MatchingAnother example: bus protocolsExample: Pentium System OrganizationArbitration for the bus…Simple Synchronous ProtocolProcessor Side of Protocol - sketchSimple Synchronous Protocol (cont)AnnouncementsFundamental Design PrincipleForms of Sequential LogicGeneral Model of Synchronous CircuitComposing FSMs into larger designsComposing Moore FSMsComposing Mealy FSMs …Recall: What makes Digital Systems tick?Recall 61C: Single-Cycle MIPSRecall 61C: 5-cycle Datapath - pipelineFSM timingFinite State Machines in VerilogVerilog FSM - Reduce 1s exampleMoore Verilog FSM: combinational partMoore Verilog FSM: state partMealy Verilog FSM for Reduce-1s exampleRestricted FSM Implementation StyleSingle-always Moore Machine (Not Allowed!)Slide 43Finite State MachinesSummary9/13/07EECS150 F07 Culler Lec 61EECS 150 - Components and Design Techniques for Digital Systems Lec 06 – Using FSMs9-13-07 David CullerElectrical Engineering and Computer SciencesUniversity of California, Berkeleyhttp://www.eecs.berkeley.edu/~cullerhttp:/inst.eecs.berkeley.edu/~cs1509/13/07EECS150 F07 Culler Lec 62Outline•Review FSMs•Mapping to FPGAs•Typical uses of FSMs•Synchronous Seq. Circuits – safe composition•Timing•FSMs in verilog9/13/07EECS150 F07 Culler Lec 63Review: Typical Controller: state Combinational Logicstatestate(t+1) = F ( state(t) )state Next statei2 i1 i0 o2 o1 o00 0 0 0 0 10 0 1 0 1 10 1 0 1 1 00 1 1 0 1 01 0 0 0 0 01 0 1 1 0 01 1 0 1 1 11 1 1 1 0 1Example: Gray Code Sequence000001 011010110111 1011009/13/07EECS150 F07 Culler Lec 64Typical Controller: state + outputCombinational Logicstatestate(t+1) = F ( state(t) )state Next statei2 i1 i0 o2 o1 o00 0 0 0 0 10 0 1 0 1 10 1 0 1 1 00 1 1 0 1 01 0 0 0 0 01 0 1 1 0 01 1 0 1 1 11 1 1 1 0 1Output (t) = G( state(t) )01101001odd000/0001/1 011/0010/1110/0111/1 101/0100/19/13/07EECS150 F07 Culler Lec 65Typical Controller: state + output + inputCombinational Logicstatestate(t+1) = F ( state(t), input (t) )state Next statei2 i1 i0 o2 o1 o00 0 0 0 0 10 0 1 0 1 10 1 0 1 1 00 1 1 0 1 01 0 0 0 0 01 0 1 1 0 01 1 0 1 1 11 1 1 1 0 1Output (t) = G( state(t) )000000001 x x x 0 0 0clr000/0001/1 011/0010/1110/0111/1 101/0100/1Input01101001oddclr=1clr=0clr=?9/13/07EECS150 F07 Culler Lec 66Review: Two Kinds of FSMs•Moore Machine vs Mealy MachineCombinational Logicstatestate(t+1) = F ( state(t), input)Output (t) = G( state(t), Input )Inputstatestate(t+1) = F ( state(t), input(t))Output (t) = G( state(t))InputState / outInputStateInput / Out9/13/07EECS150 F07 Culler Lec 67In = 0In = 1In = 0In = 1100010110111001Review: Finite State Machine Representations•States: determined by possible values in sequential storage elements•Transitions: change of state•Clock: controls when state can change by controlling storage elements•Sequential Logic–Sequences through a series of states–Based on sequence of values on input signals–Clock period defines elements of sequence9/13/07EECS150 F07 Culler Lec 68Review: Formal Design Process•Circuit Diagram:–XOR gate for ns calculation–DFF to hold present state–no logic needed for outputLogic equations from table:OUT = PSNS = PS xor INnsps•Review of Design Steps:1. Circuit functional specification2. State Transition Diagram3. Symbolic State Transition Table4. Encoded State Transition Table5. Derive Logic Equations6. Circuit DiagramFFs for stateCL for NS and OUTTake this seriously!9/13/07EECS150 F07 Culler Lec 69Formal Design Process •“State Transition Diagram”–circuit is in one of two states.–transition on each cycle with each new input, over exactly one arc (edge).–Output depends on which state the circuit is in.ParityCheckerINOUTbit stream0 if even parity1 if odd parityexample: 0 0 1 1 1 0 1 even even odd even odd odd evenCLKtime9/13/07EECS150 F07 Culler Lec 610Formal Design Process•State Transition Table:•Invent a code to represent states:Let 0 = EVEN state, 1 = ODD statepresent nextstate OUT IN state EVEN 0 0 EVEN EVEN 0 1 ODD ODD 1 0 ODD ODD 1 1 EVENpresent state (ps) OUT IN next state (ns) 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0Derive logic equations from table (how?):OUT = PSNS = PS xor IN9/13/07EECS150 F07 Culler Lec 611Review: What’s an FSM?•Next state is function of state and input•Moore Machine: output is a function of the state•Mealy Machine: output is a function of state and inputOften PLAsState / outputinputAinputBState inputA/outputAinputB/outputBWhich is which?9/13/07EECS150 F07 Culler Lec 612How to quickly implement the State Transition Diagram?9/13/07EECS150 F07 Culler Lec 613One Answer: Xilinx 4000 CLB9/13/07EECS150 F07 Culler Lec 614Two 4-input functions, registered output9/13/07EECS150 F07 Culler Lec 6155-input function, combinational output9/13/07EECS150 F07 Culler Lec 616Recall: Parallel to Serial Converter//Parallel to Serial convertermodule ParToSer(LD, X, out, CLK); input [3:0] X;input LD, CLK;output out; reg out;reg [3:0] Q;assign out = Q[0];always @ (posedge CLK) beginif (LD) Q <= X;else Q <= {1’b0,Q[3:1]};endendmodule // ParToSerOne common use of FSMs is in adapters from one subsystem to another.• different data widths• different bit rates• different protocols, …9/13/07EECS150 F07 Culler Lec 617Example: Byte-bit streamByte FIFOpopSerial linkShift registercontrollerLDbit 0/popbit 1bit 2bit 3bit 4bit 5bit 6bit 7 / LDinit / LD9/13/07EECS150 F07 Culler Lec 618Byte-bit stream with Rate Matching•How would you implement this FSM?Byte FIFOpopSerial linkShift registercontrollerLDbit 0/popbit 1bit 2bit 3bit 4bit 5bit 6bit 7 / LDinit / LDrdybit


View Full Document

Berkeley COMPSCI 150 - Using FSMs

Documents in this Course
Lab 2

Lab 2

9 pages

Debugging

Debugging

28 pages

Lab 1

Lab 1

15 pages

Memory

Memory

13 pages

Lecture 7

Lecture 7

11 pages

SPDIF

SPDIF

18 pages

Memory

Memory

27 pages

Exam III

Exam III

15 pages

Quiz

Quiz

6 pages

Problem

Problem

3 pages

Memory

Memory

26 pages

Lab 1

Lab 1

9 pages

Memory

Memory

5 pages

Load more
Download Using FSMs
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Using FSMs and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Using FSMs 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?