00001 00034 module Counter 00035 ( 00036 output logic [7:0] count, 00037 input logic ck, 00038 input logic reset_N 00039 ); 00040 00045 function [7:0] increment (input [7:0] val); 00046 increment = val+1; 00047 endfunction 00048 00053 always_ff @ (posedge ck or negedge reset_N) begin: counter 00054 if (~reset_N) 00055 count <= 0; 00056 else 00057 count <= increment(count); 00058 end 00059 00060 endmodule