用STATECAD快速设计有限状态机
next_sreg<=OFF; next_POWERLED<='0';
next_PLAYLED<='0'; next_RECORDLED<='0';
END IF;
IF ( STOPSWITCH='1' AND POWERSWITCH='1' ) THEN
next_sreg<=POWERON; next_POWERLED<='1';
next_PLAYLED<='0'; next_RECORDLED<='0';
END IF;
WHEN POWERON =>
IF ( POWERSWITCH='0' ) THEN
next_sreg<=OFF; next_POWERLED<='0';
next_PLAYLED<='0'; next_RECORDLED<='0';
ELSIF ( RECORDSWITCH='1' ) THEN
next_sreg<=RECORDING; next_POWERLED<='1';
next_PLAYLED<='0'; next_RECORDLED<='1';
ELSIF ( PLAYSWITCH='1' ) THEN
next_sreg<=PLAY; next_POWERLED<='1';
next_PLAYLED<='1'; next_RECORDLED<='0';
ELSE
next_sreg<=POWERON; next_POWERLED<='1';
next_PLAYLED<='0'; next_RECORDLED<='0';
END IF;
WHEN RECORDING =>
IF ( POWERSWITCH='1' AND STOPSWITCH='0' ) THEN
next_sreg<=RECORDING; next_POWERLED<='1';
next_PLAYLED<='0'; next_RECORDLED<='1';
END IF;
IF ( POWERSWITCH='0' ) THEN
next_sreg<=OFF; next_POWERLED<='0';
next_PLAYLED<='0'; next_RECORDLED<='0';
END IF;
IF ( STOPSWITCH='1' AND POWERSWITCH='1' ) THEN
next_sreg<=POWERON; next_POWERLED<='1';
next_PLAYLED<='0'; next_RECORDLED<='0';
END IF;
WHEN OTHERS =>
END CASE;
END PROCESS;
END BEHAVIOR;
整个状态机实现过程比相当简单。快捷。有效。
Tags:
作者:佚名评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论