总算可以上网了,这几天总登不上去,废话不多说。看FPGA的测设程序,复位信号都是用的下降沿,我把它换为上升沿,就不得行了,代码如下,我还是个初学者,希望大家多多指教
module led_ex(sys_clk ,sys_rst ,
led
);
//
input sys_clk ;
input sys_rst ;
output [3:0] led ;
//
reg [3:0] led ;
reg [24:0] delay_cnt ;
//
always@(posedge sys_clk or posedge sys_rst)
begin
if(sys_rst)
delay_cnt <= 25'd0;
else if (delay_cnt == 25'd24999999)
delay_cnt <= 25'd0;
else
delay_cnt <= delay_cnt + 1'b1;
end
//
always@(posedge sys_clk or posedge sys_rst)
begin
if(sys_rst)
led <= 4'b0111;
else
begin
if(delay_cnt == 25'd24999999)
led <= {led[0],led[3:1]};
else
led <= led;
end
end
endmodule