# Assertion checker for interface protocol

**URL:** <https://verificationacademy.com/forums/t/assertion-checker-for-interface-protocol/33475>\
**Category:** UVM\
**Tags:** UVM\
**Created:** [September 11, 2017, 6:38pm UTC](https://verificationacademy.com/forums/t/assertion-checker-for-interface-protocol/33475 "2017-09-11T18:38:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmorris](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/bmorris/32/2097_2.png) [@bmorris](https://verificationacademy.com/forums/u/bmorris)\
**Post date:** [September 11, 2017, 6:38pm UTC](https://verificationacademy.com/forums/t/assertion-checker-for-interface-protocol/33475/1 "2017-09-11T18:38:43Z")

</div>

![](https://lh3.googleusercontent.com/AZwu0Fyico15zKrVhvKYZIy6NcHaiwaImP26knaYtr3hJma4WtmfUchA3gKzA9AoXCrBZCLB7exuUPFPUodyIku2LrWI2mNVjacalYn8aP3sCM5TSoCejlKrsYDRrXO65CNVHotuRpS21UMmnKLzvSVKWecI028NJJP5hw5aC5uQ-6vKUPKEItviRcV8IS5zx0SbR-x2Na8LHKMa6ZSNPrS_p-sfRdFB3huRtTE-AXU77F3FCdThWGA4CvM7P-__JdfZuOXYC09BU_RooGdBIIgS-oSGXN5QH46E59yHJc8g2kEmi82AZXA3FYEl_v78nRopqLoXWKpff-FmIKxSHifah2KIn-LiqnwpiLUn2Ha1h9exipAhY1UyJf1JMrKzImKKATSULCVk4jVPRyC46hJ9mk-BZdwu_rvbubqJKGj6X2HE8zFTzE9OkPXGV0neN63_JdU6KIN5jrrjRGQvEkZL8hZimTijKoylJbFJy1iknfEQrrB6viNNmp0TRFsGXtY7ev4wLdR0WgwNWBxrUQ2HBo4Jh2n7PvV0abfMo86gT3ybCRWHt5kTWPy7HfsAzfNgrit0iwUgnz03GqwB_exJSkqeULCaBYvMQySn-yUFZnv9q2UC=w686-h667-no)

Depending on other signals (not shown) you can have the following relationships between CSEL and ACK.

1. CSEL , ACK immediately asserts. Fine
2. CSEL , ACK will assert some cycles later.
3. Back to back transactions, all valid.

My main issue is identifying a “unique” antecedent. In scenario 2, how do I cause the first attempt to fire, but prevent the following 2 from occurring. Is there some way to “lock-out” the assertion until it completes? There is no pipelining on this bus.

csel |-\> (ack==0)[\*0:10] ##1 ack ; // not unique, fails scenario 2  
$rose(csel) |-\> (ack==0)[\*0:10] ##1 ack ; // unique, but fails scenario 3 (only catches the 1st instance)

---

<div class="post-metadata">

**Author:** ![user49](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/user49/32/4533_2.png) [@user49](https://verificationacademy.com/forums/u/user49)\
**Post date:** [September 11, 2017, 10:17pm UTC](https://verificationacademy.com/forums/t/assertion-checker-for-interface-protocol/33475/2 "2017-09-11T22:17:00Z")

</div>

_In reply to [bmorris](https://verificationacademy.com/forums/t/assertion-checker-for-interface-protocol/33475):_

> Is there some way to “lock-out” the assertion until it completes?

- In the antecedent test for an entry gate, a module variable
- If successful entry, lock that gate.
- If pass or fail, release the gate

Below is an example that I had before. It uses the sequence-match-item and function call. Upon pass or fail, that action item is used.

```verilog

module thruout2;// /ch10/10.27/thruout2.sv
  bit clk, sof, eof;
  bit busy_sof;
  default clocking @(posedge clk); endclocking
  function void setval4busy(bit d);
   busy_sof=d;
  endfunction
  // This is not catching multiple sof's and one eof within valid.
  // It should check that for one sof, there should be only one eof.
  ap_sof_eof: assert property
   // Once antecedent fires, no other one will fire again 
   ((sof && busy_sof==1'b0, setval4busy(1'b1)) |-> 
    ##[1:5] (eof)) setval4busy(1'b0); // reset flag if property is true
                   else setval4busy(1'b0); // reset flag if property is false 
    
  ap_neversof_when_busy: assert property(not(sof && busy_sof));
endmodule 
 

```

Ben Cohen  
[http://www.systemverilog.us/](http://www.systemverilog.us/) [ben@systemverilog.us](mailto:ben@systemverilog.us)  
For training, consulting, services: contact [Home - My cvcblr](http://cvcblr.com/home)

- [SVA Handbook 4th Edition, 2016 ISBN 978-1518681448](http://goo.gl/JOfuEB)
- A Pragmatic Approach to VMM Adoption 2006 ISBN 0-9705394-9-5
- Using PSL/SUGAR for Formal and Dynamic Verification 2nd Edition, 2004, ISBN 0-9705394-6-0
- [Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn 978-1539769712](https://goo.gl/d10QHh)
- Component Design by Example ", 2001 ISBN 0-9705394-0-1
- VHDL Coding Styles and Methodologies, 2nd Edition, 1999 ISBN 0-7923-8474-1
- VHDL Answers to Frequently Asked Questions, 2nd Edition ISBN 0-7923-8115

* * *

---

<div class="post-metadata">

**Author:** ![user49](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/user49/32/4533_2.png) [@user49](https://verificationacademy.com/forums/u/user49)\
**Post date:** [September 12, 2017, 7:18pm UTC](https://verificationacademy.com/forums/t/assertion-checker-for-interface-protocol/33475/3 "2017-09-12T19:18:57Z")

</div>

The solution above is more of a lockout of other assertions until the current one completes.  
It uses a semaphore. If this is what you want, you may want to add another assertion that states that no other valid potential assertions occur during this lockout.

Another topic of uniqueness is that each thread s unique, and the ending of one thread does not complete other current threads. I address that at:  
[https://verificationacademy.com/forums/systemverilog/assertion-expected-data-check/review-users-question](https://verificationacademy.com/forums/systemverilog/assertion-expected-data-check/review-users-question)

Uniqueness This is exclusivity or uniqueness of each attempted thread sequences).I explain this issue in my SVA Handbook 4th Edition, I also addressed that topic at [counting number of events on clock a, while clock o is forbidden | Verification Academy](https://verificationacademy.com/forums/systemverilog/counting-number-events-clock-while-clock-o-forbidden)  
Hint: use the module variables int ticket, now\_serving;

Ben Cohen  
[http://www.systemverilog.us/](http://www.systemverilog.us/) [ben@systemverilog.us](mailto:ben@systemverilog.us)  
For training, consulting, services: contact [Home - My cvcblr](http://cvcblr.com/home)

- [SVA Handbook 4th Edition, 2016 ISBN 978-1518681448](http://goo.gl/JOfuEB)
- A Pragmatic Approach to VMM Adoption 2006 ISBN 0-9705394-9-5
- Using PSL/SUGAR for Formal and Dynamic Verification 2nd Edition, 2004, ISBN 0-9705394-6-0
- [Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn 978-1539769712](https://goo.gl/d10QHh)
- Component Design by Example ", 2001 ISBN 0-9705394-0-1
- VHDL Coding Styles and Methodologies, 2nd Edition, 1999 ISBN 0-7923-8474-1
- VHDL Answers to Frequently Asked Questions, 2nd Edition ISBN 0-7923-8115

* * *
