I'd like to use $value$plusargs as in the below code:
module top();
...
reg data;
real READ_FREQ
initial begin
if (!$value$plusargs("READ_FREQ=%0F", READ_FREQ))
READ_FREQ = 197;
end
parameter wclk = 300;
parameter rclk = READ_FREQ;
always #(rclk/2.0) i_rclk = ~i_rclk;
...
endmodule
But, when I compile the code, I get this error:
irun: *E,VLGERR: An error occurred during parsing. Review the log file for errors with the code *E and fix those identified problems to proceed. Exiting with code (status 1).
irun(64): 12.10-p001: (c) Copyright 1995-2012 Cadence Design Systems, Inc.
file: ./top.v
parameter rclk = READ_FREQ;
|
ncvlog: *E,NOTPAR (./top.v,197|41): Illegal operand for constant expression [4(IEEE)].
How can I use $value$plusargs?
$value$plusargis not the cause of your error. Parameters can only take constant expressions, i.e. operation on constant values or other parameters. You passed a realREAD_FREQwhich is a variable and causes this error. However, you can check project-veripage.com/plusarg.php for$value$plusargusage$value$plusargs; it was added in IEEE1364-2001 so all simulators from 2005 and onward should support it. Check the lines above.real READ_FREQis missing a;