FX2 firmware for FPGA timetagger