Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Reputation Activity

  1. Thanks
    joniale reacted to steve in What is the proper way to trigger something when a uvm_reg field is written?   
    Hi Doug,
    I have done this sort of thing before with callbacks & the uvm_event_pool to synchronise parts of my env to register access:

    class trigger_reg_field_cbs extends uvm_reg_cbs; `uvm_object_utils(trigger_reg_field_cbs) function new(string name = "trigger_reg_field_cbs"); super.new(name); endfunction: new virtual function void post_predict(input uvm_reg_field fld, input uvm_reg_data_t previous, inout uvm_reg_data_t value, input uvm_predict_e kind, input uvm_path_e path, input uvm_reg_map map); uvm_event access_event; `uvm_info("REG_CBS", $psprintf("post_predict() called for field %s, current value: %04x, previous value: %04x, kind: %s, path: %s", fld.get_name(), value, previous, kind.name(), path.name()), UVM_HIGH); if (kind == UVM_PREDICT_DIRECT) begin access_event = uvm_event_pool::get_global($psprintf("%s_PREDICT", fld.get_name())); access_event.trigger(); end if (kind == UVM_PREDICT_READ) begin access_event = uvm_event_pool::get_global($psprintf("%s_READ", fld.get_name())); access_event.trigger(); end if (kind == UVM_PREDICT_WRITE) begin access_event = uvm_event_pool::get_global($psprintf("%s_WRITE", fld.get_name())); access_event.trigger(); end endfunction endclass: trigger_reg_field_cbs I did a presentation with some callback recipes at a UK conference recently - you might find it interesting:
  2. Like
    joniale reacted to tudor.timi in UVM reg model mask   
    Hijacking the thread for a bit.
    Is there a future bug fix release for UVM 1.1 planned? UVM 1.1e maybe for people who don't want to migrate to UVM 1.2 just yet?
  3. Like
    joniale got a reaction from ljepson74 in randomize a string ?   
    Here a small example of code:   First, an example to create a byte dynamic array from a string. The dynamic array of bytes contains the ASCII CODE number representation of each character. The advantage is that this can be for example be randomized but strings cannot be randomized.   (created doing e.g.  for(i=0;i<stringvar.len(); i++) begin byte_din_array = {byte_din_array ,stringvar[i]}; //stringvar[i] will return empty byte if the index would be beyond the string length //The advantage of using stringvar[i] instead of stringvar.atoi(i) is that //the string can have all ASCII characters and not just numbers. //Disadvantage is that the byte contains the ASCII CODE "number" //representation of the character and that is not human readable end   ).   Here is the example to convert the dynamic array of bytes back in a concatenated string.  You may have used the previous dynamic array to be partly randomized (with constraints) inside an xfer or changed in post_randomize.   function string convert_byte_array2string(byte stringdescriptionholder[]); automatic string temp_str=""; automatic byte byte_temp; automatic string str_test; for ( int unsigned i = 0; i<stringdescriptionholder.size(); i++) begin i=i;//debug breakpoint byte_temp = stringdescriptionholder[i]; str_test = string'(byte_temp); //the "string cast" will convert the numeric ASCII representation in a string character temp_str = {temp_str,str_test}; end return temp_str; endfunction If you want more information about strings i recommend to read the section 3.7 of the Systemverilog LRM (2012) . It is about the string data types and explain the built-in methods used with string data types.
  • Create New...