I'm running Modelsim to do a long simulation. I want to have an ouput like this for my progress report to be logged in a file:
Mon Oct 29 21:05:57 IRST 2018 Section 1
Mon Oct 29 21:05:57 IRST 2018 Section 2
Mon Oct 29 21:05:57 IRST 2018 Section 3
...
I want to have a tcl script to create this output and log it in a file during simulation progress. I have below TCL code snippet:
set fp [open mylog.txt w]
puts $fp "Section 1"
close $fp
It will print label Section 1 inside file mylog.txt.
However I don't know how to print current system date and time to this file from modelsim command line (TCL).
using date >mylog.txt will print date/time to file however since file is open, it will make thing corrputed and output format wouldn't be nice like what I described above.
Are there any methods to print system data/time to file inside TCL scripts?
puts $fp "[clock format [clock scan now]] Section 1"is satisfactory to you. You can futher more alter the timestamp format per the manual here - Jerryclock scan nowis a very costly way to do exactly the same asclock seconds. On my machine it takes 60.9 µS versus 0.48 µS forclock seconds- Schelte Bron