always@(posedge clk50M,negedge rst_n) begin if(!rst_n) cnt<=24'h0; else begin if(cnt==24'hffffff) cnt<=24'h0; else cnt<=cnt+24'h1; end end
always@(posedge cnt[23],negedge rst_n) begin if(!rst_n) begin mled<=10'h1; dir<=1'b0; end else begin if(!dir) begin mled<={mled[8:0],1'b0}; if(mled==10'h100) dir<=1'b1; end else begin mled<={1'b0,mled[9:1]}; if(mled==10'h2) dir<=1'b0; end end end
always@(posedge clk50M,negedge rst_n) begin if(!rst_n) cnt<=24'h0; else begin cnt<=cnt+24'h1; end end
always@(posedge clk50M,negedge rst_n) begin if(!rst_n) begin mled<=10'h1; dir<=1'b0; end else begin if(cnt==24'hffffff) begin if(!dir) begin mled<={mled[8:0],1'b0}; if(mled==10'h100) dir<=1'b1; end else begin mled<={1'b0,mled[9:1]}; if(mled==10'h2) dir<=1'b0; end end end end
用户152969 2009-10-28 10:06
用户222522 2009-10-25 17:43