adding a function to convert to frequency table for use in ipu

still need to work out exactly how all these data gets pass around though