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

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

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 5935|回复: 14

[求助] 搞不懂为什么无法综合。。请教之,关于无法综合成FF的问题

[复制链接]
发表于 2011-9-6 23:03:26 | 显示全部楼层 |阅读模式

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

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

x
一个计数器:
module counter_fiv(clk,rst,start0,counter_out);


input clk,rst;
        input start0;

output [5:0] counter_out;

reg [5:0] counter_out;




reg [5:0] counter_m;

wire temp;




assign temp = !rst | !start0 ;




always @ (posedge clk or negedge rst) begin

   if (temp)

              counter_m <= 6'd0;

      else   

      counter_m <=counter_m +1'b1;

      end


always @ (counter_m) counter_out = counter_m;

endmodule

----------------------------------------------------



ERROR:Xst:899 - "../counter_fiv.v" line 15: The logic for <counter_m> does not match a known FF or Latch template. The description style you are using to describe a register or latch is not supported in the current software release.
------------------------------------------------------

还有一个问题,有点困扰,就是,可综合的模块不允许在两个always模块里面给同一个寄存器赋值,可是又不允许在敏感表中同时列举沿触发和电平触发。。那怎么写呢。。

比如这个计数器,我想有一个外部开关来控制启动与否,用start0来表示,start0=1时启动,start0=0时关闭。那start0和posedge clk之间怎么写呢,把start0写在posedge里面,肯定不是本意;可是写在外面,单独用一个always块写又不可综合,是不是要用assign来连接start0和counter_m呢?。。。

求教。。。
发表于 2011-9-7 05:09:39 | 显示全部楼层
个人见解:
问题1:你是想把counter_m赋值给counter_out吧,为何不直接always@*
问题2:状态机
发表于 2011-9-7 09:01:46 | 显示全部楼层
你的时序always的敏感表里定义了:posedge clk or negedge rst,但是rst根本没用到。改成posedge clk or posedge temp试试。
always @ (counter_m) counter_out = counter_m;这个赋值想做什么呢?把reg [5:0] counter_out去掉,直接assign counter_out = counter_m不就行?
发表于 2011-9-7 09:04:47 | 显示全部楼层
always @ (posedge clk or negedge rst) begin
   if (temp)
发表于 2011-9-7 10:55:08 | 显示全部楼层
把敏感变量里的 or negedge rst去掉。因为你没有用到这个信号。编译工具不能判断你断表示什么样的逻辑电路,所以无法综合。
发表于 2011-9-7 11:03:45 | 显示全部楼层
我认为把代码改成这样更好
module counter_fiv(clk,rst,start0,counter_out);


input clk,rst;
        input start0;

output [5:0] counter_out;

reg [5:0] counter_out;
always @ (posedge clk or negedge rst) begin
   if (~rst)
        counter_out <= 6'd0;
   else if (start0==1'b1)
      counter_out <=counter_out +1'b1;
   else
     counter_out <= counter_out;
endmodule
如果counter_out在start0无效的时候要回零,就把counter_out<=counter_out换成counter_out<=0;
发表于 2011-9-7 13:04:07 | 显示全部楼层
6L的code比较好一些,LZ的有些像初学者的风格。
发表于 2011-9-7 14:18:55 | 显示全部楼层
你的counter是要寄存器来实现,就考虑当时钟沿来的时候,在什么条件下累加,什么条件下保持
只能在一个always block中赋值
 楼主| 发表于 2011-9-7 15:23:36 | 显示全部楼层
回复 3# rice973


   我觉得negedge rst 是用到了吧。。temp=!rst | !start0,如果下降沿到来,那!rst=1,temp=1,形成了触发呀。。
   assign语句的左边值只能是线网型的吧,计数器里面定义了counter_out是reg型啊,不能直接用assign赋值吧。。
 楼主| 发表于 2011-9-7 15:30:21 | 显示全部楼层
回复 6# immonster


   可是这样的话,start0的优先级就在rst之下了。。其实我是想让strat0有最高的优先级,电平开关,然后当start0=1时,其他的才有效。。。您能再帮我改一下么?谢谢。。初学VERILOG,很多都不会,摸索中,向前辈们请教。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

X

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

GMT+8, 2025-6-19 01:03 , Processed in 0.027173 second(s), 9 queries , Gzip On, MemCached On.

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