# UVM Sequence\_Item Constraint for increase 1

**URL:** <https://verificationacademy.com/forums/t/uvm-sequence-item-constraint-for-increase-1/41088>\
**Category:** UVM\
**Tags:** UVM, constraint-randomization, uvm\_sequence\_item, Increase-one\
**Created:** [December 10, 2022, 12:36am UTC](https://verificationacademy.com/forums/t/uvm-sequence-item-constraint-for-increase-1/41088 "2022-12-10T00:36:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DenizGuzel](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/b19c9b/32.png) [@DenizGuzel](https://verificationacademy.com/forums/u/DenizGuzel)\
**Post date:** [December 10, 2022, 12:36am UTC](https://verificationacademy.com/forums/t/uvm-sequence-item-constraint-for-increase-1/41088/1 "2022-12-10T00:36:09Z")

</div>

Hi, When I use

```verilog
constraint c_state == const'(state) +1;

```

in sequence\_item the value gives undefined. However when I use

```verilog
constraint c_state { state == 1;}

```

it gives 1 or which value I wrote there. What is the way that I can increase the value of state 1.

```verilog

class alu_sequence_item extends uvm_sequence_item;
  `uvm_object_utils(alu_sequence_item)

  rand logic i_rst;
  rand logic [15:0] i_memData;
  
  logic [15:0] o_memData; //output
  logic [5:0] o_memAddr; //output
  bit o_memWrEnable; // output
  
  rand logic [1:0] state;
	
  constraint c_state { state == 1;} //Here is the problem
  
  function new(string name = "alu_sequence_item");
    super.new(name);
    
  endfunction: new

endclass: alu_sequence_item

```

I have checked using uvminfo if there is a problem in my interface or sequence but no if I dont write any constrait then it generates random 2 bit values in scoreboard.

I need help to increase it one every clock cycle. Thank you.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [December 12, 2022, 3:01pm UTC](https://verificationacademy.com/forums/t/uvm-sequence-item-constraint-for-increase-1/41088/2 "2022-12-12T15:01:03Z")

</div>

_In reply to [DenizGuzel](https://verificationacademy.com/forums/t/uvm-sequence-item-constraint-for-increase-1/41088):_

I believe you mean state should be increased for each seq\_item.  
You can do this in the sequence where you are calling your seq\_item like this

```verilog
task body();
   your_item.state = 1;
   for (int i = 0; i < max_items; i++)
     uvm_do_with (your_item, {your_item.state + i;})
endtask

```

---

<div class="post-metadata">

**Author:** ![DenizGuzel](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/b19c9b/32.png) [@DenizGuzel](https://verificationacademy.com/forums/u/DenizGuzel)\
**Post date:** [December 12, 2022, 3:52pm UTC](https://verificationacademy.com/forums/t/uvm-sequence-item-constraint-for-increase-1/41088/3 "2022-12-12T15:52:20Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/uvm-sequence-item-constraint-for-increase-1/41088/2):_

Thank you sir.
