Languages
I want to measure the frequency of a clock signal in my testbench. I used the 'meas_freq'
primitive as shown below, but it outputs 2GHz instead of the expected value of 1GHz. Why does the 'meas_freq'
primitive produce twice the clock frequency value?
The 'meas_freq'
primitive measures the frequency of the triggering events, of which time instants are indicated by both the positive and negative edges of the trigger input signal. This is why you get the output of 2GHz when you directly feed a 1GHz clock signal as the 'trig'
input of the 'meas_freq'
primitive. The primitive is counting both the positive and negative edges.
The correct usage of the 'meas_freq'
primitive is shown below. A 'trig_posedge'
primitive is inserted between the clock signal 'clk'
and the 'trig'
input of the 'meas_freq'
primitive. The 'trig_posedge'
primitive generates a triggering event (i.e. toggling the trigger signal 'trig'
) whenever 'clk'
has a positive edge.
In general, 'meas_*'
primitives are used in combination with 'trig_*'
primitives. The 'meas_*'
primitives specify what to measure, whereas the 'trig_*'
primitives specify when to make the measurements. For more information, please refer to this application note titled "Measurement Primitives of XMODEL".
An alternative way to measure the frequency of a clock is to use the 'clk_to_freq'
primitive as shown below. This primitive takes an xbit-type clock input and produces an xreal-type frequency output. In comparison, the 'meas_freq'
primitive takes an xbit-type trigger input indicating the occurrence time of the event of interest and produces a real-type frequency output.
Please login or Register to submit your answer
테스트벤치에서 클록신호의 주파수를 측정하고 싶습니다. 아래 그림처럼 'meas_freq'
primitive를 사용해보았지만, 그 출력값은 예상한 1GHz가 아닌 2GHz가 나옵니다. 왜 'meas_freq'
primitive는 클록주파수의 두배 값을 출력하나요?
The 'meas_freq'
primitive measures the frequency of the triggering events, of which time instants are indicated by both the positive and negative edges of the trigger input signal. This is why you get the output of 2GHz when you directly feed a 1GHz clock signal as the 'trig'
input of the 'meas_freq'
primitive. The primitive is counting both the positive and negative edges.
The correct usage of the 'meas_freq'
primitive is shown below. A 'trig_posedge'
primitive is inserted between the clock signal 'clk'
and the 'trig'
input of the 'meas_freq'
primitive. The 'trig_posedge'
primitive generates a triggering event (i.e. toggling the trigger signal 'trig'
) whenever 'clk'
has a positive edge.
In general, 'meas_*'
primitives are used in combination with 'trig_*'
primitives. The 'meas_*'
primitives specify what to measure, whereas the 'trig_*'
primitives specify when to make the measurements. For more information, please refer to this application note titled "Measurement Primitives of XMODEL".
An alternative way to measure the frequency of a clock is to use the 'clk_to_freq'
primitive as shown below. This primitive takes an xbit-type clock input and produces an xreal-type frequency output. In comparison, the 'meas_freq'
primitive takes an xbit-type trigger input indicating the occurrence time of the event of interest and produces a real-type frequency output.
Please login or Register to submit your answer