# Discrepancy on legality of the consequent

**URL:** <https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168>\
**Category:** SystemVerilog\
**Tags:** SVA-Assertion, SVA, SystemVerilog, system-verilog-assertion-SVA\
**Created:** [April 27, 2024, 7:49pm UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168 "2024-04-27T19:49:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [April 27, 2024, 7:49pm UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/1 "2024-04-27T19:49:44Z")

</div>

Hi All,  
I was trying to model dynamic repeat using a user-defined sequence.  
Here is my attempt :: [lf\_edalink](https://www.edaplayground.com/x/aHvU)

LRM 16.12.22 Nondegeneracy states

```auto
Any sequence that is used as a property shall be nondegenerate and shall not admit any empty match.

```

I observe that one tool treats the consequent as illegal whereas as per my understanding the consequent is legal.  
Refer the right side ( design.sv ) in [lf\_edalink](https://www.edaplayground.com/x/aHvU) where I have noted my interpretation of the consequent

**[Q1] Just wanted to check with forum moderators if my understanding is correct**

I tried a simplified version of the consequent in [lf\_edalink2](https://www.edaplayground.com/x/t34S) where the output matches my understanding

---

<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:** [April 27, 2024, 8:23pm UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/2 "2024-04-27T20:23:24Z")

</div>

I sent this for the next 1800 version. Did you see it?  
SVA: 1800’2023 Degeneracy Issue to Hopefully be Addressed in 1800’2028  
When faced with degenerate sequences, 1800’2023 is unclear on what a simulator should do, particularly in situations resulting from parameter substitution that creates a degenerate sequence. In that situation, it would be undesirable to have to rewrite the code to get to a successful compilation. Existing tools differ in their interpretation of degenerate sequences - some report it as a degenerate situation, some issue a warning, and some proceed with the simulation.  
This linked document identifies the sections in the LRM that define degeneracy and highlights cases that pose challenges for users and tool vendors. Additionally, it proposes solutions for the next revision of the LRM.  
Ben, in collaboration with Ed Cerny

> **[LinkedIn: Log In or Sign Up](https://lnkd.in/gsvUBKav)**
>
> 1 billion members | Manage your professional identity. Build and engage with your professional network. Access knowledge, insights and opportunities.

---

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [April 28, 2024, 5:14am UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/3 "2024-04-28T05:14:10Z")

</div>

Ben,  
(1) I was referring to following quote from [Degeneracy\_1800\_2028.pdf](https://systemverilog.us/vf/Degeneracy_1800_2028.pdf)

```auto
5) Never be matched, no match can exist 
  (ii) a ##1 1’b0-- logically impossible- a followed by false

case (5.ii) is attributed to a false logical value resulting from parameter substitution. In both scenarios, if utilized in a property, they would lead to an unsatisfied property

```

I am not clear on **“attributed to a false logical value resulting from parameter substitution”**

I found a [thread](https://verificationacademy.com/forums/t/sequence-which-admits-no-match-v-s-hard-zero/43465) related to using **hard zero** in concurrent assertion where Dave commented

**“In the hard\_zero assertion, the `(0)` does not get evaluated until run-time”**

(2) In the original post the irony is that the same tool ( VCS ) that throws compilation error for [edalink](https://www.edaplayground.com/x/aHvU) treats ‘sva2’ in [edalink2](https://www.edaplayground.com/x/t34S) as legal.

**It seems like a tool issue/limitation as in both cases the consequent is equivalent to**  
`( 1'b0 ) or ( Non_Degenerate_Sequence )` i.e `( Non_Degenerate_Sequence )`

As consequent :: `( 1'b0 ) or ( Non_Degenerate_Sequence )` **doesn’t violate** the following LRM quote

> Any sequence that is used as a property shall be nondegenerate **and shall not admit any empty match.**

I am of the opinion that consequent is legal in [edalink](https://www.edaplayground.com/x/aHvU)

**Please correct me if I am wrong in my interpretation.**

---

<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:** [April 28, 2024, 6:26pm UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/4 "2024-04-28T18:26:41Z")

</div>

[YOU] I am not clear on “attributed to a false logical value resulting from parameter substitution”  
[Ben] Example or param substitution: [Edit code - EDA Playground](https://www.edaplayground.com/x/tK4i)

```auto
module m #(parameter K = 1) // parameter with default value

(input bit clk, a, b);

ap_impossible: assert property(@(posedge clk) a |-> b ##1 K);

endmodule

module top;

bit a=1, b=1, clk;

always #1 clk=!clk;

m #(0) m1 (.clk(clk), .a(a), .b(b)); // override parameter value

initial #100 $finish;

endmodule

```

[YOU] I found a [thread](https://verificationacademy.com/forums/t/sequence-which-admits-no-match-v-s-hard-zero/43465) related to using hard zero in concurrent assertion where Dave commented  
“In the hard\_zero assertion, the (0) does not get evaluated until run-time”

(2) In the original post the irony is that the same tool ( VCS ) that throws compilation error for [edalink](https://www.edaplayground.com/x/aHvU) treats ‘sva2’ in [edalink2](https://www.edaplayground.com/x/t34S) as legal.

It seems like a tool issue/limitation as in both cases the consequent is equivalent to  
( 1’b0 ) or ( Non\_Degenerate\_Sequence ) i.e ( Non\_Degenerate\_Sequence )

As consequent :: ( 1’b0 ) or ( Non\_Degenerate\_Sequence ) doesn’t violate the following LRM quote

Any sequence that is used as a property shall be nondegenerate and shall not admit any empty match.

I am of the opinion that consequent is legal in [edalink  
 ](https://www.edaplayground.com/x/aHvU) [Ben]  
1800 says a) Any sequence that is used as a property shall be nondegenerate and shall not admit any empty match.  
You are addressing case 3 in the pdf:  
Empty and non-empty matches  
a[\*0:1] – empty and a possible non-empty match  
It does admit an empty match.

This is why we wrote this potential change to 1800…

---

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [April 28, 2024, 8:50pm UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/5 "2024-04-28T20:50:33Z")

</div>

> [@user49](#):
>
> 1800 says a) Any sequence that is used as a property shall be nondegenerate and shall not admit any empty match.  
> You are addressing case 3 in the pdf:  
> Empty and non-empty matches  
> a[\*0:1] – empty and a possible non-empty match  
> It does admit an empty match.
> 
> This is why we wrote this potential change to 1800..

Ben ,  
There is a **difference between the following sequences when used as consequent**  
(1) a[\*0:1] // Admits ‘Empty match’ via a[\*0]  
(2) a[\*0:1] ##0 1 // Admits ‘No match’ ( 1’b0 ) via ( a[\*0] ##0 1 )

**(1) is illegal as it violates the LRM quote since the consequent admits empty match** via a[\*0]

**(2) is legal as consequent since it doesn’t violate the above LRM quote**

The same can be comfirmed in [edalink2](https://www.edaplayground.com/x/t34S) **where ‘sva1’ is illegal and ‘sva2’ is legal**

**In my original post the consequent in** [edalink](https://www.edaplayground.com/x/aHvU) **resembles (2) and not (1)**

VCS treats ‘sva2’ in [eda2](https://www.edaplayground.com/x/t34S) legal whereas it treats consequent in [eda](https://www.edaplayground.com/x/aHvU) as illegal

**In both cases a sub-sequence in the consequent is ( empty\_seq ##0 seq )**  
**i.e it admits ‘No match’ ( 1’b0 )**

Hence I believe the compilation error observed in [edalink](https://www.edaplayground.com/x/aHvU) **is a tool limitation/issue** as the **consequent doesn’t admit any empty match.**

---

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [May 1, 2024, 9:26am UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/6 "2024-05-01T09:26:15Z")

</div>

I found a related example on Pg 41 in [empty.pdf](http://systemverilog.us/empty.pdf) shared in [empty-sequence-in-systemverilog](https://verificationacademy.com/forums/t/empty-sequence-in-systemverilog/32096)

```auto
a |-> b[*0:1] ##0 c; // is equivalent to  
a |-> (b[*0] ##0 c) or (b[*1] ##0 c); // is equivalent to 
a |-> 0 or (b[*1] ##0 c); // is equivalent to 
a |-> b[*1] ##0 c; 

```

**The above consequent is considered legal ( although a sub-seq. admits “No match” )** as it ::  
(1) **Doesn’t admit any** empty match  
(2) **Admits non-empty** match

**On the same note, sub-sequence** `((count == 0) ##0 (seq[*0] ##0 seq3))` in [edalink](https://www.edaplayground.com/x/aHvU)  
is equivalent to `( seq_expr ##0 (1'b0) )` i.e **“No Match” ( 1’b0 )**

---

<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:** [May 1, 2024, 7:15pm UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/7 "2024-05-01T19:15:10Z")

</div>

> [@Have\_A\_Doubt](#):
>
> `(b[*0] ##0 c)`

(b[\*0] ##0 c) // is (empty ##0 c) and that is degenerate  
// it is not (0 ##0 c). We talked about degeneracy rues  
(count == 0) is legal and can evaluate to true or false depending on the value of count. That is different than  
a |-\> 0 ##1 1; // it is degenrate by construction

---

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [May 4, 2024, 5:45pm UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/8 "2024-05-04T17:45:57Z")

</div>

Ben,  
As you mentioned in your 1st reply

> When faced with degenerate sequences, **1800’2023 is unclear on what a simulator should do**

Since we are not supposed to discuss tool related issues, I am curious to know  
**From a strict LRM perspective is the consequent sequence ‘abd\_dynamic\_repeat’ in [edalink](https://www.edaplayground.com/x/aHvU) legal ?**

As per my understanding it doesn’t violate the following LRM quote

```auto
1800 says a) Any sequence that is used as a property shall be nondegenerate and shall not admit any empty match.

```

The consequent is essentially :: `sub_seq1 or sub_seq2`

Sub-sequence1 `( (count == 0) ##0 ( seq[*0] ##0 seq3 ) )` is equivalent to  
`seq_expr1 ##0( empty_seq ##0 seq_expr2 )` i.e `seq_expr1 ##0 ( 1'b0 )`

Hence sub-sequence1 admits **“No Match”**  
The other **Sub-sequence2 admits only non-empty match**

Consequent Is same as :: `( 1'b0 ) or ( sub_seq2 )` i.e `sub_seq2`

---

<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:** [May 5, 2024, 8:50pm UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/9 "2024-05-05T20:50:31Z")

</div>

```auto

(a[*0] ##0 b) // degenerate

or c;

```

Is not degenerate because it does admit a non empty match “c”.

And it does not admit empty matches. Hence it is OK as a property. Equivalent to just a “c”.

Q: What is the meaning of “admit”?

A: That is can accept or match a certain sequence.

---

<div class="post-metadata">

**Author:** ![Have\_A\_Doubt](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Have\_A\_Doubt](https://verificationacademy.com/forums/u/Have_A_Doubt)\
**Post date:** [May 6, 2024, 9:07am UTC](https://verificationacademy.com/forums/t/discrepancy-on-legality-of-the-consequent/47168/10 "2024-05-06T09:07:23Z")

</div>

So to conclude the thread

- The consequent sequence in [edalink](https://www.edaplayground.com/x/aHvU) is nondegenerate and it doesn’t admit any empty match. Hence it’s legal.

- The compilation error thrown by one of the tool is incorrect
