Jump to content

Warning-[RT-ISV] Ignoring seed value is triggered due to a bug in function uvm_create_random_seed()


Recommended Posts

Simulation is failing due to this warning: 

Warning-[RT-ISV] Ignoring seed value
/uvm/1.0.530-ieee_1800.2/uvm-1.0.530-ieee_1800.2-verif/distrib/src/base/uvm_object.svh, 782
  Ignoring seed value 0. Seeding with value 1 as seed must be greater than 0.

 the system function srandom() is called with seed =0 in function uvm_object::reseed()

function void uvm_object::reseed ();
  if(get_uvm_seeding())
    this.srandom(uvm_create_random_seed(get_type_name(), get_full_name()));
endfunction

 

The addition highlighted below in bold red color in function uvm_create_random_seed should be followed with checking if an overflow causes a seed value to be 0 and if so the seed should be assigned a new random value to avoid the warning message  “ignoring seed value”  by the system function srandom() when called with a seed=0

 

function int unsigned uvm_create_random_seed ( string type_id, string inst_id="" );
  uvm_seed_map seed_map;

  if(inst_id == "")
    inst_id = "__global__";

  if(!uvm_random_seed_table_lookup.exists(inst_id))
    uvm_random_seed_table_lookup[inst_id] = new;
  seed_map = uvm_random_seed_table_lookup[inst_id];

  type_id = {uvm_instance_scope(),type_id};

  if(!seed_map.seed_table.exists(type_id)) begin
    seed_map.seed_table[type_id] = uvm_oneway_hash ({type_id,"::",inst_id}, uvm_global_random_seed);
  end
  if (!seed_map.count.exists(type_id)) begin
    seed_map.count[type_id] = 0;
  end

  //can't just increment, otherwise too much chance for collision, so 
  //randomize the seed using the last seed as the seed value. Check if
  //the seed has been used before and if so increment it.
  seed_map.seed_table[type_id] = seed_map.seed_table[type_id]+seed_map.count[type_id]; 
  seed_map.count[type_id]++;

  return seed_map.seed_table[type_id];
endfunction

 

I debugged the warning “ignoring seed value” that cause some of my tests to fail from time to time in regression.  below is an example scenario that expose this bug:

 In this failing test the uvm object with type [uvm_pkg::tx_item] and name [uvm_test_top.m_env.m_tx.m_agents[7].m_sequencer.tx_lib[7].m_req_item]  was assigned an initial 32 bit seed = 3173394285. Every time a new instance of this object created it is assigned a new seed , to make sure no two instances of the same object have the same seed, the count for this object is incremented and added to the latest seed of this object.  After creating 1,719,644 instances of this object the seed value of the latest instance of this object was = 4,293,247,651.

Creating the 1,719,645th instance of this object will have a seed value = 4,294,967,296 which in hex is  1 0000 0000, since the seed is 32 bit it will have a value = 0 which cause the warning to occur.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...