状态图绘制软件的使用---Gvedit
1.编写状态图文本
digraph finite_state_machine { rankdir=LR; size="40,15" node [shape = doublecircle]; INIT_STATE FAIL_STATE; node [shape = circle]; INIT_STATE -> ASSERT_RESETS_STATE [label = "init_period_done=1"]; INIT_STATE -> INIT_STATE [label = "init_period_done=0"]; DRP_REQ_FULL_STATE -> DRP_WAIT_STATE; DRP_REQ_NO_PLL_STATE -> DRP_WAIT_STATE; DRP_WAIT_STATE -> DRP_CHECK_STATE; DRP_CHECK_STATE -> ASSERT_RESETS_STATE [label = "drp_busy_in=0"]; DRP_CHECK_STATE -> RETRY2_STATE [label = "drp_busy_in=1&reset_timeout=1"]; DRP_CHECK_STATE -> DRP_CHECK_STATE [label = "drp_busy_in=1&reset_timeout=0"]; ASSERT_RESETS_STATE -> ASSERT_RESETS_STATE [label = "(~refclk_stable_s | full_reset | gtrxreset_in)=1"]; ASSERT_RESETS_STATE -> RELEASE_PLLRESET_STATE [label = "(~refclk_stable_s | full_reset | gtrxreset_in=0)"]; RELEASE_PLLRESET_STATE -> PLL_LOCKED_STATE [label = "pll_lock_s"]; RELEASE_PLLRESET_STATE -> RETRY_STATE [label = "pll_lock_s=0&plllock_timeout=1"]; RELEASE_PLLRESET_STATE -> RELEASE_PLLRESET_STATE [label = "pll_lock_s=0&plllock_timeout=0"]; PLL_LOCKED_STATE -> WAIT_RESET_DONEX_STATE; WAIT_RESET_DONEX_STATE -> WAIT_RESET_DONE_STATE [label = "rxresetdone_s=0"]; WAIT_RESET_DONEX_STATE -> RETRY_STATE [label = "rxresetdone=1&reset_timeout=1"]; WAIT_RESET_DONEX_STATE -> WAIT_RESET_DONEX_STATE [label = "rxresetdone_s=1&reset_timeout=0"]; WAIT_RESET_DONE_STATE -> DONE_STATE [label = "rxresetdone_s=1"]; WAIT_RESET_DONE_STATE -> RETRY_STATE [label = "rxresetdone_s=0&reset_timeout=1"]; WAIT_RESET_DONE_STATE -> WAIT_RESET_DONE_STATE [label = "rxresetdone_s=0&reset_timeout=0"]; DONE_STATE -> DRP_REQ_FULL_STATE [label = "full_reset=1"]; DONE_STATE -> DRP_REQ_NO_PLL_STATE [label = "full_reset=0>rxreset_in=1"]; DONE_STATE -> DONE_STATE [label = "full_reset=0>rxreset_in=0"]; RETRY_STATE -> CHECK_RETRIES_STATE; CHECK_RETRIES_STATE -> FAIL_STATE [label = "max_retries=1"]; CHECK_RETRIES_STATE -> WAIT_RESET_DONE_STATE [label = "max_retries=0 &(post_config | pll_lock_s) = 1"]; CHECK_RETRIES_STATE -> RELEASE_PLLRESET_STATE [label = "max_retries=0&(post_config | pll_lock_s) = 0"]; RETRY2_STATE -> CHECK_RETRIES2_STATE; CHECK_RETRIES2_STATE -> FAIL_STATE [label = "max_retries=1"]; CHECK_RETRIES2_STATE -> DRP_CHECK_STATE [label = "max_retries=0"]; FAIL_STATE -> DRP_REQ_FULL_STATE [label = "full_reset=1"]; FAIL_STATE -> FAIL_STATE [label = "full_reset=0"]; }
运行结果为: