cancel
Showing results for
Show  only  | Search instead for
Did you mean:
603 Views
Registered: ‎01-29-2021

## How to measure a clock frequency using ILA?

Hi,

I have a DUT that has a system clock of 250 MHz and a gated ring oscillator. I am interested to know the frequency of the ROSC using ILA or something similar. But ILA has no timing scale. ILA also doesn't allow me to plot the system clock as a reference. How can I use ILA or something else to measure a clock?

1 Solution

Accepted Solutions
524 Views
Registered: ‎05-11-2015

ILA doesn't show a time scale but you know its clock and its period, don't you. You see sample numbers that you can easily convert into time.

One way to measure frequency is to divide it by a large number N to have a resulting frequency of about 1 Hz. With that signal you start and stop a counter running with a known frequency (Fr). If the count is C, the equation is:

N/F  = C/Fr

Where F is the unknown frequency.

8 Replies
Moderator
534 Views
Registered: ‎02-09-2017

Unfortunately there is no way to set the ILA to display a time scale. The ILA scale is relative to its clock, so if you are clocking the ILA at, say 100MHz, then each measurement in the ILA waveform corresponds to 1 clock cycle, or 1/100MHz = 10ns. You can use the markers in the waveform viewer to measure the distance between a cycle on your ROSC and then calculate it based on your ILA clock.

Also keep in mind that the ILA samples the data once every clock cycle. So according to the Nyquist rate, you can only successfully sample signals with frequency up to 1/2 ILAclock. You could add the 250MHz clock as a probe in the ILA, but for the same reasons, it wouldn't work (unless you clocked the ILA at 500MHz, which is not possible).

What is the clock frequency you are using for the ILA?

Thank you,

Andre Guerrero

Product Applications Engineer

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
Scholar
525 Views
Registered: ‎06-21-2017

You can use the ring oscillator to drive a counter.  Take the msb of the counter and run it to an ILA clocked by your system clock.  This should give you a good estimate of the frequency provided the counter can increment at the frequency of the ring oscillator.  Be sure to include an ASYNC_REG attribute on the signal you run to the ILA.

525 Views
Registered: ‎05-11-2015

ILA doesn't show a time scale but you know its clock and its period, don't you. You see sample numbers that you can easily convert into time.

One way to measure frequency is to divide it by a large number N to have a resulting frequency of about 1 Hz. With that signal you start and stop a counter running with a known frequency (Fr). If the count is C, the equation is:

N/F  = C/Fr

Where F is the unknown frequency.

500 Views
Registered: ‎01-29-2021

@anunesgu Thanks for your reply. I am not sure about my ILA clock frequency. I used mark debug, set up debug, saved constraints and it automatically created it. I see this line in the constraints:

``set_property C_CLK_INPUT_FREQ_HZ 300000000 [get_debug_cores dbg_hub]``

But what I know is my system clock is running at 250 MHz and it is driving my MATLAB AXI master IP at 200 MHz as shown below:

I am also attaching my ROSC code below which should be obviously more than 250 MHz.

```````timescale 1ns / 1ps
(* keep_hierarchy = "yes" *) module ring(enable, clk);
(* dont_touch = "true" *) parameter SIZE = 5; // This needs to be an odd number
(* dont_touch = "true" *) output clk;
(* dont_touch = "true" *) input enable;
(* dont_touch = "true" *) wire [SIZE-2 : 0] w;
(* dont_touch = "true" *) wire clk1;

generate
genvar i;
for (i=0; i<SIZE-2; i=i+1) begin : notGates
(* dont_touch = "true" *) not #5 notGate1(w[i+1], w[i]);
end
endgenerate

(* dont_touch = "true" *) nand #5 nandGate(clk1, w[SIZE-2], enable);
(* dont_touch = "true" *) not #5 notGate0(w[0], clk1);

BUFG BUFG_inst (
.O(clk),
.I(clk1)
);

endmodule``````

500 Views
Registered: ‎01-29-2021

@bruce_karaffa Looks like a very good idea. Is ASYNC_REG attribute  similar to don't touch?

500 Views
Registered: ‎01-29-2021

@joancab Thanks that's another great idea! When should I stop the counter?