用Verilog HDL编写的8位跑马灯程序,附Basys2-ucf仿真程序

刚才写了个跑马灯程序,毕竟第一次写,小小的激动,现在分享上来

module walkled_8(led,clk);
	input clk;
	output [7:0] led;
	reg [7:0] led_out;
	reg [25:0] buffer;
	always@(posedge clk)
	begin
		buffer<=buffer+1'b1;
		if(buffer==26'd25000000)
		begin
			led_out=led_out<<1;
			if(led_out==8'b00000000)
			led_out=8'b00000001;
			end
		end
		assign led=led_out;

endmodule


.ucf

NET "LED[7]" LOC = G1;
NET "LED[6]" LOC = P4;
NET "LED[5]" LOC = N4;
NET "LED[4]" LOC = N5;
NET "LED[3]" LOC = P6;
NET "LED[2]" LOC = P7;
NET "LED[1]" LOC = M11;
NET "LED[0]" LOC = M5;
NET "clk" LOC = b8;

 

附上视频链接地址:

http://t.cn/RAFVyWR
http://video.weibo.com/show?fid=1034:83be2df6d5fd6db357d13e75b916f87a

 

你可能感兴趣的:(verilog,HDL)