Quartus II 警告问题,求解!
本帖最后由 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 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 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 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 has unsafe behavior
Warning (13013): Ports D and ENA on the latch are fed by the same signal traffic_state:U2|flag
高手留步! 顶起! 警告通常不用去理会 好像是有latch(es)吧……一般可能是if语句没有else,case语句没有default……latch最好不要出现…… 玉草夕林 发表于 2012-9-11 09:10 static/image/common/back.gif
好像是有latch(es)吧……一般可能是if语句没有else,case语句没有default……latch最好不要出现…… ...
谢了! 代码如下:
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 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 CS, NS; //Current state, Next state
reg 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 起来
页:
[1]