# Loops inside property block

**URL:** <https://verificationacademy.com/forums/t/loops-inside-property-block/49921>\
**Category:** SystemVerilog\
**Tags:** SVA, SystemVerilog, assertion, Assertion-property\
**Created:** [March 24, 2025, 7:23am UTC](https://verificationacademy.com/forums/t/loops-inside-property-block/49921 "2025-03-24T07:23:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mallucrafter](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@mallucrafter](https://verificationacademy.com/forums/u/mallucrafter)\
**Post date:** [March 24, 2025, 7:23am UTC](https://verificationacademy.com/forums/t/loops-inside-property-block/49921/1 "2025-03-24T07:23:35Z")

</div>

i’m wondering may i can use loops inside a property block of assertion. below i have given a example. here i’m wondering instead of giving the same code with increasing index, may i can use foreach loop. does property support it?. what if i use a function inside the property and inside the function i have declared the foreach loop. does it work?

```auto
property pslverr_invalid_addr; 
  @(posedge PCLK) 
  disable iff (!PRESETn)
  ((PSEL[0] && PENABLE && PREADY && !(PADDR inside {[SLAVE_ADDR[0].start_addr:SLAVE_ADDR[0].end_addr]})) ||
   (PSEL[1] && PENABLE && PREADY && !(PADDR inside {[SLAVE_ADDR[1].start_addr:SLAVE_ADDR[1].end_addr]})) ||
   ((PSEL[2] && PENABLE && PREADY && !(PADDR inside {[SLAVE_ADDR[2].start_addr:SLAVE_ADDR[2].end_addr]}))) 
  |-> $rose(PSLVERR); //
endproperty

```

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [March 24, 2025, 6:14pm UTC](https://verificationacademy.com/forums/t/loops-inside-property-block/49921/2 "2025-03-24T18:14:04Z")

</div>

You can use a function as part of a Boolean expression, although there are a few restrictions. All the sample values need to be passed in as arguments to the function. The function cannot have any side-effect. See _16.6 Boolean expressions_ in the [IEEE 1800-2023 SystemVerilog LRM](https://ieeexplore.ieee.org/document/10458102)
