用Verilog HDL语言设计流水灯实验程序

编程实现从右至左依次点亮的流水灯,既一开始所有的LED都是熄灭的,接着做右边的LED先点亮,然后通过移位使其左边的LED也点亮,已经点亮LED不熄灭,LED全亮后重复上述过程.
请高手帮帮忙,多谢了!

module run_led(clk,rst,led); //module port
input clk;//system clock
input rst;//system reset

output [7:0] led; // 8bits led

reg [7:0] led;
reg [25:0] count;
always @ (posedge clk ) begin
if(rst || count[25]==1) begin
count<=26'b0;
end
else
count<=count+1;
end
always @ (posedge clk) begin
if(rst)
led<=8'b0000_0001;
else begin
if(count[25]==1) begin

led<=((led<<1)+1);

end
end
end
endmodule

这是我自己写的,实验正确符合楼主要求!嘿嘿。。。
温馨提示:答案为网友推荐,仅供参考
相似回答