微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 状态机“毛刺”的产生及消除方法程序

状态机“毛刺”的产生及消除方法程序

时间:07-02 来源:互联网 点击:

,即采用状态码直接输出型状态机,使状态和输出信号一致,使得输出译码电路被优化掉了,因此不会出现竞争冒险。这种方案,占用芯片资源少,信号与状态变化同步,因此速度快,是一种较优方案。但在设计过程中对状态编码时可能增加状态向量,出现多余状态。虽然可用CASE语句中WHENOTHERS来安排多余状态,但有时难以有效控制多余状态,运行时可能会出现难以预料的情况。因此它适用于状态机输出信号较少的场合。

若对ADC0809的采样控制采用状态码直接输出型状态机方案,其主要程序如下:

begin

lock=lock1;

process(current_state,eoc)

begin

case current_state IS

when st0 => next_state =st1;

when st1 => next_state =st2;

when st2 => next_state =st3;

when st3 => if (eoc =‘1’)then next_state =st3; else next_state =st4;end if;
 when st4 => if (eoc =’0’)then next_state=st4;else next_state =st5; end if;

when st5 => next_state =st6;

when st6 => next_state =st0;

when others=> next_state =st0;

end case;

out4=current_state(5 downto 2);

ale=current_state(5); start =current_state(4);

oe=current_state(3); lock1=current_state(2);

end process;

process(clk)

begin

if (clk’event and clk =‘1’) then

current_state =next_state;

end if ;

end process ;

process (lock1)

if lock1=‘1’ and lock1’event then

regl=d ;

end if ;

end process ;

q=regl;

……

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top