Ana içeriğe geç

SystemVerilog Assertions: Same Cycle ve Next Cycle İmplication

· loading · loading · ·
Kerim Turak
Eğitim SystemVerilog Doğrulama SystemVerilog Assertion Verification Same Cycle Implication Next Cycle Implication Assertion Overlapping Fonksiyonlar
Eğitim SystemVerilog Doğrulama
Yazar
Kerim Turak
Digital IC Design & Verification Engineer
Table of Contents
SystemVerilog Tasarım Serisi - This article is part of a series.
Part 35: This Article

🔗 Same Cycle ve Next Cycle Implication
#

SystemVerilog assertionlarda implication operatörleri ile koşuldan sonuca giden temporal ifadeler tanımlanır:

✅ Same Cycle Implication (|->)
#

  • Sağ tarafın, sol tarafla aynı cycle’da veya tek bir clock kenarında true olması gerekir.
  • Basitçe “Koşul ve sonuç aynı clock kenarında gerçekleşmeli” demektir.

Örnek:

assert property (@(posedge clk) (a && b) |-> (x && y));

Bu örnekte:

  • a && b aynı cycle’da x && y ile eşzamanlı gerçekleşmelidir.

✅ Next Cycle Implication (|=>)
#

  • Sağ tarafın, sol taraf gerçekleştiği bir sonraki cycle’da true olması gerekir.
  • Yani sağ taraf 1 cycle sonra test edilir.

Örnek:

assert property (@(posedge clk) (a && b) |=> (x && y));

Bu örnekte:

  • a && b bir cycle’da gerçekleşirse, x && y bir sonraki cycle’da beklenir.

🔁 Assertion Overlapping
#

Assertions yazarken temporal ifadeler (örneğin ##, |->) ardışık clock cycle’lara yayılır. Overlapping kullanarak birden fazla assertion aynı anda aktif olabilir. Örneğin:

assert property (@(posedge clk) (a ##1 b ##1 c));

Burada:

  • a aktifken assertion başlar,
  • Bir cycle sonra b kontrol edilir,
  • Bir cycle sonra c kontrol edilir.
  • Bu assertion her clock cycle’ında yeniden başlatılabilir ve overlap eder.

⚡ Faydalı Fonksiyonlar
#

SVA, assertionlarda kullanılabilen birçok faydalı fonksiyon sunar. İşte en yaygın olanlar:

$rose ve $fell
#

  • $rose(signal): Bir sinyalin 0’dan 1’e geçişini yakalar.
  • $fell(signal): Bir sinyalin 1’den 0’a düşüşünü yakalar.

Örnek:

assert property (@(posedge clk) $rose(req) |-> ack);

Bu, req sinyalinin yükselen kenarında ack’in kontrol edilmesini sağlar.


$past
#

  • $past(expression, N): N cycle önceki ifade değerini getirir (varsayılan N=1).
  • Reset kontrolleri ile kullanılabilir.

Örnek:

assert property (@(posedge clk) (reset == 0) |-> (data == $past(data)));

Bu, reset olmadığında data’nın stabil olup olmadığını kontrol eder.


$stable()
#

  • $stable(signal): Sinyalin aynı clock cycle boyunca değişmediğini test eder.
  • Glitch kontrolü için idealdir.

Örnek:

assert property (@(posedge clk) $stable(data));

$countones()
#

  • $countones(vector): Bir vektördeki bitlerden kaç tanesinin 1 olduğunu döndürür.
  • Popcount uygulamaları için kullanılabilir.

Örnek:

assert property (@(posedge clk) ($countones(control_bus) <= 1));

Bu, bus’ta aynı anda en fazla 1 bitin aktif olmasını kontrol eder.


$isunknown()
#

  • $isunknown(signal): Bir sinyalin X veya Z (bilinmeyen) olup olmadığını kontrol eder.

Örnek:

assert property (@(posedge clk) !$isunknown(data));

$onehot() ve $onehot0()
#

  • $onehot(vector): Vektörde yalnızca bir bitin 1 olduğunu kontrol eder.
  • $onehot0(vector): Vektörde yalnızca bir bitin 1 veya hepsinin 0 olduğunu kontrol eder.

Örnek:

assert property (@(posedge clk) $onehot(state));

Bu, FSM state kontrolünde yaygın olarak kullanılır.


SystemVerilog Tasarım Serisi - This article is part of a series.
Part 35: This Article

Related

Immediate Assertion
· loading · loading
Kerim Turak
Eğitim SystemVerilog Doğrulama SystemVerilog Assertion Verification Immediate Assertion Deferred Immediate Assertion Doğrulama
Eğitim SystemVerilog Doğrulama
SystemVerilog Assertionlar: Delay, Repetition ve Status
· loading · loading
Kerim Turak
Eğitim SystemVerilog Doğrulama SystemVerilog Assertion Verification Repetition Delay Overlap Go-to Repetition Assertion Status
Eğitim SystemVerilog Doğrulama
SystemVerilog Sequence, Sequence Implication ve Kullanımı
· loading · loading
Kerim Turak
Eğitim SystemVerilog Doğrulama SystemVerilog Assertion Verification Sequence Sequence Implication Overlapping Non-Overlapping Conditional Property Never Property $Rose $Fell Disable Iff
Eğitim SystemVerilog Doğrulama
SystemVerilog'da Boolean İfadeler ve Assertion Kullanımı
· loading · loading
Kerim Turak
Eğitim SystemVerilog Doğrulama SystemVerilog Assertion Verification Doğrulama
Eğitim SystemVerilog Doğrulama
SystemVerilog Assertion (SVA) Nedir ve Neden Kullanılır?
· loading · loading
Kerim Turak
Eğitim SystemVerilog Doğrulama SystemVerilog Assertion Doğrulama Formal Verification Concurrent Assertion Immediate Assertion SVA
Eğitim SystemVerilog Doğrulama
SystemVerilog'da Nesne Yönelimli Programlama
· loading · loading
Kerim Turak
Eğitim Doğrulama SystemVerilog SystemVerilog OOP Nesne Yönelimli Programlama Verification Sınıflar
Eğitim Doğrulama SystemVerilog