rajivdesh Posted November 2, 2021 Report Share Posted November 2, 2021 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 Quote Link to comment Share on other sites More sharing options...
chr_sue Posted November 2, 2021 Report Share Posted November 2, 2021 I believe you can employ the array querying functions like $high, $low, $left, $right. Plese visit the SV LRM for more details. Quote Link to comment Share on other sites More sharing options...
rajivdesh Posted November 2, 2021 Author Report Share Posted November 2, 2021 Hi Chr_sur Thanks for the reply But the Querying functions are used to return the value . My requirement is I want to access different indices range for every iteration which depends on the variables used in the loop Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.