always @ (posedge clk or posedge nrst)begin
if(nrst)begin
counter <=0;
clock_out <=0;
sys_tick <=0;
systick_1ms_counter <=0;
end
else begin
systick_1ms_counter <=systick_1ms_counter +1;if(counter < Delay_1ms_100M)
counter<=counter+1;else begin
clock_out <= ~clock_out;
counter <=0;if(clock_out==0)begin //0->1
sys_tick <=sys_tick+1;
systick_1ms_counter <=0;
end
end end
end