为什么仿真图形led的数据一直是0?求大神指导一下。
时间:10-02
整理:3721RD
点击:
always@(posedge clk_1Hz or negedge rst )
begin
if (!rst)current_state=2'b00;
else current_state<=next_state;
end
always@(current_state)
case (current_state)
s0: next_state<=s1;
s1: next_state<=s2;
s2: next_state<=s3;
s3: next_state<=s0;
default : next_state<=s0;
endcase
always@(current_state )
case (current_state)
s0:led<=2'b00;
s1:led<=2'b01;
s2:led<=2'b10;
s3:led<=2'b11;
default : led<=2'b00;
endcase
begin
if (!rst)current_state=2'b00;
else current_state<=next_state;
end
always@(current_state)
case (current_state)
s0: next_state<=s1;
s1: next_state<=s2;
s2: next_state<=s3;
s3: next_state<=s0;
default : next_state<=s0;
endcase
always@(current_state )
case (current_state)
s0:led<=2'b00;
s1:led<=2'b01;
s2:led<=2'b10;
s3:led<=2'b11;
default : led<=2'b00;
endcase
仿真图呢。贴上来采好分析啊!谁知道是不是tb写错了!
看一下current_state这个变量,你的状态机应该没走进那几个状态,只走到了default里面。仿真波形里找到current_state右键add到波形里看看。