always@(posedge clk or negedge rst_n)//分频器模块
begin
if(!rst_n)
begin
count<=0;
clk1<=0;
end
else
begin
count<=count+16'd1;
if(count<T)
begin
clk1=clk1;
end
else
begin
clk1=~clk1;
count<=0;
end
end
end
always@(posedge clk1 or negedge rst_n)
begin
if(!rst_n)
begin
sel<=3'b111;
seg<=8'b1111_1111;
end
else
begin
sel<=sel+3'b1;
case(sel)
3'b000:begin seg<=8'b1111_1001;end//1
3'b001:begin seg<=8'b1010_0100;end//2
3'b010:begin seg<=8'b1011_0000;end//3
3'b011:begin seg<=8'b1001_1001;end//4
3'b100:begin seg<=8'b1001_0010;end//5
3'b101:begin seg<=8'b1000_0010;end//6
default:begin sel<=3'b000;end
endcase
end
end