|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
大家帮忙看一下,我这个程序在综合时老是说产生了latch,请问如何修改?感激不尽~
其中frame_20为一个宽度为8,深度为20的寄存器组。
always @ (*)
begin
next_state <= idle;
if(!rst_n)
begin
b_full_reg <= 1'b0;
led_flag <= 1'b0;
des <= 8'd0;
res <= 8'd0;
datatype <= 8'd0;
send_en <= 1'b0;
addr<=8'b00000000;
end
else
begin
b_full_reg <= 1'b0;
led_flag <= 1'b0;
res <= frame_20[0];
des <= frame_20[1];
datatype <= frame_20[2];
send_en <= 1'b0;
case(state)
idle:
begin
if(ri_cnt==5'd20)
begin
b_full_reg <= 1'b1;
next_state <= select_do;
end
else if(ri_posedge)
begin
frame_20[ri_cnt]<=datain;
next_state <= idle;
end
else
begin
send_en <= 1'b0;
b_full_reg <= 1'b0;
led_flag <= 1'b0;
next_state <= idle;
end
end
select_do:
begin
if(des == 8'h01)
begin
case (res)
TWO:
begin
addr<=8'b00101100; //44
next_state <= pro_frame;
end
THREE:
begin
case(datatype)
d_one:
begin
addr<=8'b01000010; //66
next_state <= pro_frame;
end
d_two:
begin
led_flag<=1'b1;
next_state <= pro_led_w;
end
default
begin
addr<=8'b00000000;
led_flag<=1'b0;
next_state <= pro_frame;
end
endcase
end
FOUR:
begin
addr<=8'b01011000; //88
next_state <= pro_frame;
end
default
begin
addr<=8'b00000000; //0
next_state <= pro_frame;
end
endcase
end
else
begin
next_state <= idle;
led_flag <= 1'b0;
addr<=8'b00000000;
end
end
pro_led_w:
if(led_on_neg)
begin
next_state <= idle;
b_full_reg <= 1'b0;
led_flag <= 1'b0;
addr <= addr+8'b0;
end
else
begin
b_full_reg <= 1'b1;
led_flag <= 1'b1;
next_state <= pro_led_w;
addr <= addr+8'b0;
end
pro_frame:
begin
send_en <= 1'b1;
next_state <= pro_frame_w;
addr <= addr+8'b0;
end
pro_frame_w:
begin
addr <= addr+8'b0;
if(ti_22_pos)
begin
next_state <= idle;
b_full_reg <= 1'b0;
addr <= addr+8'b0;
end
else
begin
next_state <= pro_frame_w;
b_full_reg <= 1'b1;
if(ti_posedge & send_en)
addr <= addr+8'b1;
else addr <= addr+8'b0;
end
end
default
begin
next_state <= idle;
addr <=8'b00000000;
b_full_reg <= 1'b0;
led_flag <= 1'b0;
des <= 8'd0;
res <= 8'd0;
datatype <= 8'd0;
send_en <= 1'b0;
end
endcase
end
end
出错的警告信息为:
frame_20[0],frame_20[1],frame_20[2]和addr四个地方均产生了latch,怎么修改啊 ? |
|