Jump to content

uvm_object::set_int_local for static integer array

Recommended Posts

In a transaction sub-class we have a simple integer array like int my_data[2]; Then we can declare the field automation like `uvm_field_sarray_int(my_data, UVM_ALL_ON).

If we call set_int_local("my_data", 'h0123456789abcdef) on that class object, we get nothing into the my_data array. 

After going through the class reference manual we can't see the expected result of this function call. And checking the body of the `uvm_field_sarray_int macro, I think the UVM_SETINT case branch appears very strange. 


Link to comment
Share on other sites

Here my code:


package pkg;
import uvm_pkg::*;
`include "uvm_macros.svh"
`define rob_field_sarray_int(ARG, FLAG) \
  `uvm_field_sarray_int(ARG, FLAG) \
  begin \
    case (what__) \
      UVM_SETINT: \
        begin \
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
            if((FLAG)&UVM_READONLY) begin \
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
            end else begin \
              ARG = { << $bits(ARG[0]) {$bits(ARG)'(uvm_object::__m_uvm_status_container.bitstream)} }; \
              __m_uvm_status_container.status = 1; \
            end \
          end \
        end \
    endcase \
class set_int_local_class extends uvm_pkg::uvm_object;
    int data[2];
        `rob_field_sarray_int(data, UVM_ALL_ON)
    function new(string name = "set_int_local_class");
        $display("$bits(data) = %0d", $bits(data));
    endfunction: new
endclass: set_int_local_class
module test;
pkg::set_int_local_classmy_inst = new;
initial begin
    longint unsigned data_val = 'h1234_5678_9abc_def0;
    my_inst.set_int_local("data", data_val);

The appended UVM_SETINT branch in rob_field_sarray_int macro is what I would like to have.

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.

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