Jump to content

[System verilog ] Accessing an array with range varying along with upper and lower limits and the width of the array .


Recommended Posts

Hi 

 

Want to access the array with different width sizes along with different upper and lower limits .

 

The Sample code is as follows (Ignore the begin/end syntax )

foreach(fields[i]) begin
         if(fields[i].get_name().substr(0,7) != "reserved")    begin
          const int lsb_i= fields[i].get_lsb_pos() ;
          const int msb_i = fields[i].get_lsb_pos() + fields[i].get_n_bits()-1;
          int size_of = msb_i - lsb_i + 1;
          if((r_data[msb_i -:size_of] ) ==( m_data[msb_i -:size_of] ) ) 
    begin
         `uvm_info(get_type_name(),$sformatf("Matching data for Reg %s with fields[i] %s read data = %0h and mirror_data = %0h @ Addr=%0h", regs[i].get_name(),                           fields[i].get_name() ,r_data ,m_data, regs[i].get_address()), UVM_MEDIUM);
    end
           else
          `uvm_error(get_name(),$sformatf("MIsMatching data for Reg %s with fields[i] %s read data = %0h and mirror_data = %0h @ Addr=%0h", regs[i].get_name(),                         fields[i].get_name() ,r_data ,m_data, regs[i].get_address()));  
         end
          

 

The Problem is with the BLOCK code , 

The array doesnt suppoort the indices for range being variable . 

 

I get an error as follows :

 if((r_data[msb_i -:size_of] ) ==( m_data[msb_i -:size_of] ) ) 
                                   |
xmvlog: *E,NOTPAR (/vobs/asic/hawkowl/src/jor/src/jor_top_sec/tb/lib/env/er_jor_insec_reg_seq_lib.svh,220|35): Illegal operand for constant expression [4(IEEE)].
          if((r_data[msb_i -:size_of] ) ==( m_data[msb_i -:size_of] ) ) 
                                                                 |
xmvlog: *E,NOTPAR (/vobs/asic/hawkowl/src/jor/src/jor_top_sec/tb/lib/env/er_jor_insec_reg_seq_lib.svh,220|65): Illegal operand for constant expression [4(IEEE)].

 

 

So please help me solving this issue .

 

Thanks in advance 

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