流水灯程序,下进去灯全亮。有什么错误!
时间:10-02
整理:3721RD
点击:
module TEST_LED2(clk1,led);
input clk1;
output[5:0]led;
reg[5:0]led;
reg[2:0]status;
reg[25:0]buffer;
always@(posedge clk1)
begin
buffer<=buffer+1'b1;
if(buffer==25'b1_0111_1101_0111_1000_0100_0000)
begin
buffer<=0;
status<=status+1'b1;
if(status==3'd5)
status<=0;
end
end
always@(posedge clk1)
begin
case(status)
3'd0:led<=6'b111110;
3'd1:led<=6'b111101;
3'd2:led<=6'b111011;
3'd3:led<=6'b110111;
3'd4:led<=6'b101111;
3'd5:led<=6'b011111;
endcase
end
endmodule
input clk1;
output[5:0]led;
reg[5:0]led;
reg[2:0]status;
reg[25:0]buffer;
always@(posedge clk1)
begin
buffer<=buffer+1'b1;
if(buffer==25'b1_0111_1101_0111_1000_0100_0000)
begin
buffer<=0;
status<=status+1'b1;
if(status==3'd5)
status<=0;
end
end
always@(posedge clk1)
begin
case(status)
3'd0:led<=6'b111110;
3'd1:led<=6'b111101;
3'd2:led<=6'b111011;
3'd3:led<=6'b110111;
3'd4:led<=6'b101111;
3'd5:led<=6'b011111;
endcase
end
endmodule
你会不会是分频不够大,你用的是多少赫兹的时钟?
11111111111111119999999999999999999999