Jump to content

Problem with re-directing report into log file

Recommended Posts


I am trying to redirect report messages of all the components into a log file as shown below.

1. In top_test.h:

            UVM_FILE default_report;
           std::unique_ptr<std::ofstream> log_file;

2. In top_test.cpp: (At the end of build_phase, after instantiating top_env )

        auto m_uvm_root = uvm_root::get();
        m_uvm_root->set_report_severity_action_hier(UVM_INFO,    UVM_DISPLAY | UVM_LOG);
        m_uvm_root->set_report_severity_action_hier(UVM_WARNING, UVM_DISPLAY | UVM_COUNT | UVM_LOG);
        m_uvm_root->set_report_severity_action_hier(UVM_ERROR,   UVM_DISPLAY | UVM_COUNT | UVM_LOG);
        m_uvm_root->set_report_severity_action_hier(UVM_FATAL,   UVM_DISPLAY | UVM_EXIT  | UVM_LOG);

        log_file = std::unique_ptr<std::ofstream> (new std::ofstream("my_file.log"));
        if (log_file->is_open())
            default_report = log_file.get();
            UVM_ERROR(this->name(), "Unable to open my_file.log file");

With the above code, messages in all components other than 'driver' and 'sequence_item' are re-directed into log file.

please let me know how to resolve this issue.

Kindly let me know more information is needed from my side.

Link to comment
Share on other sites

  • 10 months later...

Hi Chethan,

the issue you see comes probably stems from the driver and sequencer being created during the build phase when you start run_test(...). Your hierarchical logfile setting happens before that, so that the driver and sequencer could not know of that setting.

To enable the wanted behaviour, you need to move the log setting to a later place in runtime or make the driver and sequencer full members of the environment.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...