1个回答
展开全部
你好,下面是对应的代码,另外时钟的频率不要太高否者实际的那个灯可能会看不来。
module show(clk, reset, ledLight)
input clk,reset;
output [9:0] ledLight;
reg [10:0] count ;
always @(posdge clk or negedge reset)
if (!reset)
count =0;
else if (count ==10)
count =1;
else
count = count +1
assign ledLight[0] = (count ==1)? 1 :0;
assign ledLight[1] = (count ==2)? 1 :0;
assign ledLight[2] = (count ==3)? 1 :0;
assign ledLight[3] = (count ==4)? 1 :0;
assign ledLight[4] = (count ==5)? 1 :0;
assign ledLight[5] = (count ==6)? 1 :0;
assign ledLight[6] = (count ==7)? 1 :0;
assign ledLight[7] = (count ==8)? 1 :0;
assign ledLight[8] = (count ==9)? 1 :0;
assign ledLight[9] = (count ==10)? 1 :0;
endmodule
module show(clk, reset, ledLight)
input clk,reset;
output [9:0] ledLight;
reg [10:0] count ;
always @(posdge clk or negedge reset)
if (!reset)
count =0;
else if (count ==10)
count =1;
else
count = count +1
assign ledLight[0] = (count ==1)? 1 :0;
assign ledLight[1] = (count ==2)? 1 :0;
assign ledLight[2] = (count ==3)? 1 :0;
assign ledLight[3] = (count ==4)? 1 :0;
assign ledLight[4] = (count ==5)? 1 :0;
assign ledLight[5] = (count ==6)? 1 :0;
assign ledLight[6] = (count ==7)? 1 :0;
assign ledLight[7] = (count ==8)? 1 :0;
assign ledLight[8] = (count ==9)? 1 :0;
assign ledLight[9] = (count ==10)? 1 :0;
endmodule
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询