【发布时间】:2013-12-10 09:45:29
【问题描述】:
我们正在用 VHDL 实现一个以太网 MAC 控制器..
首先,这是我的代码的代码 sn-p..
-- next state
PROCESS(p_state, phy_start, phy_ctr, phy_clk)
BEGIN
CASE p_state IS
WHEN sIDLE =>
IF(phy_start = '1' or rising_edge(phy_start)) THEN
n_state <= sPRE;
ELSIF(phy_start'event AND phy_start='0') THEN
n_state <= n_state;
ELSE
n_state <= sIDLE;
END IF;
............
问题是我的教授告诉我我将 phy_start 关联为时钟信号,其中rising_edge() 必须只与一个时钟关联,即 phy_clk。我想要发生的是当 phy_start 断言时,它将在下一个时钟周期进入 sPRE 状态。断言在时钟的上升沿完成。我试过了
PROCESS(p_state, phy_start, phy_ctr, phy_clk)
BEGIN
CASE p_state IS
WHEN sIDLE =>
IF(phy_start = '1') THEN
n_state <= sPRE;
ELSIF(phy_start'event AND phy_start='0') THEN
n_state <= n_state;
ELSE
n_state <= sIDLE;
.............
但它没有进入 phy_start = '1' 因为它发生在转换中..(我们称之为设置时间,在该时间段内数据必须稳定才能正确读取)。那么正确的实现是什么?或者,如果断言发生在上升沿,我别无选择,只能将 phy_start 断言 2 个时钟周期,或者 phy_start 必须在时钟的下降沿断言。另外,下一个状态逻辑的正确敏感度列表集是什么?
【问题讨论】: