Want to check whenever my command line value is x

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]

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 :

# 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

In reply to zain_17501:

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.

In reply to dave_59:

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

In reply to dave_59:

int mu_value,mu_value1[$];

In reply to zain_17501:

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

int mu_value[],mu_value1[$];

I can tell you the code

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.

In reply to dave_59:

In reply to zain_17501:
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

int mu_value[],mu_value1[$];

I can tell you the code

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 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