# Range issue in systemverilog property

**URL:** <https://verificationacademy.com/forums/t/range-issue-in-systemverilog-property/29713>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, system-verilog-assertion-SVA, sequence-control, range, property\
**Created:** [July 16, 2014, 9:06am UTC](https://verificationacademy.com/forums/t/range-issue-in-systemverilog-property/29713 "2014-07-16T09:06:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mustafa](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/f19dbf/32.png) [@Mustafa](https://verificationacademy.com/forums/u/Mustafa)\
**Post date:** [July 16, 2014, 9:06am UTC](https://verificationacademy.com/forums/t/range-issue-in-systemverilog-property/29713/1 "2014-07-16T09:06:42Z")

</div>

Hello,  
I’ve a property that is needed to be asserted(located in an interface):

```verilog

property p1; //When a Tx complete interrupt is asserted, assert phy_ce is dropped after ble_tx_phy_ce_dly bits
      @(posedge ble_clk) disable iff(!ble_rst_n || !ble_ena)
	ble_irq_sts[0] |-> ##(int'(ble_tx_phy_ce_dly*(ble_div+1))) !phy_ce;
   endproperty

```

I get this compilation errors:

- \*\* Error: Range must be bounded by constant expressions
- \*\* Error: Left bound of SVA range expression does not evaluate to a constant or parametric value.
- \*\* Error: Right bound of SVA range expression does not evaluate to a constant or parametric value.

the delay and clk division ratio are transaction ranadom values  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![Mustafa](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/f19dbf/32.png) [@Mustafa](https://verificationacademy.com/forums/u/Mustafa)\
**Post date:** [July 16, 2014, 10:19am UTC](https://verificationacademy.com/forums/t/range-issue-in-systemverilog-property/29713/2 "2014-07-16T10:19:28Z")

</div>

_In reply to [Dilip Bagadi](https://verificationacademy.com/forums/t/range-issue-in-systemverilog-property/29713):_

Hi Dilip,  
Thanks for response, but there something I don’t understand  
It’s my first time to see the expression before and after the implication:  
1- req\_delay=delay+1’b1, this an initialization to the delay to the desired value, correct ?  
So it can be req\_delay = ble\_tx\_phy\_ce\_dly\*(ble\_div+1)

2- What follows the implication (till the CONSEQUENT) is confusing a bit, could you please clarify more or use a simpler example ?

Thank you for cooperation.

---

<div class="post-metadata">

**Author:** ![Dilip\_Bagadi](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dilip_bagadi/32/2350_2.png) [@Dilip\_Bagadi](https://verificationacademy.com/forums/u/Dilip_Bagadi)\
**Post date:** [July 16, 2014, 10:29am UTC](https://verificationacademy.com/forums/t/range-issue-in-systemverilog-property/29713/3 "2014-07-16T10:29:59Z")

</div>

_In reply to [Mustafa](https://verificationacademy.com/forums/t/range-issue-in-systemverilog-property/29713/2):_

Hi,

The delay inside property should be a CONSTANT VALUE or a PARAMETER.  
But an alternate is there to specify a variable in delay.

Pls follow the example below in your case to specify VARIABLE DELAY in a property  
(ANTECEDENT, req\_delay=delay+1’b1) |-\> (1, req\_delay=req\_delay-1’b1)[\*0:$] ##1 req\_delay==0 ##0 CONSEQUENT;

Regards,  
Dilip

---

<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:** [July 25, 2014, 5:26pm UTC](https://verificationacademy.com/forums/t/range-issue-in-systemverilog-property/29713/4 "2014-07-25T17:26:09Z")

</div>

You need to do something like the following, basically setting a local variable to the desired delay, and then do a repeat while decrementing the counter until the value is 0.

```auto
module range1;
	int ble_tx_phy_ce_dly, ble_div;
	bit[15:0] ble_irq_sts; 
	bit ble_clk, phy_ce, ble_rst_n, ble_ena ;
	
	/* property p1; //When a Tx complete interrupt is asserted, assert phy_ce is dropped after ble_tx_phy_ce_dly bits
		@(posedge ble_clk) disable iff(!ble_rst_n || !ble_ena)
			ble_irq_sts[0] |-> ##(int'(ble_tx_phy_ce_dly*(ble_div+1))) !phy_ce;
	endproperty */ 
	
    // assume that (int'(ble_tx_phy_ce_dly*(ble_div+1'b1))) is of value 1 or greater
	property p1; //When a Tx complete interrupt is asserted, assert phy_ce is dropped after ble_tx_phy_ce_dly bits
	  int v; 
          @(posedge ble_clk) disable iff(!ble_rst_n || !ble_ena)
	   (ble_irq_sts[0], v= (int'(ble_tx_phy_ce_dly*(ble_div+1'b1)))) |=> 
		(1, v=v-1'b1)[*1:$] ##0 v<= 0 ##0 !phy_ce;
        endproperty

        assert property(p1); 
endmodule

```

* * *

Ben Cohen  
[http://www.systemverilog.us/](http://www.systemverilog.us/) [ben@systemverilog.us](mailto:ben@systemverilog.us)

- A Pragmatic Approach to VMM Adoption 2006 ISBN 0-9705394-9-5
- SystemVerilog Assertions Handbook 3rd Edition, 2013 ISBN 878-0-9705394-3-6
- 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 0-9705394-2-8
- 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

* * *
