Wednesday, January 25, 2017

What is $test$plusargs and $value$plusargs? or Difference between $test$plusargs and $value$plusargs?

$test$plusargs (string)

This system function searches the list of plusargs for the provided string. The plusargs present on the command line are searched in the order provided. If one matches all characters in the provided string, a result of 1'b1 is returned. If no plusarg from the command line matches the string provided, the result of 1'b0 is returned.

Example :
module top;

initial begin
bit error_injection;
error_injection = 0;
if ($test$plusargs ("err"))
error_injection = 1;
$display ("Error Injection =%d", error_injection);
end

endmodule

Usage:
Simulation Command Line : +err


$value$plusargs (user_string, variable)

This system function searches the list of plusargs (like the $test$plusargs system function) for a user specified plusarg string. If the string is found, the remainder of the string is converted to the type specified in the user_string and the resulting value stored in the variable provided. If a string is found the function returns the value 1'b1. If no string is found matching, the function returns the value 1'b0 and the variable provided is not modified.

Example :
module top;

initial begin
if ($value$plusargs ("TESTNAME=%S", testname))
begin
$display ("Running test %0s.", testname);
starttest();
end
end

endmodule

Usage:
Simulation Command Line : +TESTNAME=this_test

No comments:

Post a Comment