module delay1s(clk,ledout); output ledout; integer count1,count2;//integer为32位带符号整型变量 //reg[7:0] count1,count2; input clk; reg ledout; always @(posedge clk)//当clk上升沿到来时执行 begin count1=count1+1; if(count1==40000) begin count2=count2+1; if(count2==1000)//40000*1000*25=1,000,000,000ns=1s begin ledout=!ledout; count1=0; count2=0; end end end endmodule