2017-05-11 20 views
0

아래는 현재 내가 사용하는 재산입니다.+/- 허용 오차가있는 시계의 주파수를 확인하는 가장 좋은 방법은 무엇입니까?

property freq_chk (time clk_period , bit disable_chk=0); 
    time current_time; 
    disable iff (disable_chk) 
    ('1, current_time = $time) |=> 
    ((($time - current_time) >= (clk_period-1)) && 
    (($time - current_time) <= (clk_period+1))); 
endproperty : freq_chk 

여기서 우리는 클록주기의 허용 한계를 +/- 1로 간주합니다. 허용 오차 비율을 통과시키고 그에 따라 주파수를 검사하는 가장 좋은 방법은 무엇입니까?

I (이것은 단지 내가보고있는 무슨의 데모 작동하지 않습니다.) 아래와 같은 뭔가를 찾고

property freq_chk_with_tol (time clk_period , bit disable_chk=0, int tolerance=0); 
    time current_time; 
    disable iff (disable_chk) 
    ('1, current_time = $time) |=> 
    ((($time - current_time) >= ((clk_period * (1 - (tolerance/100))) - 1)) && 
    (($time - current_time) <= ((clk_period * (1 + (tolerance/100))) + 1))); 
endproperty : freq_chk_with_tol 

클럭의 주파수를 확인하는 가장 좋은 방법 일 것입니다 무슨 +/- 허용 오차가 있습니까?

+2

오타의 제목을 확인하고 싶을 수도 있습니다 ... –

+3

네, 그거야. – Bathsheba

+0

감사합니다. 수정 됨 : –

답변

0

Greg가 제안했듯이 정수 값을 변경하면 트릭이 나에게 도움이됩니다.

다음은 작동 코드입니다.

property freq_chk_tol (time clk_period , bit disable_chk=0, real tolerance=0.00); 
    time current_time; 
    disable iff (disable_chk) 
    ('1, current_time = $time) |=> 
    ((($time - current_time) >= ((clk_period * (1 - (tolerance/100.00))) - 1)) && 
    (($time - current_time) <= ((clk_period * (1 + (tolerance/100.00))) + 1))); 
endproperty : freq_chk_tol 
0

어설 션을 사용하는 이유는 무엇입니까? 행동 코드를 사용하는 것이 더 쉽지 않을까요?

time clk_margin = <set it to whatever value you need>; // calculate it once, don't calculate on the fly 
time last_clk_tick; 
always_ff @(posedge clk) begin 
    assert (abs($time - last_clk_tick) < clk_margin); // abs() is a user function return the absolute value 
    last_clk_tick = $time; 
end 
+0

개인적으로 나는 속성 주장 (property-assertion) 방법을 사용하면 여러 클럭에 대해 동일한 코드를 재사용하는 것이 쉬우 며 기능적 범위 추적을 쉽게 수행 할 수 있다고 생각합니다. –