写一个verilog流水灯代码
时间: 2023-05-19 10:06:20 浏览: 222
流水灯基于Verilog语言实现及测试代码.pdf
module flow_light(
input clk,
output reg [7:0] led
);
reg [2:0] cnt;
always @(posedge clk) begin
case(cnt)
3'd0: led <= 8'b00000001;
3'd1: led <= 8'b00000010;
3'd2: led <= 8'b00000100;
3'd3: led <= 8'b00001000;
3'd4: led <= 8'b00010000;
3'd5: led <= 8'b00100000;
3'd6: led <= 8'b01000000;
3'd7: led <= 8'b10000000;
endcase
cnt <= cnt + 1;
end
endmodule
阅读全文