A programmable System-on-Chip based digital pulse processing for high resolution X-ray spectroscopy