Jump to content
Sign in to follow this  
sylvainb

uvm_component apply_config_settings method limitation

Recommended Posts

Hi All,

 

It seems that there is a problem for automatically updating components fields registered with uvm_field_* macros.

It works fine if the field is of type int, but it fails if the field is of type enum.

Do I miss something?

(I tested this code with both UVM 1.1-d and UVM 1.2)

 

class hs_driver extends uvm_driver #(hs_packet);

   hs_type_t driver_type;
   int       my_param = 10;
  
   `uvm_component_utils_begin (hs_driver)
      `uvm_field_enum (hs_type_t, driver_type, UVM_ALL_ON)
      `uvm_field_int (my_param, UVM_ALL_ON)
   `uvm_component_utils_end
  [...]

endclass: hs_driver

class test_bench extends uvm_component;
   `uvm_component_utils (test_bench)

   hs_driver host;
   hs_driver device;
   
  [...]

   virtual function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      uvm_config_db#(hs_type_t)::set (null, "*.device", "driver_type", DEVICE);
      uvm_config_db#(int)::set (null, "*.host", "my_param", 888);

      host = hs_driver::type_id::create ("host", this);
      device = hs_driver::type_id::create ("device", this);
   endfunction: build_phase
   
endclass: test_bench


Printing test topology:

-------------------------------------------------------------
Name                      Type                    Size  Value
-------------------------------------------------------------
uvm_test_top              simple_test             -     @1863
  mtb                     test_bench              -     @1939
    device                hs_driver               -     @2089
      rsp_port            uvm_analysis_port       -     @2162
        recording_detail  integral                32    'd1  
      seq_item_port       uvm_seq_item_pull_port  -     @2130
        recording_detail  integral                32    'd1  
      driver_type         hs_type_t               32    HOST -> should have been DEVICE!
      my_param            integral                32    'ha  
      recording_detail    integral                32    'd1  
    host                  hs_driver               -     @2024
      rsp_port            uvm_analysis_port       -     @2095
        recording_detail  integral                32    'd1  
      seq_item_port       uvm_seq_item_pull_port  -     @2058
        recording_detail  integral                32    'd1  
      driver_type         hs_type_t               32    HOST
      my_param            integral                32    'h378 -> In this case (for an integer) the field has been updated followin uvm_config_db
      recording_detail    integral                32    'd1  
    recording_detail      integral                32    'd1

Share this post


Link to post
Share on other sites

I don't think it's supposed to work for enums. To get a config field you need to call uvm_config_db #(field_type):: (....), where field_type must be known at compile time. It's not possible for the field macros to generate code that expands to this, even though the field type is passed as an argument. Looking at the source code, the only types which are supported are: uvm_bitstream_t, int, int unsigned, string, uvm_config_object_wrapper and uvm_object.

Share this post


Link to post
Share on other sites

Hi Tudor,

 

Thank you for your answer...

I actually found in between a paper that mention this problem (section VII). They also suggest a work-around by using uvm_config_db#(int) instead of uvm_config_db#(hs_type_t), and this works perfectly for me to circumvent the issue!

 

 

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...