verilog代码集锦.rar

源代码在线查看: traffic_light_controller2.v

软件大小: 37 K
上传用户: soft0318
关键词: verilog 代码 集锦
下载地址: 免注册下载 普通下载 VIP

相关代码

				//***************************************************				// File Name: traffic_light_controller.v				//      Date: October7,2008				//    author: yilong.you				//            yilong.you@stu.xjtu.edu.cn   				//**************************************************/								module traffic_light_controller2(clk,reset,light_color);				 input clk,reset;				 output[1:0] light_color; 								 reg[1:0] light_color,state;				 reg[5:0]count;				 				 parameter S0=2'd0,green=2'd1,yellow=2'd2,red=2'd3;				 				 initial state=S0;				 always@(posedge clk or  posedge reset)begin				       if(reset)begin				          state				          count				       end				       else        	  				       	  case(state)				       	  	     S0: state				              green: begin				              	         count				                         if(count==24)				                            state				                     end				          				              yellow:begin				              	         count				              	         if(count==26)				                           state				                     end				          				                 red: begin				               	         count				                         if(count==41)				                           state				                    end 				            default: count				       endcase    				 end				 always@(negedge clk) light_color				endmodule 								 				 				 				 				 				 				 				 			

相关资源