第一种:
always @(posedge clk or negedge rst_n) begin
if(!rst_n)
counter_ndl <= 16'd0;
else
if(cs==WR_SEQ)
if(fifo_pop_req)
counter_ndl <= counter_ndl - 16'd1;
else
counter_ndl <= counter_ndl;
else if(cs==BC_CIRC && counter_ndl==16'd0 && ch_circ==1'b1)
counter_ndl <= ch_ndl;
end
第二种:
always @(posedge clk or negedge rst_n) begin
if(!rst_n)
counter_ndl <= 16'd0;
else if(cs==WR_SEQ && fifo_pop_req)
counter_ndl <= counter_ndl - 16'd1;
else if(cs==BC_CIRC && counter_ndl==16'd0 && ch_circ==1'b1)
counter_ndl <= ch_ndl; //load count value
end
显然第二种更好。
第一种格式类似于人思维的直接表达,没经过加工和整理

最低0.47元/天 解锁文章
4万+





