|
楼主 |
发表于 2011-4-13 17:23:46
|
显示全部楼层
呵呵,对不起各位啊!太菜了,忘记附程序了,好像是延时的,但是如果是延时的,请问延时的具体时间是怎么实现的啊!也就是说具体延时多久是怎么体现的!谢谢各位!辛苦啦!
module led(sys_clk,rst_n,led);
input sys_clk,rst_n;
output [2:0] led;
reg [25:0] count;
reg [2:0] led;
reg [1:0] flag;
always @(posedge sys_clk,negedge rst_n)
if(!rst_n)
begin
flag <= 2'b0;
count <= 26'b0;
end
else
begin
if( count == 26'b11_1111_1111_1111_1111_1111_1110 )
begin
count <= 26'b0;
if(flag == 2'b10)
flag <= 2'b00;
else
flag <= flag+2'b01;
end
else
count <= count + 1;
end
always @(posedge sys_clk)
begin
case(flag)
2'b00: led <= 3'b011;
2'b01: led <= 3'b101;
2'b10: led <= 3'b110;
default:led <= 3'b111;
endcase
end
endmodule |
|