补图
这是全部代码
module sosLED1(clk,sos);
input clk;
output sos;
reg sos=1'b0;//初始值是0也就是灯灭
reg[24:0]counter1=25'd0;//记0.02微秒个数,25000000-1个,等于一个0.5s
reg[5:0]counter2=4'd0;//记0.5秒个数
always@(posedge clk)begin
if(counter1<25'd24999999)begin//判断计数器1,没到0.5秒就+1
counter1<=counter1+25'd1;
end
else begin//到0.5秒就归零
counter1<=25'd0;
//当计数器1发生归零时
if(counter2<5'd24)begin//判断计数器2,没到一个sos周期就+1
counter2<=counter2+5'd1;
if((counter2==5'd8)||(counter2==5'd9)||
(counter2==5'd12)||(counter2==5'd13)||
(counter2==5'd16)||(counter2==5'd17))begin//长信号的中间保持不变
sos<=sos;
end
else begin//其余每隔0.5秒都要跳变
sos<=~sos;
end
end
else begin//经过一个sos也就是25个0.5秒后归零
counter2<=5'd0;
end
end
end
endmodule
后面加个空行试一下,应该可以的。