1 / 23

Lecture 20

Lecture 20. Logistics Graded HW back today HW7 Due next Wednesday Lab 9 starts next week (2 week lab) Last lecture Intro to Moore and Mealy machines Today More Moore and Mealy machines A bigger FSM example: Hungry Robot Ant in Maze. The “WHY” slide. Bigger FSM example

MikeCarlo
Télécharger la présentation

Lecture 20

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. Lecture 20 • Logistics • Graded HW back today • HW7 Due next Wednesday • Lab 9 starts next week (2 week lab) • Last lecture • Intro to Moore and Mealy machines • Today • More Moore and Mealy machines • A bigger FSM example: Hungry Robot Ant in Maze

  2. The “WHY” slide Bigger FSM example Many things in the world are finite state machines (are we humans?) and most of them are far bigger and more complex than the examples we had so far. It is good to be able to understand and solve for a project-level FSM problem that’s a lot more realistic to FSMs that you may design in industry or in grad school.

  3. Example: A vending machine • 15 cents for a cup of coffee • Doesn’t take pennies or quarters • Doesn’t provide any change Previously we had mix of Moore and Mealy Reset N VendingMachineFSM Open CoinSensor ReleaseMechanism D Clock

  4. present inputs next presentstate D N state output 0¢ 0 0 0¢ 0 0 1 5¢ 0 1 0 10¢ 0 1 1 – – 5¢ 0 0 5¢ 0 0 1 10¢ 0 1 0 15¢ 0 1 1 – –10¢ 0 0 10¢ 0 0 1 15¢ 0 1 0 15¢ 0 1 1 – –15¢ – – 15¢ 1 Reset 0¢ N 5¢ D N 10¢ D N + D 15¢ [open] symbolic state table A vending machine: Moore machine

  5. present inputs next presentstate D N state output 0¢ 0 0 0¢ 0 0 1 5¢ 0 1 0 10¢ 0 1 1 – – 5¢ 0 0 5¢ 0 0 1 10¢ 0 1 0 15¢ 1 1 1 – –10¢ 0 0 10¢ 0 0 1 15¢ 1 1 0 15¢ 1 1 1 – –15¢ – – 15¢ 1 Reset 0¢ N/0 5¢ D/0 N/0 10¢ D/1 N + D/1 15¢ symbolic state table A vending machine: Mealy machine

  6. present state inputs next state present Q1 Q0 D N D1 D0 output 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 – – – 0 1 0 0 0 1 0 0 1 1 0 0 1 0 1 1 0 1 1 – – – 1 0 0 0 1 0 0 0 1 1 1 0 1 0 1 1 0 1 1 – – – 1 1 – – 1 1 1 present state inputs next state present Q1 Q0 D N D1 D0 output 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 – – – 0 1 0 0 0 1 0 0 1 1 0 0 1 0 1 1 1 1 1 – – – 1 0 0 0 1 0 0 0 1 1 1 1 1 0 1 1 1 1 1 – – – 1 1 – – 1 1 1 A vending machine: State encoding Mealy Moore

  7. Q1 Q1 Q1 Q1 Q1 Q1 D1 Open D0 D0 D1 Open 0 0 1 1 0 1 1 1 X X X X 1 1 1 1 0 0 1 1 0 1 1 1 X X X X 1 1 1 1 0 1 1 0 1 0 1 1 X X X X 0 1 1 1 0 1 1 0 1 0 1 1 X X X X 0 1 1 1 0 0 1 0 0 0 1 1 X X 1 X 0 1 1 1 0 0 1 0 0 0 1 0 X X 1 X 0 0 1 0 N N N N N N D D D D D D Q0 Q0 Q0 Q0 Q0 Q0 A vending machine: Logic minimization Moore Mealy

  8. A vending machine: Implementation Mealy Moore

  9. Robotic ant in a maze Robot ant, physical maze Maze has no islands Corridors are wider than ant Design the robotic ant’s brain to get to the food! Food! start

  10. Robot ant specifics Sensors: L and R antennae, 1 if touching wall Actuators: F - forward step, TL/TR - turn left/right Goal: find way out of maze to get to food. Strategy: keep the wall on the right

  11. Example: ant brain (special case 1) Left (L) Antenna touching the wall

  12. Example: ant brain (special case 2) Ant Lost

  13. Example: ant brain (special case 2) Ant Lost (another example)

  14. Robot Ant behavior B: Following wall, not touching Go forward, turning right slightly A: Following wall, touching Go forward, turning left slightly D: Hit wall again Back to state A C: Break in wall Go forward, turning right slightly E: Wall in front Turn left until... F: ...we are here, same as state B G: Turn left until... LOST: Forward until we touch something

  15. Notes & strategy Notes Maze has no islands Corridors are wider than ant Don’t worry about startup Assume a Moore machine Assume D flip-flops Strategy Keep the wall on the right

  16. Design the ant-brain FSM State diagram State-transition table 3. State minimization 4. State encoding 5. Next-state logic minimization 6. Implement the design

  17. Notations Sensors on L and R antennae Sensor = “1” if touching wall; “0” if not touching wall L'R'  no wall L'R  wall on right LR' wall on left LR  wall in front Movement F  forward one step TL  turn left slightly TR  turn right slightly

  18. L + R L’ R LOST (F) E/G(TL) A/D (TL, F) L L L’ R L’ R’ L’ R’ R L’ R’ B/F (TR, F) C(TR, F) L’ R’ L’ R’ 1. State Diagram R L L

  19. State Minimization, Encoding, and Circuit • Next class

  20. Extra credit (worth 10pts equivalent in a midterm) Design the robotic ant’s brain with virtual maze representation Due last day in class, Friday, March 13; printouts only Graded on clarity and completeness of explanation No questions will be answered, no late submission accepted Food! 127,127 0,127 start 0,0 127,0

  21. The maze Virtual maze 128 × 128 grid Stored in memory 16384 8-bit words YX is maze addresses X is the ant’s horizontal position (7 bits) Y is the ant’s vertical position (7 bits) Each memory location says 00000001  No wall 00000010  North wall 00000100  West wall 00001000  South wall 00010000  East wall 00100000  Exit Can have multiple walls Example: 00001100  Walls on South and East

  22. Design of different components Forward X counter East West Preload SRAM Address Forward Y counter North South Preload Predesigned: Submit the designs for: Ant-Brain FSM Forward SRAM Maze Data Turn right Turn left Antennae logic L R North Heading (shift register) South East West

  23. Recommendations Memory controller Move horizontally: Increment or decrement X Move vertically: Increment or decrement Y Shift register for heading N: 0001 W: 0010 S: 0100 E: 1000 Rotate right when ant turns right Rotate left when ant turns left Combinational logic for antennae logic

More Related