本帖最后由 XLDZZ 于 2011-1-26 21:39 编辑
module digital(clk,clock_s,s1,s2,puls,ent);
input clk,s1,s2,ent;
output clock_s,puls;
reg clock_m=0,clock_s=0,puls;
reg[0:11] st_cunt;
integer cunt_m=0,cunt_s=0;
[email=always@(posedge]always@(posedge[/email] clk)
begin
if(cunt_m==4)
begin
cunt_m<=0;
clock_m<=~clock_m;
end
else
begin
cunt_m<=cunt_m+1;
end
if(clock_m==1)
begin
if(cunt_s==10)
begin
cunt_s<=0;
clock_s<=~clock_s;
end
else
cunt_s<=cunt_s+1;
end
end
endmodule
想用clock_m的边沿触发下一级分频器,不知道如何使用(试过posedgeclock_m但是报错)
另外 好像采用integer只能是32位的 能否像vhdl一样 限定长度 |