搜索
bottom↓
回复: 9

FPGA做异步fifo时遇到以下警告,这个怎么解决?

[复制链接]

出0入0汤圆

发表于 2013-4-1 15:39:48 | 显示全部楼层 |阅读模式
如题,警告如下:

Warning (13004):
                 Presettable and clearable registers converted to equivalent circuits with latches. Registers power-up to an undefined state, and DEVCLRn places the registers in an undefined state.
        Warning (13310): Register "wptr_full:wptr_full|wfull" is converted into an equivalent circuit using register "wptr_full:wptr_full|wfull~_emulated" and latch "wptr_full:wptr_full|wfull~latch"
        Warning (13310): Register "async_cmp:async_cmp|direction" is converted into an equivalent circuit using register "async_cmp:async_cmp|direction~_emulated" and latch "async_cmp:async_cmp|direction~latch"
        Warning (13310): Register "wptr_full:wptr_full|wfull2" is converted into an equivalent circuit using register "wptr_full:wptr_full|wfull2~_emulated" and latch "wptr_full:wptr_full|wfull~latch"


又遇到过的吗???

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

 楼主| 发表于 2013-4-1 15:40:09 | 显示全部楼层
代码如下::
module wptr_full
(
        wfull, wptr, afull_n,
        winc, wclk, wrst_n
);

        parameter ADDRSIZE = 4;

        output wfull;
        output [ADDRSIZE-1:0] wptr;
        input afull_n;
        input winc, wclk, wrst_n;

        reg [ADDRSIZE-1:0] wptr, wbin;
        reg wfull, wfull2;
        wire [ADDRSIZE-1:0] wgnext, wbnext;

        //---------------------------------------------------------------
        // GRAYSTYLE2 pointer
        //---------------------------------------------------------------
        always @ ( posedge wclk or negedge wrst_n )
        if( !wrst_n )
                begin
                        wbin <= 0;
                        wptr <= 0;
                end
        else
                begin
                        wbin <= wbnext;
                        wptr <= wgnext;
                end

        //---------------------------------------------------------------
        // increment the binary count if not full
        //---------------------------------------------------------------
        assign wbnext = !wfull ? wbin + winc : wbin;
        assign wgnext = ( wbnext >> 1 ) ^ wbnext; // binary-to-gray conversion
        always @ ( posedge wclk or negedge wrst_n or negedge afull_n )
        if( !wrst_n )
                {wfull,wfull2} <= 2'b00;
        else if( !afull_n )
                {wfull,wfull2} <= 2'b11;
        else
                {wfull,wfull2} <= {wfull2,~afull_n};
       
endmodule

出0入0汤圆

发表于 2013-4-1 15:56:10 | 显示全部楼层
给wfull、wfull2等寄存器赋个初值试试

出0入0汤圆

 楼主| 发表于 2013-4-1 16:21:11 | 显示全部楼层
Codoox 发表于 2013-4-1 15:56
给wfull、wfull2等寄存器赋个初值试试

还是不行,谢了!

出0入0汤圆

发表于 2013-4-1 16:28:07 | 显示全部楼层
always @ ( posedge wclk or negedge wrst_n or negedge afull_n )
应该是这一句的问题,FPGA中的寄存器只有一个复位端,你这用了两个,
所以编译器就Presettable and clearable registers converted to equivalent circuits with latches,
即用锁存器的方式实现,而不是寄存器。你看一下RTL图应该是生成了锁存。
不过电路的功能应该是可以实现的。

出0入0汤圆

发表于 2013-4-1 16:32:06 | 显示全部楼层
解决的办法就是:用组合逻辑先将 wrst_n和afull_n合并成一个信号,再传递到always@

出0入442汤圆

发表于 2013-4-1 17:46:33 | 显示全部楼层
Codoox 发表于 2013-4-1 16:28
always @ ( posedge wclk or negedge wrst_n or negedge afull_n )
应该是这一句的问题,FPGA中的寄存器只 ...

电路功能是能实现,但是结果不可预料。我遇到过N次了,所以现在写代码很谨慎,保证生成即需要。

出0入0汤圆

发表于 2013-4-1 21:07:58 | 显示全部楼层
  always @ ( posedge wclk or negedge wrst_n or negedge afull_n ) 这个写法有问题

出0入0汤圆

 楼主| 发表于 2013-4-1 22:34:28 | 显示全部楼层
Codoox 发表于 2013-4-1 16:32
解决的办法就是:用组合逻辑先将 wrst_n和afull_n合并成一个信号,再传递到always@ ...

很感激!!!!!

出0入0汤圆

发表于 2013-4-2 08:26:35 | 显示全部楼层
orange-208 发表于 2013-4-1 22:34
很感激!!!!!

不客气,互相学习
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-24 07:19

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表