Closed zfling closed 4 years ago
The API for setting report files is the same as in SystemVerilog. You can do the following:
# In your top test, after all components are created (ie connect_phase):
def connect_phase(self, phase):
self.f = open("uvm_logfile.txt", "w")
self.set_report_default_file_hier(self.f)
...
# In your top test, in final_phase:
def final_phase(self, phase):
self.f.close() # Without this, nothing is printed to the file, so don't forget it
Let me know if it does not work. And look at the reporting API. Each component can have its own logfile.
I tried and it did not work.
I forgot that default action is UVM_DISPLAY, so you need to also do (when you set the default file):
self.set_report_severity_action_hier(UVM_INFO, UVM_LOG | UVM_DISPLAY)
It worked now. Is there a way to save all logs in the terminal to a log file, not only the UVM_INFO, such as compile log, cocotb log...
Sure. It's not feature of cocotb or uvm-python. Just use shell re-direction:
make args > run.log
make args >& run.log # This dumps also stderr to run.log
will dump everything to run.log. args should be your custom args to the Makefile.
I will close this as uvm-python -specific issue was resolved.
How to save uvm_info into a log file,not only into terminal?