Assertion for non-overlap sequence detector

In reply to ben@SystemVerilog.us:

A much much easier solution for the detection of a sync pattern in a stream:


    bit[15:0] sync=16'b1101110100001101, log; 

    always_ff @(posedge clk or negedge rst_n) begin
      if(!rst_n) log=0; 
      else log<= {a, log[14:0]}; 
      a_sync: assert(log[15:8]==sync[15:8]  && log[7:4]!=1101 && log[3:0] == sync[3:0])
               detected = 1; else detected=0; 
    end

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448

  1. SVA Package: Dynamic and range delays and repeats SVA: Package for dynamic and range delays and repeats | Verification Academy
  2. Free books: Component Design by Example FREE BOOK: Component Design by Example … A Step-by-Step Process Using VHDL with UART as Vehicle | Verification Academy
    Real Chip Design and Verification Using Verilog and VHDL($3) https://rb.gy/cwy7nb
  3. Papers:

Udemy courses by Srinivasan Venkataramanan (http://cvcblr.com/home.html)
https://www.udemy.com/course/sva-basic/
https://www.udemy.com/course/sv-pre-uvm/