//Verilog Code
module counter32(clk,rst,counter,co);
input clk;
input rst;
output [4:0] counter;
output co;
reg [4:0] counter;
always @(posedge clk) //sync reset
if(rst)
counter <= 5'b0;
else
counter <= counter + 1'b1;
assign co=&counter; //overflow flag
endmodule
ä¸æ¯
æè¦çæ¯EDAç