Finite time FSM .Assertion

In reply to Timus:


/* The requirements are not clear. After rereading a few times, I think thta this is what you mean: 
   You have these objects: 
     typedef enum {ABS, BBS, XYZ} st_e;
     st_e state; 
     bit clk, ack;
   1) Upon a rose of state into ABS, state remains in that state until one of 2 conditions occur: 
       a) ack == 1
       b) a timeout of 100 clock cycles 
       If condition "a" or "b" occurs, state transitions to BBS
   */
module m;  
    typedef enum {ABS, BBS, XYZ} st_e;
    st_e state; 
    bit clk, ack;
    // Conditions for state to go into BBS with the ack 
    ap_ABS2BBS: assert property(@ (posedge clk) 
        first_match($rose(state==ABS) ##1 state==ABS[*1:99] ##0 ack) |-> state==BBS);  
    
    // Conditions for state to go into BBS without the ack 
    ap_ABS_till_BBS: assert property(@ (posedge clk) 
        $rose(state==ABS) |-> ##1 state==ABS[*1:99] ##0 state==BBS);  
endmodule

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/