A FPGA based time-to-digital converter featuring on-the-fly calibration and real-time data readout