搜索
bottom↓
回复: 6

Quartus II 警告问题,求解!

[复制链接]

出0入0汤圆

发表于 2012-9-10 20:18:05 | 显示全部楼层 |阅读模式
本帖最后由 orange-208 于 2012-9-10 20:19 编辑

警告如下:

Warning (12125): Using design file traffic_state.v, which is not specified as a design file for the current project, but contains definitions for 1 design units and 1 entities in project
        Info (12023): Found entity 1: traffic_state
Warning (10240): Verilog HDL Always Construct warning at traffic_state.v(40): inferring latch(es) for variable "count_H", which holds its previous value in one or more paths through the always construct
Warning (10240): Verilog HDL Always Construct warning at traffic_state.v(40): inferring latch(es) for variable "count_L", which holds its previous value in one or more paths through the always construct
Warning (10240): Verilog HDL Always Construct warning at traffic_state.v(40): inferring latch(es) for variable "flag", which holds its previous value in one or more paths through the always construct
Warning (10240): Verilog HDL Always Construct warning at traffic_state.v(40): inferring latch(es) for variable "red_1", which holds its previous value in one or more paths through the always construct
Warning (10240): Verilog HDL Always Construct warning at traffic_state.v(40): inferring latch(es) for variable "yellow_1", which holds its previous value in one or more paths through the always construct
Warning (10240): Verilog HDL Always Construct warning at traffic_state.v(40): inferring latch(es) for variable "green_1", which holds its previous value in one or more paths through the always construct
Warning (10240): Verilog HDL Always Construct warning at traffic_state.v(40): inferring latch(es) for variable "red_2", which holds its previous value in one or more paths through the always construct
Warning (10240): Verilog HDL Always Construct warning at traffic_state.v(40): inferring latch(es) for variable "yellow_2", which holds its previous value in one or more paths through the always construct
Warning (10240): Verilog HDL Always Construct warning at traffic_state.v(40): inferring latch(es) for variable "green_2", which holds its previous value in one or more paths through the always construct
Warning (13012): Latch traffic_state:U2|flag has unsafe behavior
        Warning (13013): Ports D and ENA on the latch are fed by the same signal traffic_state:U2|flag
Warning (13012): Latch traffic_state:U2|count_H[0] has unsafe behavior
        Warning (13013): Ports D and ENA on the latch are fed by the same signal traffic_state:U2|flag
Warning (13012): Latch traffic_state:U2|count_H[1] has unsafe behavior
        Warning (13013): Ports D and ENA on the latch are fed by the same signal traffic_state:U2|flag
Warning (13012): Latch traffic_state:U2|count_H[2] has unsafe behavior
        Warning (13013): Ports D and ENA on the latch are fed by the same signal traffic_state:U2|flag
Warning (13012): Latch traffic_state:U2|count_H[3] has unsafe behavior
        Warning (13013): Ports D and ENA on the latch are fed by the same signal traffic_state:U2|flag


高手留步!

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

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

出0入0汤圆

 楼主| 发表于 2012-9-10 21:18:04 | 显示全部楼层
顶起!     

出0入22汤圆

发表于 2012-9-11 08:10:32 来自手机 | 显示全部楼层
警告通常不用去理会

出0入0汤圆

发表于 2012-9-11 09:10:51 | 显示全部楼层
好像是有latch(es)吧……一般可能是if语句没有else,case语句没有default……latch最好不要出现……

出0入0汤圆

 楼主| 发表于 2012-9-11 09:24:00 | 显示全部楼层
玉草夕林 发表于 2012-9-11 09:10
好像是有latch(es)吧……一般可能是if语句没有else,case语句没有default……latch最好不要出现…… ...

谢了!     

出0入0汤圆

 楼主| 发表于 2012-9-11 09:49:10 | 显示全部楼层
代码如下:

