# Want to check whenever my command line value is x

**URL:** <https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, system-verilog-arrays-dont-care-case-inequality\
**Created:** [March 14, 2023, 11:01am UTC](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374 "2023-03-14T11:01:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![adnanashraf\_17501](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/b2d939/32.png) [@adnanashraf\_17501](https://verificationacademy.com/forums/u/adnanashraf_17501)\
**Post date:** [March 14, 2023, 11:01am UTC](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/1 "2023-03-14T11:01:34Z")

</div>

Have a piece of code which has many functions implemented in the other parts …  
Actually i want to check whenever my command line value is x then mu\_value irrespective of what value it generates it should give don’t care 'x only. But my output is [0,0,0,0]

```verilog
if($value$plusargs("Value=%s",value)) begin
$display("After $value$plusargs(): value = %s", value);
parse(mu_value,no_values,",",value);
$display("After $value$plusargs(): value = %p no_values %d value %s", mu_value,no_values,value);
if(value=="x") begin
if(mu_value.size()!=no_probes*mu_count);
     $display("Entered Loop for don't care"); 
      for(int i=0;i<no_probes;i++) begin
      for(int j=1; j<mu_count;j++)begin
      mu_value=new[mu_value.size()+1](mu_value);
      mu_value[(i*mu_count)+j]='x;
      no_values++;
      $display("value = %p",mu_value);
for (int i = 0; i < mu_value.size(); i++) begin
    if (mu_value[i] !== 'x) begin
        mu_value[i] = 'x;
    end
end

```

Output :

```auto
# After $value$plusargs(): value = x
# out=xxxxxxxx
# After $value$plusargs(): value = '{0} no_values 1 value x
# Entered Loop for don't care
# value = '{0, 0}
# After setting don't care values: value = '{0, 0}
# value = '{0, 0, 0}
# After setting don't care values: value = '{0, 0, 0}
# value = '{0, 0, 0, 0}
# After setting don't care values: value = '{0, 0, 0, 0}
# value = '{0, 0, 0, 0, 0}
# After setting don't care values: value = '{0, 0, 0, 0, 0}
# value = '{0, 0, 0, 0, 0, 0}
# After setting don't care values: value = '{0, 0, 0, 0, 0, 0}
# 00000000 no_values 6
# 00000000 no_values 6
# 00000001 no_values 6
# 00000001 no_values 6
# 00000002 no_values 6
# 00000002 no_values 6
# 00000000 no_values 6
# 00000000 no_values 6

```

---

<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 14, 2023, 6:27pm UTC](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/2 "2023-03-14T18:27:22Z")

</div>

_In reply to [zain\_17501](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374):_

It would help to show the declarations of all variables used in your example  
It would help to show the definition of the function ‘parse’ or at least explain what it does  
Your $display statements do not match the output shown.

---

<div class="post-metadata">

**Author:** ![adnanashraf\_17501](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/b2d939/32.png) [@adnanashraf\_17501](https://verificationacademy.com/forums/u/adnanashraf_17501)\
**Post date:** [March 15, 2023, 6:13am UTC](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/3 "2023-03-15T06:13:33Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/2):_

Well this logic basically has no functional dependency on other functions just that mu\_value is getting this output value = '{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} i want to assign all values as x but when i am giving the condition of assignment that its not taking and 0 0 0 values are getting printed

---

<div class="post-metadata">

**Author:** ![adnanashraf\_17501](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/b2d939/32.png) [@adnanashraf\_17501](https://verificationacademy.com/forums/u/adnanashraf_17501)\
**Post date:** [March 15, 2023, 6:16am UTC](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/4 "2023-03-15T06:16:05Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/3):_

int mu\_value,mu\_value1[$];

```auto

```

---

<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 15, 2023, 6:48am UTC](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/5 "2023-03-15T06:48:26Z")

</div>

_In reply to [zain\_17501](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/4):_

We did not need to see all your code, just the declarations relevant to your original example.  
Now that I see that mu\_value is declared as

```verilog
int mu_value[],mu_value1[$];

```

I can tell you the code

```verilog
for (int i = 0; i < mu_value.size(); i++) begin
    if (mu_value[i] !== 'x) begin
        mu_value[i] = 'x;
    end
end

```

will set every element to 0 because **int** is a 2-state type. Perhaps you should use **integer** instead. That will set every element to 'x. Sems like a strange piece of code either way.

---

<div class="post-metadata">

**Author:** ![adnanashraf\_17501](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/b2d939/32.png) [@adnanashraf\_17501](https://verificationacademy.com/forums/u/adnanashraf_17501)\
**Post date:** [March 15, 2023, 9:25am UTC](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/6 "2023-03-15T09:25:16Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/5):_

> _In reply to [zain\_17501](https://verificationacademy.com/forums/t/want-to-check-whenever-my-command-line-value-is-x/41374/5):_  
> We did not need to see all your code, just the declarations relevant to your original example.  
> Now that I see that mu\_value is declared as

```verilog
int mu_value[],mu_value1[$];

```

I can tell you the code

```verilog
for (int i = 0; i < mu_value.size(); i++) begin
if (mu_value[i] !== 'x) begin
mu_value[i] = 'x;
end
end

```

will set every element to 0 because **int** is a 2-state type. Perhaps you should use **integer** instead. That will set every element to 'x. Sems like a strange piece of code either way.

yet to be fixed :-) Hi Dave actually i tried to use a small piece of code for the same functionality in eda playground with mu\_value assigned as integer there i am getting xxxx values [https://www.edaplayground.com/x/bhqZ](https://www.edaplayground.com/x/bhqZ) but here in my code i cant change data type for mu\_value else i have to change the entire functionality … Even on changing this to integer data type i am getting an error “Error (suppressible): …/…/tb\_uvm/ila\_seq\_lib\_cap\_input\_all.sv(381): (vlog-7034) Array assignment or comparison to type ‘integer []' from type 'int ’: Arg. ‘s’ of ‘parse’: Elements must both be 2-state or both be 4-state.” This error is related to parse function which is being called in the make in change logic change … so can you please advise me of something else what i can do based on the code that i shared
