Search the Community
Showing results for tags 'system call'.
Does $system() really return an int when called as a function? (Perhaps no one has implemented this part of the LRM?) int myseed; myseed = $system("date"); //should output "return value of the call to system() with data type int" quote source: IEEE_Std1800-2017 Section 20.18.1 $system I have not been able to get a non-0 return value, as far as I can tell. Am I doing something incorretly or is this not implemented? What if $system("date") is called? I suppose the "date" system output is longer than 32b, so perhaps the lowest bits are all 0s and the upper ones that contain the date are truncated. ? Some sample code: https://edaplayground.com/x/4dw6 ==================================================================== Ultimate Objective: Use $system("date") to set the seed using $srandom(). Reason: I haven't easily found the simulator run switches for the different simulators to use random seeds for each run. So, I try to make universal SystemVerilog code (just for use on edaplayground with small examples), to use a random seed for each run, based on the wall clock time. //Compiler / simulator run switches to set random seed in SystemVerilog simulators Aldec Riviera: ? ? ? Cadence Xcelium: -seed random Mentor Questa: -svseed=random Synopsys VCS: ? ? ? (I feel comfortable posting this, as I don't consider this any form of benchmarking between simulators, but just equating compile options.)