PDA

View Full Version : ovm_report_fatal doesn't end simulation in build phase.



Nilesh B Patel
02-15-2008, 05:07 AM
Hi All,

I have came across the problem when I used ovm_report_fatal() method in build phase.

When we use ovm_report_fatal() in build phase then it should be stop further execution. In our case it wont because it called the kill() method from ovm_threaded_component and check for the current phase, If the current phase is not run phase then it will simply return the function instead of kill further execution.

function void ovm_threaded_component::kill();
if(m_curr_phase != this.m_get_global_phase_num("run"))begin
return;
end

`ifndef INCA

if(m_phase_process != null) begin
m_phase_process.kill();
m_phase_process = null;
end

`else

->m_kill_request;

`endif
endfunction


So it wont stop further execution if we used ovm_report_fatal() method in build phase.

Please let me know what issues we have.

divyeshg
02-16-2008, 01:53 AM
Hi Nilesh,

I hope your using the default severity action id settings of ovm reporter.


when you call ovm_report_fatal() its default severity action is OVM_EXIT;
then it calls to die function of ovm_report_object which executes $finish.

sunil.dodiya
02-16-2008, 02:19 AM
Hi Divyesh,
This will works only if current phase is "run" phase, otherwise it will simply returns from kill function as Nilesh has shown in highlighted code. But here is fatal is called in build method (in elaborate phase) so it wont kill the simulation.

Regards,
Sunil.

divyeshg
02-16-2008, 04:18 AM
Hi Divyesh,
This will works only if current phase is "run" phase, otherwise it will simply returns from kill function as Nilesh has shown in highlighted code. But here is fatal is called in build method (in elaborate phase) so it wont kill the simulation.

Regards,
Sunil.

Hi Sunil,

PLease refer below example & result log file run with QUESTA 6.3c its stops simulation as per expected. Also it displays the current phase.


*********************************example.sv******* *************************************************

import ovm_pkg::*;

module top;
`include "ovm_macros.svh"

class example_c extends ovm_env;
`ovm_component_utils(example_c)
function new(string name = "hi",ovm_component parent);
super.new(name,parent);
endfunction


function void build();
ovm_report_fatal("fatal","we are out",OVM_LOW);
$display("Current Phase %s",get_current_global_phase());
super.build();
endfunction

task run();
$display($time,"WE ARE IN RUN PHASE");
#100;
endtask


endclass



example_c ex;
initial
begin
ex = new("env",null);
ex.do_test();
#100;
end
endmodule

***********************************************RES ULT**********************************************
# vsim -do {run -all; q -f} -c -suppress 3829 top
# ** Note: (vsim-3812) Design is being optimized...
# // QuestaSim 6.3c Sep 11 2007 Linux 2.4.21-37.ELsmp
# //
# // Copyright 1991-2007 Mentor Graphics Corporation
# // All Rights Reserved.
# //
# // THIS WORK CONTAINS TRADE SECRET AND
# // PROPRIETARY INFORMATION WHICH IS THE PROPERTY
# // OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS
# // AND IS SUBJECT TO LICENSE TERMS.
# //
# Loading sv_std.std
# Loading work.ovm_pkg(fast)
# Loading work.example_sv_unit(fast)
# Loading work.top(fast)
# run -all
# ----------------------------------------------------------------
# OVM-1.0
# (C) 2007-2008 Mentor Graphics Corporation
# (C) 2007-2008 Cadence Design Systems, Inc.
# ----------------------------------------------------------------
# OVM_FATAL @ 0: env [fatal] we are out
# env : die
# Current Phase post_new
#
# --- OVM Report Summary ---
#
# ** Report counts by severity
# OVM_INFO : 0
# OVM_WARNING : 0
# OVM_ERROR : 0
# OVM_FATAL : 1
# ** Report counts by id
# [fatal ] 1
# q -f


I think above example will help you ...:)

Nilesh B Patel
02-16-2008, 05:05 AM
Hi Divyesh,

Please try run_test() method instead of ex.do_test() in your code. You will get display from "run" phase, even fatal executed in "build" phase that we shouldn't expect. Because If once a fatal comes in "build" phase then execution shouldn't execute further to "run" phase. In our case, execution wont stop after fatal in "build" phase.

divyeshg
02-17-2008, 11:27 PM
Hi Nilesh,

In above mention code you can replace ex.do_test() by run_test();

RESULT: Simulation will stop at 0 time as there is fatal in build method.

Now remove ovm_fatal_error from the build method and run same example.

RESULT: it would exit after completing run phase i.e. at 100 time.


From above 2 result we can conclude that simulation stops at 0 time if fatal is called in build .

I hope it helps you resolve your problem.

Nilesh B Patel
02-18-2008, 12:00 AM
Hi Divyesh,

As per execution flow, build phase execute before run phase. If fatal comes in build phase then it shouldn't go to run phase.

In my case, fatal occurs in build phase as well as run phase. In a build, due to fatal, die method is called but then after it wont stop. Its go to run phase and when fatal comes in run phase, die method is called and this time execution would stop. So my question is why its not stopped at build phase.

i.e. As per my understanding, object randomization is done in build phase. If randomization is failed then its a fatal error so execution shouldn't go to run phase.

divyeshg
02-18-2008, 02:16 AM
Hi Nilesh,

I agree that if you write fatal in build phase it still moves to runphase but it stops at 0 simulation time after it enters run phase.....

when ever ovm_fatal_report is called it set ovm_component bit m_global_stop_req = 1;

This bit is checked during run_phase only if this bit is one it ends run task at 0 simulation time, hence simulation end.

Nilesh B Patel
02-18-2008, 02:22 AM
Hi Divyesh,

I agree with your answer. Its stopped at 0 simulation time in run phase.

Thank you very much.