[笔记一]LED建模

一、Flashing_led_module

module flashing_led_module(
input CLOCK_50,
input RST_N,
output[7:0] LEDG
);

parameter T1MS=20'd999_999;

reg[19:0] Count;
always@(posedge CLOCK_50 or negedge RST_N)
	if(!RST_N)
		Count<=20'd0;
	else if(Count==T1MS)
		Count<=20'd0;
		else 
			Count<=Count+1'b1;
		
reg[7:0] rLEDG;
always@(posedge CLOCK_50 or negedge RST_N)
	if(!RST_N)
		rLEDG<=8'b00000000;
	else if(Count==T1MS)
		rLEDG<=~LEDG;

assign LEDG=rLEDG;

endmodule
二、Running_led_module
 

posted on 2011-08-12 10:50  LiangXuan  阅读(878)  评论(0编辑  收藏  举报

导航