# Warning: Non-existent associative array entry. Returning default value

**URL:** <https://verificationacademy.com/forums/t/warning-non-existent-associative-array-entry-returning-default-value/34519>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, associative-array\
**Created:** [May 31, 2018, 5:48pm UTC](https://verificationacademy.com/forums/t/warning-non-existent-associative-array-entry-returning-default-value/34519 "2018-05-31T17:48:05Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![javatea](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/j/3d9bf3/32.png) [@javatea](https://verificationacademy.com/forums/u/javatea)\
**Post date:** [May 31, 2018, 9:08pm UTC](https://verificationacademy.com/forums/t/warning-non-existent-associative-array-entry-returning-default-value/34519/4 "2018-05-31T21:08:31Z")

</div>

_In reply to [ce\_2015](https://verificationacademy.com/forums/t/warning-non-existent-associative-array-entry-returning-default-value/34519/3):_

Actually, I try this and it works fine in local and even [SystemVerilog Randomization - EDA Playground](https://www.edaplayground.com/x/2Xh)  
maybe check your tool first. It’s valid syntax.

```verilog

class txn;
  typedef enum bit [3:0] {A,B,C,D} sometype_t;   
  rand int array[sometype_t] = '{default:0, A:1, B:2, C:3, D:4};   
endclass

module automatic test;
  
  function void run;
    txn tmp = new();
    $display("template : %p", tmp); // '{array:'{A:1, B:2, C:3, D:4} }

    tmp.randomize();
    $display("template : %p", tmp); // '{array:'{A:727460974, B:-2124444300, C:-816347820, D:2075578760} }
  endfunction
  
  initial run();
  
endmodule

```

---

_[View the full topic](https://verificationacademy.com/forums/t/warning-non-existent-associative-array-entry-returning-default-value/34519)._
