$value$plusargs , . . IEEE Std 1800-2012 & sect; 21.6 " ". SystemVerilog , , . , SystemVerilog string substr, IEEE Std 1800-2012 & sect; 7.10 "" & sect; 6.16.8 "Substr"
function void parse(output string out [], input byte separator, input string in);
int index [$];
foreach(in[i]) begin
if (in[i]==separator) begin
index.push_back(i-1);
index.push_back(i+1);
end
end
index.push_front(0);
index.push_back(in.len()-1);
out = new[index.size()/2];
foreach (out[i]) begin
out[i] = in.substr(index[2*i],index[2*i+1]);
end
endfunction : parse
$value$plusargs :
string cmd[];
string plusarg_string;
if ( $value$plusargs("CMDS=%s",plusarg_string) ) begin
parse(cmd, ",", plusarg_string);
end
foreach(cmd[i])
$display("CMD[%0d]:'%s'",i,cmd[i]);
: http://www.edaplayground.com/s/6/570