【问题标题】:FSM machine in VHDL with each state DOING CERTAIN OPERATIONSVHDL 中的 FSM 机器,每个状态都在执行某些操作
【发布时间】:2013-05-15 19:48:12
【问题描述】:

我有一个具有五个状态(s1、s2、s3、s4、s5)的 FSM。

但是,对于每个状态,都应该执行一系列操作。例如,在 s2 中,计数器应该从 1 计数到 10。

我的问题来了:FSM 怎么会知道“我应该从 s2 更改为 s3”?或者换一种说法,s2怎么能告诉FSM“我完成了”,应该根据LookUpTable开始新的状态?

【问题讨论】:

    标签: vhdl fsm


    【解决方案1】:

    如果您以体面的风格编写 FSM,这真的不是问题。示例:

    architecture RTL of dut is
        type state_t is (s1, s2, s3, s4, s5);
        signal state     : state_t;
        signal counter   : integer;
        signal condition : boolean;
    begin
        fsm : process is
        begin
            if rising_edge(clk) then
                case state is
                    when s1 =>
                    -- do stuff
                    when s2 =>
                        if condition then
                            counter <= 0;
                            state   <= s3;
                        end if;
                    when s3 =>
                        if counter = 10 then
                            state <= s4;
                        else
                            counter <= counter + 1;
                        end if;
                    when s4 =>
                        null;
                    when s5 =>
                        null;
                end case;
            end if;
        end process fsm;
    
    end architecture RTL;
    

    【讨论】:

    • 嗨菲利普。感谢您的回复!这是我尝试使用三个流程来实现 FSM 的内容。在进程 1 中,state_reg
    • @richieqianle:请考虑不要使用三个进程并按照 Philippe 建议的方式进行操作......我发现它更容易处理。 stackoverflow.com/questions/4409532/vhdl-process-style
    猜你喜欢
    • 1970-01-01
    • 2014-10-03
    • 2019-06-16
    • 2019-02-12
    • 2017-05-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-30
    • 1970-01-01
    相关资源
    最近更新 更多