always语句块中含有多个if语句时执行顺序问题
时间:10-02
整理:3721RD
点击:
- always @(posedge clk)
- begin
- if(enable) begin //如果使能端有效时就亮灯及计时
- if(!sta) begin //如果状态变量sta为0按“绿-黄-左拐-黄-红”的顺序亮灯
- sta 1)
- if(a_time[3:0]==0) begin
- a_time[3:0]<=4'd9;
- a_time[7:4]<=a_time[7:4]-1;
- end
- else a_time[3:0]<=a_time[3:0]-1;
- if(a_time==2) sta<=0;//
- end
- end
- else begin //如果使能端无效
- akind<=4'b1000;
- ordera<=0;
- sta<=0;
- end
- end
你这代码里面的if肯定是顺序执行喽