Uvm reset sequence on all the regsioters

Hi,

I have 100 register in my RAL model and i am trying to write to one of the register and run reset and remaining 99 registers. Belo wis how I am doing it but the problem is: the number of registers are decreasing by 1 everytime reset sequence is run. Looks like uvm_resource_db is not setting it to 0. Appreciate any insight.

foreach(all_regs[i]) begin
   all_fields_rw = 1;

   if(all_regs[i].get_rights() == "RW") begin
     all_regs[i].get_fields(fields);
     foreach(fields[j]) begin
       if (fields[j].get_access() != "RW") begin
         all_fields_rw = 0;
       end //if
     end //foreach fields

     if(all_fields_rw) begin
       
       fields[0].set('hdeadbeef); 
       all_regs[i].update(status); 

       uvm_resource_db#(bit)::set({"REG::", all_regs[i].get_full_name()},"NO_REG_HW_RESET_TEST", 1, this);

       rst_seq = uvm_reg_hw_reset_seq::type_id::create("rst_seq");
       rst_seq.model = reg_model;
       rst_seq.start(p_sequencer.isb_seqr);

       uvm_resource_db#(bit)::set({"REG::", all_regs[i].get_full_name()},"NO_REG_HW_RESET_TEST", 0, this);

     end 
  end //if

end //foreach

I’m not sure your code is doing quite what you want. The documentation for uvm_reg_hw_reset_seq (see e.g. here) says that the register won’t be tested if the register’s entry in the resource DB has a resource called either NO_REG_TESTS or NO_REG_HW_RESET_TEST. There’s no mention of the value associated with the resource.

I am just eliminating that very register that I am writing to. As its value is changed, so it will never match the reset value. After that I want to remove it and add the next register to be removed.

there is a different value assigned to the resource before and after the reset sequence.

uvm_resource_db#(bit)::set({“REG::”, all_regs[i].get_full_name()},“NO_REG_HW_RESET_TEST”, 1, this);

Ah, I don’t think I fully understood your original question. If I understand right (now), you want to do something like the following:

  1. Make a list of all the registers (let’s call it L).
  2. Read all the registers in L and check they have their reset values.
  3. Write a value to the first register in L.
  4. Remove that register from L.
  5. If L is not empty, go back to (2)

I think that in your example, L is starting out as all the registers. I’m ignoring the detail about writeable fields, which would need me to tweak steps (3) and (5).

To achieve step (4), I think you’re setting a NO_REG_TESTS resource for the relevant register.

This looks reasonable to me, and I’m back to not understanding! You say “the number of registers are decreasing by 1 everytime reset sequence is run”. That makes sense: you’re telling it not to check the values of some of the registers, because you’ve just written them.

What behaviour are you hoping for?