I am trying to use $system function to save some information to a file in system verilog. I am able to write to the file if I pass a everything in quotes including command, information and filename.
Like this: void’($system(“echo SIMSTART >> tc_status”)); This way it is writing SIMSTART to file tc_status. But I want to save name of the testcase to the file. The name of testcase is in a variable tc_name. How shall if pass this variable to $system function so that it will append to tc_status.
I tried these methods, but didn’t work:
- void’($system({"echo “,tc_name, " >> tc_status”}));
- void’($system($sformatf(“echo %s >> tc_status”,tc_name)));
And 3 to 4 more variations but none of them worked for me. These are not throwing any error, but simply not writing to the file.
Please help.