# \#constrained-random-generation

**URL:** https://verificationacademy.com/forums/tag/constrained-random-generation/5922.md

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

---

## [Generating random values in increasing order](https://verificationacademy.com/forums/t/generating-random-values-in-increasing-order/32600)

<div class="topic-metadata">

**Author:** [@Bhaskar44](https://verificationacademy.com/forums/u/Bhaskar44)\
**Replies:** 16\
**Last updated:** [June 27, 2022, 4:50am UTC](https://verificationacademy.com/forums/t/generating-random-values-in-increasing-order/32600 "2022-06-27T04:50:07Z")

</div>

I was working on an academic project and designing a memory controller. The input to the controller is a file of CPU requests with 3 field, namely, address, operation(Read/write) and Arrival time. I was trying to genera…

---

## [Foreach usage in randomization constraints](https://verificationacademy.com/forums/t/foreach-usage-in-randomization-constraints/34510)

<div class="topic-metadata">

**Author:** [@peterjin](https://verificationacademy.com/forums/u/peterjin)\
**Replies:** 12\
**Last updated:** [November 7, 2021, 10:03pm UTC](https://verificationacademy.com/forums/t/foreach-usage-in-randomization-constraints/34510 "2021-11-07T22:03:12Z")

</div>

Hi, I tried to generate the bath-tub curve distribution using the constraint posted on this verification academy page but got run-time error from the constraint used in it. Here is the constraint used in the page int …

---

## [Constraint in a 2d pixel matrix](https://verificationacademy.com/forums/t/constraint-in-a-2d-pixel-matrix/36235)

<div class="topic-metadata">

**Author:** [@sparsh.gupta](https://verificationacademy.com/forums/u/sparsh.gupta)\
**Replies:** 4\
**Last updated:** [February 8, 2021, 3:53pm UTC](https://verificationacademy.com/forums/t/constraint-in-a-2d-pixel-matrix/36235 "2021-02-08T15:53:49Z")

</div>

Let’s assume there’s a 2d pixel matrix 1920 x 1080 in size. I want to constrain the matrix such that in the neighborhood of an off pixel(0) there are only ON pixels(1-255). The pattern should be something like this, for …

---

## [How to generate a pattern 110011001100 using constraint](https://verificationacademy.com/forums/t/how-to-generate-a-pattern-110011001100-using-constraint/34048)

<div class="topic-metadata">

**Author:** [@ahota](https://verificationacademy.com/forums/u/ahota)\
**Replies:** 5\
**Last updated:** [April 23, 2020, 9:22pm UTC](https://verificationacademy.com/forums/t/how-to-generate-a-pattern-110011001100-using-constraint/34048 "2020-04-23T21:22:01Z")

</div>

I am using this piece of code ,but its not happening. class packet; bit pattern\[$\]; byte a; constraint c1 { foreach (a\[i\]) if(i % 2 == 0) pattern.push\_back(00); else pattern.push\_back(11); } endclass module t…

---

## [How to verify FSM for Pattern detection](https://verificationacademy.com/forums/t/how-to-verify-fsm-for-pattern-detection/36791)

<div class="topic-metadata">

**Author:** [@dvuvmsv](https://verificationacademy.com/forums/u/dvuvmsv)\
**Replies:** 4\
**Last updated:** [November 13, 2019, 7:47pm UTC](https://verificationacademy.com/forums/t/how-to-verify-fsm-for-pattern-detection/36791 "2019-11-13T19:47:00Z")

</div>

Hello, How do I verify the Pattern Detector FSM DUT. Pattern is 10110110. Is it possible to constrain the stimulus such that the pattern 10110110 occurs often with other combinations. Is just declaring randc bit\[7:0\]…

---

## [Constraint to get a specific combination of values](https://verificationacademy.com/forums/t/constraint-to-get-a-specific-combination-of-values/36329)

<div class="topic-metadata">

**Author:** [@syedtaahirahmed](https://verificationacademy.com/forums/u/syedtaahirahmed)\
**Replies:** 1\
**Last updated:** [July 22, 2019, 5:04pm UTC](https://verificationacademy.com/forums/t/constraint-to-get-a-specific-combination-of-values/36329 "2019-07-22T17:04:21Z")

</div>

Hi , I have to write constraint to find a specific combination of two variables a,b. lets say values a\[1:0\] and b\[1:0\] ,the possible combinations are 4\*4 = 16 values but i want only this values (1,2) (0,3) (1,3) (2,2) …

---

## [Generate a number which has sequence 11101](https://verificationacademy.com/forums/t/generate-a-number-which-has-sequence-11101/35865)

<div class="topic-metadata">

**Author:** [@abhiverif](https://verificationacademy.com/forums/u/abhiverif)\
**Replies:** 6\
**Last updated:** [April 4, 2019, 8:39pm UTC](https://verificationacademy.com/forums/t/generate-a-number-which-has-sequence-11101/35865 "2019-04-04T20:39:41Z")

</div>

i would like to generate random no’s which has this sequence of bits (11101) to be present

---

## [Constraining address for the memory making sure the Offset is not within the previous memory regions](https://verificationacademy.com/forums/t/constraining-address-for-the-memory-making-sure-the-offset-is-not-within-the-previous-memory-regions/33486)

<div class="topic-metadata">

**Author:** [@piyer](https://verificationacademy.com/forums/u/piyer)\
**Replies:** 7\
**Last updated:** [April 2, 2019, 5:09pm UTC](https://verificationacademy.com/forums/t/constraining-address-for-the-memory-making-sure-the-offset-is-not-within-the-previous-memory-regions/33486 "2019-04-02T17:09:59Z")

</div>

I want to generate the address for multiple iterations and i want to make sure i don’t generate the starting address within the previous memory regions. Example : lets say I want to write ten words, we have memory from…

---

## [Constraint is not working](https://verificationacademy.com/forums/t/constraint-is-not-working/35852)

<div class="topic-metadata">

**Author:** [@prashant.makhecha](https://verificationacademy.com/forums/u/prashant.makhecha)\
**Replies:** 2\
**Last updated:** [March 14, 2019, 5:41am UTC](https://verificationacademy.com/forums/t/constraint-is-not-working/35852 "2019-03-14T05:41:39Z")

</div>

I had written constraint for 6 varibles but its not working so can anyone please guide me where i am lacking? Requirement is : a,b,c between 0 to 7 but b != a and c != b or a x,y,z between 0 to 63 but y != x and z != x…

---

## [How the "dist" works in constraint if we create the object every time vs one time](https://verificationacademy.com/forums/t/how-the-dist-works-in-constraint-if-we-create-the-object-every-time-vs-one-time/35787)

<div class="topic-metadata">

**Author:** [@Jay\_Shah](https://verificationacademy.com/forums/u/Jay_Shah)\
**Replies:** 5\
**Last updated:** [March 7, 2019, 6:59am UTC](https://verificationacademy.com/forums/t/how-the-dist-works-in-constraint-if-we-create-the-object-every-time-vs-one-time/35787 "2019-03-07T06:59:26Z")

</div>

Hello, System verilog has distribution support in constraints. I have a question that if the distribution changes if I do new for each randomize call versus doing new once and randomize multiple times. Below is the sam…

---

## [Constraining an array field](https://verificationacademy.com/forums/t/constraining-an-array-field/35203)

<div class="topic-metadata">

**Author:** [@manav33](https://verificationacademy.com/forums/u/manav33)\
**Replies:** 1\
**Last updated:** [October 17, 2018, 8:07pm UTC](https://verificationacademy.com/forums/t/constraining-an-array-field/35203 "2018-10-17T20:07:09Z")

</div>

I have config object class and that class gets instantiated in other config object class as rand. I need help writing constraint for it class nome\_mac\_enet\_config extends uvm\_object; rand bit \[2:0\] port\_lpbk\_src; r…

---

## [Constraint of address in higher limit and lower limit and some of the adress in between](https://verificationacademy.com/forums/t/constraint-of-address-in-higher-limit-and-lower-limit-and-some-of-the-adress-in-between/34504)

<div class="topic-metadata">

**Author:** [@syedtaahirahmed](https://verificationacademy.com/forums/u/syedtaahirahmed)\
**Replies:** 2\
**Last updated:** [May 29, 2018, 7:17am UTC](https://verificationacademy.com/forums/t/constraint-of-address-in-higher-limit-and-lower-limit-and-some-of-the-adress-in-between/34504 "2018-05-29T07:17:46Z")

</div>

Hi I have a scenario which includes following Constraint to be taken care :: Please help on the logic 1)There is a 2MB memory address, i have to constraint the address in such a way that every time the test executes it…
