代码一:
always@(posedge CLK_25M)
if(cnt == 20'd1000000)
begin
cnt <= 20'd0;
end
else cnt <= cnt + 1'd1;
代码二:
always @ (posedge CLK_25M or negedge rst_n)
begin
if (!rst_n)
time_cnt <= 27'h0;
else
time_cnt <= time_cnt_n;
end
always @ (*)
begin
if (time_cnt == SET_TIME_1S)
time_cnt_n <= 27'h0;
else
time_cnt_n <= time_cnt + 27'h1;
end
两段代码都是计数器,后者将时序逻辑和组合逻辑分成了两个always的好处是什么?
只是不懂第二段代码那种写法的好处是在哪里
一周热门 更多>