利用CPLD MAX3000系列EPM3064ALC44-10设计数字钟
//实现二分频 module div2(cin,cout); input cin; output cout; reg cout; always@(posedge cin) begin cout<=~cout; end endmodule //十进制计数器 module counter10(rst,clk,dout,cout); input clk,rst; output cout; output[3:0] dout; reg cout; reg[3:0] dout; always@(posedge clk or posedge rst) begin if(rst) begin dout<=0; cout<=0; end else begin if(dout==4'd9) begin dout<=0; cout<=1; end else begin cout<=0; dout<=dout+1; end end end endmodule //六进制计数器 module counter6(rst,clk,dout,cout); input clk,rst; output cout; output[2:0] dout; reg cout; reg[3:0] dout; always@(posedge clk or posedge rst) begin if(rst) begin dout