程序:
module count24(Rd,EN,CLK,Qh,Ql,C);
input Rd,EN,CLK;
output [3:0]Qh,Ql;
output C;
reg [3:0]Qh,Ql;
reg C;
initial
begin
Qh=4'd0;Ql=4'd0;C=0;
end
always @ (posedge CLK)
begin
if(EN==1)
begin
if(Rd==0)
begin
Qh=4'd0;Ql=4'd0;C=0;
end
else if(Qh<4'd2&&Ql<4'd9)
Ql=Ql+1;
else if(Qh<4'd2&&Ql==4'd9)
begin
Qh=Qh+1;Ql=4'd0;
end
else if(Qh==4'd2&&Ql<4'd3)
Ql=Ql+1;
else begin
Qh=4'd0;Ql=4'd0;C=0;
end
if(Qh==4'd2&&Ql==4'd3)
C=1;
end
end
endmodule
最好注释的清楚些,因为我不太会这个东西,就是想知道这是个什么东西他的功用,以及各个程序句子的意思,和端口!谢了。大神,会加分的哦!
这是一个24进制的计时器,我就是想知道每个语句的意思!