// counter16 // 16 bit loadable counter with enable and asynchronous reset // Actel Corporation // October 1, 2001 module counter16 (CLK, RESETn, LOAD, ENABLE, DATA, COUNT); input CLK, RESETn, LOAD, ENABLE; input [15:0] DATA; output [15:0] COUNT; reg [15:0] COUNT; always @(posedge CLK or negedge RESETn) begin if (!RESETn) COUNT <= 15'b0; else if (LOAD == 1'b1) COUNT <= DATA; else if (ENABLE == 1'b1) COUNT <= COUNT + 1; end endmodule