Plus args are command line switches supported by the simulator. Usually they are application specific. As per SystemVerilog LRM arguments beginning with the ‘+’ character will be available using the $test$plusargs and $value$plusargs PLI APIs.
Plus args are very useful in controlling many things on your environment like controlling your debug mode or to set a value like the debug_level in your environment, set a value to select/deselect particular field in your environment in your simulation.
What is the Syntax :
$test$plusargs (string)
$value$plusargs (string, variable)
This is a system function searches the list of plusargs. For this system in build function, If a string is found the function returns the value 1’b1. If no strong is found matching, the function returns the value 1’b0 and the variable provided is not modified.
Let’s take an example, How should we use this functions in our environment to have control.
initial begin
if ($test$plusargs("USER_TEST")) begin
$display("Configuring User Test");
//Execute some code for this mode
end
end
Once you compile and later run simulator with command line argument: +USER_TEST , the output will be
Configuring User Test
Similarly if you want to read values from command line into variables the second system function will be handy
For Example
initial begin
string testname;
if ($value$plusargs("TEST=%s",testname)) begin
$display(" Running TEST= %s.",testname);
end
end
Once you compile and pass some argument to simulator as: +TEST=AXI_TEST , the output would be
Running TEST=AXI_TEST
Bạn Có Đam Mê Với Vi Mạch hay Nhúng - Bạn Muốn Trau Dồi Thêm Kĩ Năng
Mong Muốn Có Thêm Cơ Hội Trong Công Việc
Và Trở Thành Một Người Có Giá Trị Hơn