2014-11-16 41 views
1

我有comp_value,它的值在1 .. 100之間。 另外我有一個輸入變量period(範圍相同)。我需要覆蓋comp_values的兩個範圍:[1..period][period+1 .. 100]。就像這樣:Specman coverage:有沒有一種方法可以用變量定義範圍?

cover some_event_e is { 
     item period using no_collect; 
     item comp_val using no_collect, 
      ranges = { 
       range([1..period], "Smaller_than_period"); 
       range([period+1..100], "Bigger_than_period"); 
      }; 
    }; 

(該代碼導致編譯錯誤,因爲沒有變量可以寫入範圍內)。 有沒有辦法收集報道? 謝謝你的幫助。

+0

這完全沒有意義。由於時間段會有所不同,您期望看到的範圍小於和大於期間的範圍? –

+1

對於大於和小於週期的comp_values,DUT有不同的邏輯。我需要驗證我已經檢查了兩種情況。 – Halona

+1

comp_value和period都是輸入 – Halona

回答

2

範圍必須保持不變。

但是,如果我理解正確的話你的意圖,你可以這樣定義

cover some_event_e is { 
    item smaller_or_equal_than_period: bool = (comp_val in [1..period]) using 
    ignore = (not smaller_or_equal_than_period); 
    item greater_than_period: bool = (comp_val in [(min(100,period+1)..100]) using 
    ignore = (not greater_than_period); 
}; 

假設期間新項目總是在[1..100]。

相關問題