05-16-2017 10:49 AM
I am using Vivado 2016.1 targeting an Artix-7 FPGA. I have implemented a ring oscillator inside the FPGA that oscillates at almost high frequency of 500 MHz. Now, I would like to design a frequency meter and implement it in order to measure that frequency. I know the concepts of frequency measurement and I had a look on this course project:
The author used a hyprid technique in order to measure the frequency of a high frequency signal. In most parts of the PDF file, he mentioned about the .vhd code sources available in CD but I did not see anything related to them ! Does anyone by chance got the source files of this project or can anyone help me to quickly design and implement a frequency counter for my targhed design, please?
Kind replies and hints are in advance appreciated !
05-16-2017 12:07 PM
Measuring a high frequency like 500 MHz should not require the hybrid method. How you do it depends on the required accuracy and how much time you have to make the measurement. For example if you're just looking at long term drift, you could count for 10 seconds and have 0.1 Hz precision (accuracy depends on the stability of your time base). For a rough measurement you could count for a much shorter period of time like 100 us to get a precision of 2 decimal places in MHz. In any case the code to do this is quite simple, but the bulk of it runs in the clock domain of the frequency being measured. In your case that means it needs to be kept simple in order to meet timing. A typical approach is to have a counter in the reference frequency domain whose high order bit has a period of 1 second (or whatever you want the measurement interval to be). Then this MSB signal is synchronized to the clock under measurement using two or more flops to reduce the chance of metastable events. Then delay the synchronized signal to detect rising edges (all in the measured frequency domain) and create a single cycle pulse. Use that pulse to reset a counter, while loading its prior value into the result register. The counter and result register need sufficient bits for the maximum frequency.
05-16-2017 12:30 PM
05-17-2017 09:05 AM
Attached is a reference design that I prepared for the Spartan-3E Starter Kit eleven years ago which implements a frequency counter. As it happens, it even contained a ring oscillator whose frequency could be measured. I think this reference design provides you with just about all the code and documentation that you should need to create you own design.
My only concern is that ~500MHz could be a bit of a challenge especially if you are not familiar with FPGA design. As such, you may like to consider implementing a 'pre-scaler' to initially divide your ~500MHz clock by some factor (e.g. by 10 to ~50MHz) and then measure the lower rate clock (and then re-scale the measurement).
05-18-2017 03:35 PM
I cordially acknowledge your great help to provide me a way to fin out what I am looking for. I am familiar with high frequency issue in FPGA and this is my field of work. I will go with those files that you kindly shared with me and will give you a feedback on its functionality.
Thanks and Regards,
05-18-2017 04:00 PM
The file KCPSM3.zip is no longer available in this link and the design synthesis is failed ! Xilinx might removed the file from server since the FPGA is old...!