VHDL で有限状態マシンを実装しているかどうか、すべての出力が可能なすべての状態にあることを述べる必要があるかどうか疑問に思っていますか? 一部の出力が 1 つの状態から別の状態に変化しないことがわかっていて、状態の順序も同じ順序になることがわかっていても?
たとえば、この (強制) 例では:
entity test is
port (
clk : in std_logic;
a : in std_logic;
b: out std_logic;
c: out std_logic;
);
end test;
architecture Behavioral of test is
type executionStage is (s1,s2,s3);
signal currentstate, nextstate: executionStage;
begin
process (clk)
begin
if(rising_edge(clk)) then
currentstate <= nextstate;
else
currentstate <= currentstate;
end if;
end process;
process(currentstate)
begin
case currentstate is
when s1 =>
if (a = '1') then
b <= '1';
c <= '0';
else
b <= '1';
c <= '1';
end if;
nextstate <= s2;
when s2 =>
-- b doesnt change state from s1 to here, do I need to define what it is here?
if (a = '1') then
b <= '1';
c <= '1';
else
b <= '1';
c <= '0';
end if;
nextstate <= s3;
when s3 =>
if (a = '1') then
b <= '0';
c <= '0';
else
b <= '1';
c <= '1';
end if;
nextstate <= s1;
end case;
end process;
end Behavioral;
私の理解では、これを行わないとラッチが作成されますか?
そのような例では大したことではありませんが、10 を超える出力と 10 を超えるステートを持つマシンを使用している場合、VHDL ファイルが信じられないほど乱雑に見え始めます。何度も同じこと。これを行うより良い方法はありますか?
編集:出力の「デフォルト」状態を定義できますか? IE は、すべてのプロセスの外側で b を 1 に設定し、それが 0 である case ステートメントでのみ定義します。それはうまくいくでしょうか?