This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.
Home > Wiki encyclopedia > ASM


The Algorithm State Machine (ASM) diagram is an algorithm flow chart describing the control process of a time-series digital system. Its structure is similar to the program flow chart in a computer. The ASM diagram uses some specific symbols to describe the functions of the digital system according to the specified connection mode. Using the ASM diagram to design a digital system can easily turn the design problem described by the language into a description of the timing flow chart. Once the timing flow chart describing the logic design problem is formed, the state function and output function are easily obtained, so that the corresponding Hardware circuit. The ASM diagram describes the behavior of the state machine, not the content stored by the storage component.



ASM diagram is a kind of flow chart used to describe the algorithm of digital system. In terms of structure and form, it is similar to the traditional computer flow chart. The ASM diagram describes the state changes of the system at the register transfer level (RTL), focusing on describing the transmission and processing of information in the register, including functions such as reset, preset, count, and shift. For a digital system, the designer should first draw its ASM diagram in RTL, just as programmers need to draw the algorithm flow chart when writing software.

Both the control and data processing of the digital system can be represented in the ASM diagram. When drawing ASM diagrams, designers only need to consider the transmission and processing of RTL signals, and can ignore the specific underlying hardware. The state setting can be "more than less", and excess state can be eliminated with the help of EDA software. In addition, the signals are all regarded as register signals, and there is no need to subdivide whether the signals are combined signals or timing signals.

The ASM chart is very similar to the usual software flow chart. However, the ASM diagram represents the precise time interval sequence I of events, while the general software flowchart only lists the event sequence, and there is no concept of time. This is the fundamental difference between the two.

Basic elements of ASM diagram

The basic elements that make up an ASM diagram are the status box, judgment box, conditional output box, and input and output paths. The input and output paths are directional arrows connecting various boxes; the status box represents a state of ASM, the judgment box represents the state branch, and the conditional output box represents the conditional output of the ASM diagram. It is always located on the path that meets the state branch condition .

Status box

The state in the digital system control sequence is represented by a rectangular box, called the state box.

The register transfer operation and output realized in this state are marked in the box. The name of the state is placed in the upper left corner of the state box. The binary code assigned to the state is located in the upper right corner of the state box. Figure 2 shows an example of the state box. The name of the status box is S1, its code is 010, the operation of the register specified in the box is BA, and the output signal is Z. The arrow in Figure 2 indicates the flow of the system state. Under the trigger of the clock pulse triggering edge, the system enters the state S1, and under the trigger of the next clock pulse triggering edge, the system leaves the state S1, so a status box occupies one clock pulse period. It can be seen from this that the ASM diagram contains the sequence characteristics of events.

The control commands of the controller are determined by the control algorithm. To represent these output commands, put them in the corresponding state box. The actions in the state box should be completed at or before the end of the corresponding state clock. During this state, other output signals can be defined as needed.

Judgment box

When the control algorithm has a branch, the secondary state is not only determined by the current state, but also related to the external input in the current state. Therefore, a method of representing the branch is required. The symbol representing the branch is represented by a diamond or rectangle with a diamond border. The judgment box indicates the influence of state variables on the controller's work, as shown in Figure 1. It has one entrance and multiple exits, fill in the judgment conditions in the box, if the condition is true, choose one exit, if the condition is false, choose another exit. The judgment box does not take up time.

Conditional output box

Some states of the controller can only be output under certain conditions. For the general state

The output is different, and the conditional output is represented by an ellipse box. The conditional output box is shown in Figure 3(a). The entry of the conditional box must be connected to the output of the judgment box. The operation or output of the register listed in the condition box occurs under the given condition and meets the judgment condition. In the example of FIG. 3(b), when the system is in state S1, if the condition X=1, the register R is cleared, otherwise R remains unchanged; the next state of the system is S2 regardless of the value of X.

ASM diagram example

The following describes the construction method of ASM diagram through an example. Suppose that the technical indicators of the intersection traffic light controller are: red light shows 45s, yellow light shows 5s, green light shows 40s. The display numbers of channels A and B are respectively represented by register signals LEDA and LEDB, and the indicators of channels A and B are represented by register signals Light, which includes RA (A red), YA (A yellow) and GA (A green) And RB (B red), YB (B yellow) and GB (B green). A block diagram of this control system using ASM diagram is shown in Figure 4.

The ASM diagram has a total of 8 status boxes S0 to S7, which are encoded according to the natural binary encoding method. Of course, 1-bit hot bit encoding (One-hot) can also be used. The S0, S2, S4, and S6 status boxes complete the initial value preset, and the remaining status boxes all perform the function of counting down by 1, which is set according to the traffic light time display requirements. The preset value of the light of the indicator register signal Light is a decimal number, which can be found after conversion into a binary number. The preset number 33 of S0 corresponds to the red light of road A and the green light of B. The preset value of S2 corresponds to the red light of road A. B road yellow light; S4 preset 12 corresponds to A road green light and B road red light; S6 preset 20 corresponds to road A yellow light and B road red light

Other Wikis


  • XC3S700AN-4FG484I


    FPGA Spartan-3AN Family 700K Gates 13248 Cells 667MHz 90nm Technology 1.2V Automotive Medical 484-Pin FBGA

  • XCS20XL-3TQ144I


    Spartan and Spartan-XL Families Field Programmable Gate Arrays

  • XC3SD1800A-5CSG484C


    FPGA Spartan-3A DSP Family 1.8M Gates 37440 Cells 770MHz 90nm Technology 1.2V 484-Pin LCSBGA

  • XC3SD3400A-4CS484C


    FPGA Spartan-3A DSP Family 3.4M Gates 53712 Cells 667MHz 90nm Technology 1.2V 484-Pin LCSBGA

  • XC5VFX100T-1FF1136C


    FPGA Virtex-5 FXT Family 65nm Technology 1V 1136-Pin FCBGA

FPGA Tutorial Lattice FPGA
Need Help?


If you have any questions about the product and related issues, Please contact us.