# \#associative-array-inline-constraint

**URL:** https://verificationacademy.com/forums/tag/associative-array-inline-constraint/4396.md

[Latest](https://verificationacademy.com/forums/latest.md) · [Categories](https://verificationacademy.com/forums/categories.md) · [Tags](https://verificationacademy.com/forums/tags.md)

---

## [Constraint a random array](https://verificationacademy.com/forums/t/constraint-a-random-array/35112)

<div class="topic-metadata">

**Author:** [@manav33](https://verificationacademy.com/forums/u/manav33)\
**Replies:** 5\
**Last updated:** [October 2, 2018, 2:50pm UTC](https://verificationacademy.com/forums/t/constraint-a-random-array/35112 "2018-10-02T14:50:13Z")

</div>

Hi , Can some one help in writing a constrain for \[7:0\]byte\_array\[32\] . The constraint is each byte in next consecutive location should not change by more then 4 bits. I am not able to write this cleanly without using f…

---

## [Not able to constraint the size of the associative array in inline constraint](https://verificationacademy.com/forums/t/not-able-to-constraint-the-size-of-the-associative-array-in-inline-constraint/29102)

<div class="topic-metadata">

**Author:** [@saravanantvs](https://verificationacademy.com/forums/u/saravanantvs)\
**Replies:** 1\
**Last updated:** [January 23, 2014, 5:15pm UTC](https://verificationacademy.com/forums/t/not-able-to-constraint-the-size-of-the-associative-array-in-inline-constraint/29102 "2014-01-23T17:15:00Z")

</div>

2 module tb; 3 4 class example; 5 rand int ass\_arry\[int\]; 6 endclass 7 8 example obj = new; 9 initial begin 10 assert(obj.randomize() with { ass\_arry.size() == 2; }); 11 $display(“size ass\_arry.size : %d \\n”, ob…
