Frequency to period conversion

Dear Forum,

What is the best way to calculate clock period based on its frequency.
This is the code I am using:

parameter UVC_CLK_FREQ   = 32; 	   // MHZ
parameter UVC_CLK_PERIOD = 1000/UVC_CLK_FREQ; // ns

However what I dont like in this code, is that it does not calculate real values.
Any other codes ideas for calculating clock period from frequency?

Thanks
Hayk

In reply to haykp:

You simply express your parameter values as real numbers (32.0 and 1000.0) and you parameters will inherit they real type. And/or you can explicitly declare your parameters with a real type.

parameter UVC_CLK_FREQ   = 32.0; 	   // MHZ
parameter UVC_CLK_PERIOD = 1000.0/UVC_CLK_FREQ; // ns

parameter real UVC_CLK_FREQ   = 32; 	   // MHZ
parameter real UVC_CLK_PERIOD = 1000/UVC_CLK_FREQ; // ns

Note when you use a an expression in a delay, it’s going to get scaled to the current timescale and truncated by the time precision. You may want to write this as

parameter real UVC_CLK_PERIOD = 1000ns/UVC_CLK_FREQ; 
always #UVC_CLK_PERIOD clk = !clk;