Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- I've tested $system calls on Modelsim SE and it's supported, but I can't say about the other flavors and simulators. --- Quote End --- The SystemVerilog spec defines system on page 542, Section 20.18.1. --- Quote Start --- $system makes a call to the C function system(). The C function executes the argument passed to it as if the argument was executed from the terminal. $system can be called as either a task or a function. When called as a function, it returns the return value of the call to system() with data type int. If $system is called with no string argument, the C function system() will be called with the NULL string. The example below calls $system as a task to rename a file. module top; initial $system("mv design.v adder.v"); endmodule --- Quote End --- Looks like you've got a way of getting the time without writing any extra code or using PLI. Since this is part of the spec, other simulators should implement it. For Quartus, just put a synthesis directive around the $system call, and implement your hardware counter kill logic instead. Cheers, Dave