00001 // $Id: ovm__extern__report__server_8svh-source.html,v 1.1 2008/10/07 21:54:54 alex.marin Exp $ 00002 //---------------------------------------------------------------------- 00003 // Copyright 2007-2008 Mentor Graphics Corporation 00004 // Copyright 2007-2008 Cadence Design Systems, Inc. 00005 // All Rights Reserved Worldwide 00006 // 00007 // Licensed under the Apache License, Version 2.0 (the 00008 // "License"); you may not use this file except in 00009 // compliance with the License. You may obtain a copy of 00010 // the License at 00011 // 00012 // http://www.apache.org/licenses/LICENSE-2.0 00013 // 00014 // Unless required by applicable law or agreed to in 00015 // writing, software distributed under the License is 00016 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 00017 // CONDITIONS OF ANY KIND, either express or implied. See 00018 // the License for the specific language governing 00019 // permissions and limitations under the License. 00020 //---------------------------------------------------------------------- 00021 00022 `ifndef OVM_EXTERN_REPORT_SERVER_SVH 00023 `define OVM_EXTERN_REPORT_SERVER_SVH 00024 00025 00026 //-------------------------------------------------------------------- 00027 // report 00028 // 00029 // add line and file info later ... 00030 // 00031 // this is the public access report function. It is not 00032 // visible to the user but is accessed via 00033 // ovm_report_info, ovm_report_warning, 00034 // ovm_report_error and ovm_report_fatal. 00035 //-------------------------------------------------------------------- 00036 function void ovm_report_server::report( 00037 ovm_severity s, 00038 string name, 00039 string id, 00040 string mess, 00041 int verbosity_level, 00042 string filename, 00043 int line, 00044 ovm_report_object client 00045 ); 00046 00047 string m; 00048 ovm_action a; 00049 OVM_FILE f; 00050 bit report_ok; 00051 ovm_report_handler rh; 00052 00053 rh = client.get_report_handler(); 00054 00055 // filter based on verbosity level 00056 00057 if(verbosity_level > rh.m_max_verbosity_level) begin 00058 return; 00059 end 00060 00061 // determine file to send report and actions to execute 00062 00063 a = rh.get_action(s, id); 00064 if( a == OVM_NO_ACTION ) 00065 return; 00066 00067 f = rh.get_file_handle(s, id); 00068 00069 // The hooks can do additional filtering. If the hook function 00070 // return 1 then continue processing the report. If the hook 00071 // returns 0 then skip processing the report. 00072 00073 if(a & OVM_CALL_HOOK) 00074 report_ok = rh.run_hooks(client, s, id, mess, verbosity_level, filename, line); 00075 else 00076 report_ok = 1; 00077 00078 if(report_ok) begin 00079 m = compose_message(s, name, id, mess, filename, line); 00080 process_report(s, name, id, mess, a, f, filename, line, m, verbosity_level, client); 00081 end 00082 00083 endfunction 00084 00085 00086 //-------------------------------------------------------------------- 00087 // process_report 00088 //-------------------------------------------------------------------- 00089 function void ovm_report_server::process_report( 00090 ovm_severity s, 00091 string name, 00092 string id, 00093 string message, 00094 ovm_action a, 00095 OVM_FILE f, 00096 string filename, 00097 int line, 00098 string composed_message, 00099 int verbosity_level, 00100 ovm_report_object client 00101 ); 00102 00103 // update counts 00104 incr_severity_count(s); 00105 incr_id_count(id); 00106 00107 if(a & OVM_DISPLAY) 00108 $display(composed_message); 00109 00110 if(a & OVM_LOG) begin 00111 if(f != 0 || !(a & OVM_DISPLAY)) // no point displaying twice ! 00112 begin 00113 $fdisplay(f, composed_message); 00114 end 00115 end 00116 00117 if(a & OVM_EXIT) client.die(); 00118 00119 if(a & OVM_COUNT) begin 00120 if(get_max_quit_count() != 0) begin 00121 incr_quit_count(); 00122 if(is_quit_count_reached()) begin 00123 client.die(); 00124 end 00125 end 00126 end 00127 00128 if (a & OVM_STOP) $stop; 00129 00130 endfunction 00131 00132 //-------------------------------------------------------------------- 00133 // compose_message 00134 //-------------------------------------------------------------------- 00135 function string ovm_report_server::compose_message( 00136 ovm_severity s, 00137 string name, 00138 string id, 00139 string message, 00140 string filename, 00141 int line 00142 ); 00143 ovm_severity_type sv; 00144 string time_str; 00145 string line_str; 00146 00147 sv = ovm_severity_type'(s); 00148 $swrite(time_str, "%0t", $time); 00149 $swrite(line_str, "%0d", line); 00150 00151 case(1) 00152 (name == "" && filename == ""): 00153 return {sv.name(), " @ ", time_str, " [", id, "] ", message}; 00154 (name != "" && filename == ""): 00155 return {sv.name(), " @ ", time_str, ": ", name, " [", id, "] ", message}; 00156 (name == "" && filename != ""): 00157 return {sv.name(), " ",filename, "(", line_str, ")", " @ ", time_str, " [", id, "] ", message}; 00158 (name != "" && filename != ""): 00159 return {sv.name(), " ", filename, "(", line_str, ")", " @ ", time_str, ": ", name, " [", id, "] ", message}; 00160 endcase // case(1) 00161 endfunction 00162 00163 `endif // OVM_EXTERN_REPORT_SERVER_SVH
![]() Intelligent Design Verification Project: OVM, Revision: 1.1.0 |
Copyright (c) 2008 Intelligent Design Verification. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included here: http://www.intelligentdv.com/licenses/fdl.txt |
![]() Doxygen Version: 1.4.6 Mon Sep 29 14:20:12 2008 |