在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 7262|回复: 7

[求助] 求助VHDL交通灯程序的多时钟错误,该怎么改啊

[复制链接]
发表于 2011-8-24 16:39:32 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
其中一个process如下,可不可以这样计数呀,就是不同的状态要延续不同的时间



  1. process(clk,reset,call)
  2.         begin
  3.                 if(reset='1')then
  4.                         cur_st<=s0;
  5.                 else
  6.                         if(cur_st=s0)then
  7.                                 if(clk'event and clk='1')then
  8.                                         if(call='0')then
  9.                                                 if(count0=4999)then
  10.                                                         cur_st<=next_st;
  11.                                                         count0<=0;
  12.                                                 else
  13.                                                         count0<=count0+1;
  14.                                                 end if;
  15.                                         end if;
  16.                                 end if;
  17.                         elsif(cur_st=s1 or cur_st=s3)then
  18.                                 if(clk'event and clk='1')then
  19.                                         if(call='0')then
  20.                                                 if(count1=24999)then
  21.                                                         cur_st<=next_st;
  22.                                                         count1<=0;
  23.                                                 else
  24.                                                         count1<=count1+1;
  25.                                                 end if;
  26.                                         end if;
  27.                                 end if;
  28.                         elsif(cur_st=s2 or cur_st=s4)then
  29.                                 if(clk'event and clk='1')then
  30.                                         if(call='0')then
  31.                                                 if(count2=9999)then
  32.                                                         cur_st<=next_st;
  33.                                                         count2<=0;
  34.                                                 else
  35.                                                         count2<=count2+1;
  36.                                                 end if;
  37.                                         end if;
  38.                                 end if;
  39.                         end if;
  40.                 end if;
  41.         end process;



复制代码
出现如下编译错误,求救啊!!!   怎么改呀???
Error (10821): HDL error at jiaotongdeng.vhd(21): can't infer register for "cur_st.s4" because its behavior does not match any supported register model
Error (10821): HDL error at jiaotongdeng.vhd(21): can't infer register for "cur_st.s3" because its behavior does not match any supported register model
Error (10821): HDL error at jiaotongdeng.vhd(21): can't infer register for "cur_st.s2" because its behavior does not match any supported register model
Error (10821): HDL error at jiaotongdeng.vhd(21): can't infer register for "cur_st.s1" because its behavior does not match any supported register model
Error (10821): HDL error at jiaotongdeng.vhd(21): can't infer register for "cur_st.s0" because its behavior does not match any supported register model
Error (10822): HDL error at jiaotongdeng.vhd(33): couldn't implement registers for assignments on this clock edge
Error (10822): HDL error at jiaotongdeng.vhd(44): couldn't implement registers for assignments on this clock edge
Info (10018): Can't recognize finite state machine "cur_st" because it has a complex reset state
Error: Can't elaborate top-level user hierarchy
Error: Quartus II Analysis & Synthesis was unsuccessful. 8 errors, 6 warnings
        Error: Peak virtual memory: 214 megabytes
        Error: Processing ended: Wed Aug 24 15:50:17 2011
        Error: Elapsed time: 00:00:03
        Error: Total CPU time (on all processors): 00:00:03
Error: Quartus II Full Compilation was unsuccessful. 10 errors, 6 warnings
发表于 2011-8-25 08:09:53 | 显示全部楼层
你弄个附件吧,这样不好看
发表于 2011-8-25 08:57:17 | 显示全部楼层
FF的写法有固定格式:
if reset='0' then
...
elsif(clk'event and clk='1')then
...
发表于 2011-8-25 13:00:40 | 显示全部楼层
主要是楼主对状态机的设计理解得不够,才会出现这种问题,把状态转移和状态判断的处理弄错了。
发表于 2011-8-26 08:26:59 | 显示全部楼层
process(clk,reset,call)
        begin
                if(reset='1') then
                        cur_st<=s0;
                elsif clk'event and clk='1' then
                        if(cur_st=s0)then
--                                if(clk'event and clk='1')then
                                        if(call='0')then
                                                if(count0=4999)then
                                                        cur_st<=next_st;
                                                        count0<=0;
                                                else
                                                        count0<=count0+1;
                                                end if;
                                        end if;
                                end if;
                        elsif(cur_st=s1 or cur_st=s3)then
--                                if(clk'event and clk='1')then
                                        if(call='0')then
                                                if(count1=24999)then
                                                        cur_st<=next_st;
                                                        count1<=0;
                                                else
                                                        count1<=count1+1;
                                                end if;
                                        end if;
                                end if;
                        elsif(cur_st=s2 or cur_st=s4)then
--                                if(clk'event and clk='1')then
                                        if(call='0')then
                                                if(count2=9999)then
                                                        cur_st<=next_st;
                                                        count2<=0;
                                                else
                                                        count2<=count2+1;
                                                end if;
                                        end if;
                                end if;
                        end if;
                end if;
        end process;

这样试试看吧
还有你可以在网上搜一下,看状态机的结构是怎么样的
发表于 2011-9-20 19:49:24 | 显示全部楼层
一般 时序逻辑敏感列表中 不要出现组合逻辑信号,就是process(clk,reset)
最好只有这两个敏感信号,一个时钟,一个复位。一般一个进程最好执行一种操作,分为多个进程做~
发表于 2011-10-4 21:06:05 | 显示全部楼层
回复 1# janusuer


    话说俺没看附件,但是觉得时钟分频就没啥意思了。因为如果都在边沿的话,分频的时钟必然慢一拍。
发表于 2011-10-4 21:52:38 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

X

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-6-17 16:50 , Processed in 0.036426 second(s), 11 queries , Gzip On, MemCached On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表