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

How to measure a clock frequency using ILA?

Jump to solution

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?

0 Kudos
1 Solution

Accepted Solutions
joancab
Advisor
Advisor
505 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.

View solution in original post

8 Replies
anunesgu
Moderator
Moderator
515 Views
Registered: ‎02-09-2017

Hi @nadaumtimuj,

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.
-------------------------------------------------------------------------
bruce_karaffa
Scholar
Scholar
506 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.

joancab
Advisor
Advisor
506 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.

View solution in original post

nadaumtimuj
Adventurer
Adventurer
481 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:

Capture.JPG

 

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

 

0 Kudos
nadaumtimuj
Adventurer
Adventurer
481 Views
Registered: ‎01-29-2021

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

0 Kudos
nadaumtimuj
Adventurer
Adventurer
481 Views
Registered: ‎01-29-2021

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

0 Kudos
joancab
Advisor
Advisor
468 Views
Registered: ‎05-11-2015

If you divide the original clock by N and N is large enough (it defines the accuracy), one period is fine (first edge starts, second stops). A simple state machine will do. The output count can go to an ILA to get the value. You could refine the state machine to measure, pause and repeat so you get a continuous measurement.

bitjockey
Adventurer
Adventurer
201 Views
Registered: ‎03-21-2011

ASYNC_REG tells synth to put the two FFs as close together as possible because you're doing a metastable clock crossing.  It maximizes MTBF of the crossing to hopefully keep it on the order of the heat death of the universe, or at least a few thousand years.

0 Kudos