I am pretty loss on the coding part of this but I can tell you in psudocode how to do this.
I assume by RPM you mean you are measuring some kind of rotation of an object. So that means you can either use an encoder or make up your own type of encoder. The encoder sends a signal to the controller everytime it completes a rotation. So from the FPGA side you would sample a segment of time and count the number of pulses. You then can take the number of pulses/time to give you a frequency of rotation. From there it is just conversion.
The custom could be something like fixing a magnet to the rotation object and having a hall effect sensor fixed to the frame. You would read the pulses of the hall effect sensor and do the same conversion.