×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

问个VHDL代码的问题。下个这段代码综合起来会有什么不好的地方吗。看着不舒服,但是好像是对的。

process( ResDrv, CXOut, MinClkCnt ) begin

if( ResDrv = '1' ) then

MinClkCnt <= b"000000";

elsif( CXOut'event and CXOut = '1' ) then

if( SecCarry = '1' and CmdReg(5) = '1' ) then

MinClkCnt <= b"000000";

elsif( SecCarry = '1' ) then

if( MinClkCnt = 59 ) then

MinClkCnt <= b"000000"; --Reset the count when 60 is reached.

else

MinClkCnt <= MinClkCnt + 1;

end if;

end if;

end if;

end process;
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / 问个VHDL代码的问题。下个这段代码综合起来会有什么不好的地方吗。看着不舒服,但是好像是对的。
    process( ResDrv, CXOut, MinClkCnt ) begin

    if( ResDrv = '1' ) then

    MinClkCnt <= b"000000";

    elsif( CXOut'event and CXOut = '1' ) then

    if( SecCarry = '1' and CmdReg(5) = '1' ) then

    MinClkCnt <= b"000000";

    elsif( SecCarry = '1' ) then

    if( MinClkCnt = 59 ) then

    MinClkCnt <= b"000000"; --Reset the count when 60 is reached.

    else

    MinClkCnt <= MinClkCnt + 1;

    end if;

    end if;

    end if;

    end process;
    • I don't see anything wrong with it, but I probably prefer to another way:
      process( ResDrv, CXOut, MinClkCnt ) begin
      if( ResDrv = '1' ) then
      MinClkCnt <= b"000000";
      elsif( CXOut'event and CXOut = '1' ) then
      if( SecCarry = '1') then
      if (CmdReg(5) = '1' or MinClkCnt = 59) then
      MinClkCnt <= b"000000";
      else
      MinClkCnt <= MinClkCnt + 1;
      end if;
      end if;
      end if;
      end process;
      • Yours looks better, it usually works better as well. However, "MinClkCnt" should not be in the signal list. It should be corrected as "process( ResDrv, CXOut)".
        • why? 那个signal list不是就是给模拟用的吗?对实际电路有什么影响吗?
          • "MinClkCnt" 既不是异步清零/置位信号,也不是同步时钟,不应在那里出现。 综合工具一般忽略这个敏感信号表,但印象中也有的综合工具会报错。另外,读码时容易误解。