Wildfire FPGA - State Machine

theory

concept

The state machine is referred to as FSM, also known as synchronous finite state machine, with limited states, suitable for describing sequential events, such as counters

  • Moore type: the final output is related to the current state and has nothing to do with the input
  • Mealy type: the final output is related to the current state and input
  • Common ground: state jumps are only related to input

state machine representation

State transition diagrams to aid in coding

combat

Implement a simple coke machine system

A bottle of Coke is 3 yuan, when you put in three hard pens, you get a bottle of Coke

  1. Build a file system
    insert image description here
  2. Draw the system block diagram and state transition diagram.
    insert image description here
    insert image description here
    Each rounded rectangle represents a state. The left side of the slash is the input, and the right side is the output.
    The state transition diagram is three elements: input, output, state
  • Input: Put in a one-yuan coin
  • Output: Out Coke / Out Coke
  • Status: input 0 yuan/1 yuan/2 yuan/3 yuan
  1. State analysis
    Analyze the output and next state in each state and under various input conditions
    Three states: Moore type
    insert image description here
    Four states: Mealy type
    insert image description here
    Both state transition diagrams are correct, but it is generally used to simplify the state to the simplest

Guess you like

Origin blog.csdn.net/sllksllk/article/details/124850228