Input plusarg to store weighted distribution

In reply to 1978bubun:

It would be much easier to read this from a file using $fscanf. Doing it from the command line requires a number of steps (untested)

string line;
string pairs[$];
// Read the command line string using $value$plusargs
if ($value$plusargs("instr=%s",line)) begin
   // split the line into instructions
   uvm_split_string(line,":",pairs);
   foreach(pair[ins]) begin
      string i_w[$]
      // split the pair into instruction/weights
      uvm_split_string(pair[ins],"-", i_w);
      if (i_w.size == 2) 
        all_instr.push_back(instr'{itype:i_w[0], iwt:i_w[1].atoi()};
      else 
        // something is wrong
   end
end