1 / 16

Finite State Machine

Finite State Machine. Switching and Logic Lab Standard Laboratory Exercises. Suggestions and Warnings. Read for detail and comprehension Should be able to complete within normal laboratory period.

johana
Download Presentation

Finite State Machine

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Finite State Machine Switching and Logic Lab Standard Laboratory Exercises

  2. Suggestions and Warnings • Read for detail and comprehension • Should be able to complete within normal laboratory period. • Make sure you program unused pins as tri-state inputs or you may burnout EPM7128S device on PLDT-2.

  3. Vending Machines • Project 1 -- Basic Vending Machine • Combinational Logic • State • Moore Outputs • Sequential Devices -- D Flip-Flops • Project 2 -- Modified Vending Machine • Provides change • Add state and modify transitions

  4. State Diagram 2 State Bits

  5. Vending Entity ENTITY Vending IS PORT ( Nickel, Dime, Reset, Clk : IN BIT; Dispense : OUT BIT ); END Vending;

  6. Vending Architecture ARCHITECTURE Moore OF Vending IS TYPE State_Type is (ZeroCents,FiveCents,TenCents, FifteenCents); SIGNAL State : State_Type; BEGIN --FSM Logic --Moore Output logic goes here END Moore;

  7. Finite State Machine Logic --FSM Logic Goes Here FSM: PROCESS BEGIN IF Reset = '1' THEN State <= ZeroCents; ELSIF (CLK'event AND Clk = '1') THEN • • • • • END PROCESS FSM; Sequential Process Statement

  8. Moore Output Logic --Moore Output logic goes here Output: PROCESS(State) BEGIN CASE State IS WHEN FifteenCents => Dispense <= '1'; WHEN Others => Dispense <= '0'; END CASE; END PROCESS Output; Dispense = State_Bit_0 & State_Bit_1;1 1Technology Map Netlist Viewer

  9. State Logic CASE State IS WHEN ZeroCents => IF Dime = '1' THEN State <= TenCents; ELSIF Nickel = '1' THEN State <= FiveCents; ELSE State <= ZeroCents; END IF; WHEN FiveCents => IF Dime = '1' THEN State <= FifteenCents; ELSIF Nickel = '1' THEN State <= TenCents; ELSE State <= FiveCents; END IF;

  10. State Logic (Continued) WHEN TenCents => IF Dime = '1' THEN State <= FifteenCents; ELSIF Nickel = '1' THEN State <= FifteenCents; ELSE State <= TenCents; END IF; WHEN FifteenCents => IF Reset = '1' THEN State <= ZeroCents; ELSE State <= FifteenCents; END IF; END CASE;

  11. State Equations1 State_Bit_1.T = Dime & !State_Bit_1 + !State_Bit_1 & State_Bit_0 &Nickel State_Bit_1.Clk = Clk State_Bit_1.Rst = Reset State_Bit_0.D = !(Dime & !State_Bit_0 & State_Bit_1 + Nickel & Dime & !State_Bit_0 & State_Bit_1 + !Nickel & !Dime & ! State_Bit_0 State_Bit_0.Clk = Clk State_Bit_0.Rst = Reset 1Technology Map Netlist Viewer

  12. Simulation & Verification Scenarios • Nickel, Nickel, Nickel  Dispense • Nickel, Dime  Dispense • Dime, Dime  Dispense • Nickel, Nickel, Dime  Dispense • Do not violate setup and hold time in simulation

  13. 8 Steps to Success • Create Project (tri-state as input all unused pins) • Capture Logic • Analysis and Synthesis • Pin Assignments • Full Compile • Timing Simulation • Programming • Exercise circuit

  14. Revised Vending Machine • Gives nickel change from 20¢ • Does not require reset after 15¢ and 20 ¢ states. 20¢ Change, Dis 0¢ 5¢ 10¢ 15¢ Dis Reset

  15. 8 Steps to Success • Create Project (tri-state as input all unused pins) • Capture Logic • Analysis and Synthesis • Pin Assignments • Full Compile • Timing Simulation • Programming • Exercise circuit

  16. Unused Pins as Tri-State Inputs • Select “Assignments” • Select “Device” • Select “Device & Pin Options” • Select “Unused Pins” Tab • Select “As inputs, tri-stated” • OK

More Related