module traffic_state
(
        clk_1Hz, nrst, no_pass,
       
        one_data, ten_data,
        led_r1, led_y1, led_g1,
        led_r2, led_y2, led_g2
);

        input clk_1Hz, nrst;
        input no_pass;       
       
        output [3:0]one_data, ten_data;        //倒计时个位和十位
        output led_r1, led_y1, led_g1;
        output led_r2, led_y2, led_g2;       
       
        /*******************************/
       
        parameter        state_0 = 2'b00,
                        state_1 = 2'b01,
                        state_2 = 2'b10,
                        state_3 = 2'b11;                //四种工作状态

        /******************************交通状态转换*****************************/
       
        reg red_1, yellow_1, green_1;
        reg red_2, yellow_2, green_2;
       
        reg flag;                                //倒计时赋值标志位       
        reg [1:0]CS, NS;                        //Current state, Next state
        reg [3:0]count_H, count_L;
       
        always @ ( posedge clk_1Hz or negedge nrst )
                if ( !nrst )
                        CS <= state_0;
                else
                        CS <= NS;
       
        always @ ( CS, no_pass, flag, count_H, count_L )
                begin
                   NS = 2'bx;
                       
                   case( CS )
                   state_0:        //状态state_0, 主干道通行35s
                      begin
                        if( !no_pass )
                             begin
                                if( !flag )
                                     begin
                                        state_0_init;
                                        flag <= 1'b1;
                                     end
                                else
                                     begin
                                        if( !count_H && !count_L )                //如果倒计时结束,则转至state_1状态
                                            begin
                                              NS <= state_1;
                                              flag <= 1'b0;
                                              count_H <= 4'b0000;
                                              count_L <= 4'b0000;
                                            end
                                        else if( !count_L  )
                                            begin
                                              count_L <= 4'b1001;
                                              count_H <= count_H-1'b1;
                                            end
                                        else
                                            begin
                                                count_L <= count_L-1'b1;
                                            end
                                     end
                             end
                      end
                                       
                    state_1:        //状态state_1,主干道黄灯倒计时5s
                      begin
                        if( !no_pass )
                             begin
                                if( !flag )
                                     begin       
                                        state_1_init;
                                        flag <= 1'b0;                       
                                     end
                                else
                                      begin
                                        if( !count_L )  
                                                begin
                                                    NS <= state_2;
                                                    flag <= 1'b0;
                                                    count_H <= 4'b0000;
                                                    count_L <= 4'b0000;
                                                end
                                        else
                                                begin
                                                    count_L <= count_L-1'b1;
                                                end
                                       end
                                end
                        end

                    state_2:        //状态state_2,支干道通行25s
                        begin
                            if( !no_pass )
                                begin
                                     if( !flag )
                                        begin
                                             flag <= 1'b1;
                                             state_2_init;
                                        end
                                     else
                                        begin
                                            if( !count_H && !count_L )
                                                    begin
                                                        NS <= state_3;
                                                        flag <= 1'b0;
                                                        count_H <= 4'b0000;
                                                        count_L <= 4'b0000;
                                                    end
                                            else if( !count_L )
                                                    begin
                                                        count_L <= 4'b1001;
                                                        count_H <= count_H-1'b1;
                                                    end
                                            else
                                                    begin
                                                        count_L <= count_L-1'b1;
                                                    end
                                        end
                                end
                        end
                                               
                  state_3:        //状态state_3,支干道黄灯倒计时5s
                      begin
                        if( !no_pass )
                                begin
                                   if( !flag )
                                        begin
                                             flag <= 1'b1;
                                             state_3_init;
                                        end
                                   else
                                        begin
                                            if( !count_L )                        //如果倒计时结束,则转到state_0状态
                                                begin
                                                     NS <= state_0;
                                                     flag <= 1'b0;
                                                     count_H <= 4'b0000;
                                                     count_L <= 4'b0000;
                                                end
                                             else
                                                begin
                                                     count_L <= count_L-1'b1;
                                                end
                                        end
                                end
                     end
                               
                default:
                        NS <= state_0;                                       
        endcase       
end

出0入0汤圆

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

本版积分规则

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

GMT+8, 2024-7-24 09:27

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

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