aquarioz Posted March 27, 2013 Report Share Posted March 27, 2013 Hi all! I've been trying to completely do without the full path of filename when reporting for example instead of UVM_INFO /1/2/3/4/5/6/7/8/filename.sv (linenum) "Message" I want completely remove or shorten the path UVM_INFO /.../filename.sv (linenum) "Message" I've tried using UVM_REPORT_DISABLE_FILE_LINEUVM_REPORT_DISABLE_FILE But it completely removes the filename and line num from the report. I'm looking into the uvm source code and make my own modifications, but I don't want to mess around with the libraries since I share the installation directories. Anybody has done this before? Thank you! Quote Link to comment Share on other sites More sharing options...
dave_59 Posted March 28, 2013 Report Share Posted March 28, 2013 You're much better off post-processing this in a PERL/AWK/SED script. Quote Link to comment Share on other sites More sharing options...
ajeetha Posted April 1, 2013 Report Share Posted April 1, 2013 As per LRM the `__FILE__ expands to the filename as provided to the compiler. So in your compile script if you provide absolute path, you will get /abs/path/to/file, else ../relative_path: For instance try the below code: module m; initial begin $display ("File: %0s Line: %0d", `__FILE__, `__LINE__); end endmodule : m qverilog C:/tools/cygwin/home/Ajeetha/proj/svlog/FILE_macro_rel_path/FILE_macro_rel_path.sv vs. qverilog ../FILE_macro_rel_path.sv See what happens HTH Ajeetha, CVC www.cvcblr.com/blog Quote Link to comment Share on other sites More sharing options...
adielkhan Posted April 12, 2013 Report Share Posted April 12, 2013 hi, Personally, I dont see why you need the line/filename at all. if you are debugging somethign then bring it up in your gui and double click the message and it will take you to the `uvm_info line being called in your code. Therefore, I compile with the disable FILE_LINE option. However, some people like to see tonnes of messages appear in their logifles and for those they should review Brians' blog: http://www.vmmcentral.org/vmartialarts/2012/04/customizing-uvm-messages-without-getting-a-sunburn/ Quote Link to comment Share on other sites More sharing options...
arustagi@broadcom.com Posted April 15, 2013 Report Share Posted April 15, 2013 You can extend uvm report server and override compose message function. Just choose what you want to print and then set this report server as your own report server. Quote Link to comment Share on other sites More sharing options...
kaushalmodi Posted October 15, 2013 Report Share Posted October 15, 2013 As rustagi said, you can extend the uvm_report_server and have your own compose_message function. Here's what I do to have a filename without path and to customize other parts of the message too. class custom_report_server extends uvm_report_server; virtual function string compose_message ( uvm_severity severity, string name, string id, string message, string filename, int line ); // Declare function-internal vars string filename_nopath = ""; uvm_severity_type severity_type = uvm_severity_type'( severity ); begin // Extract just the file name, remove the preceeding path foreach(filename[i]) begin if (filename[i]=="/") filename_nopath = ""; else filename_nopath = {filename_nopath, filename[i]}; end // number of initial spaces in the second line // = 8 + 1(space) + 1(@) + 7 + 2("ns") + 3(spaces) + 2(indentation) = 24 return $psprintf( "%-8s @%7tns%3s\"%s\" >%s(%0d)\n%24s%s [%s]", severity_type.name(), $time/1000.00, " ", name, filename_nopath, line, " ", message, id ); end endfunction: compose_message endclass: custom_report_server I would then put this in the base test. It is up to you where you want the new server to be effective: before build, before run, etc. virtual function void build_phase(uvm_phase phase); // Set the custom report server to output the uvm_info messages in custom format custom_report_server my_server = new; uvm_report_server::set_server( my_server ); super.build_phase(phase); ...... endfunction ssmith 1 Quote Link to comment Share on other sites More sharing options...
MohamedSamy Posted March 15, 2016 Report Share Posted March 15, 2016 Based on other replies I have done the following: class custom_report_server extends uvm_report_server; function new(string name="my_report_server"); super.new(); endfunction : new function string getShortFileName(string s); int offset = 0; int lastChar; string shortFileName; int slashPosition; lastChar = s.len()-1; for (int i = lastChar; i >= offset; i=i-1) begin if (s.getc(i) inside {"/", "\\"}) begin slashPosition = i; break; end end // for loop shortFileName = s.substr(slashPosition+1, lastChar); return shortFileName; endfunction virtual function string compose_message( uvm_severity severity, string name, string id, string message, string filename, int line ); uvm_severity_type sv; string time_str; string line_str; sv = uvm_severity_type'(severity); $swrite(time_str, "%0t", $realtime); case(1) (name == "" && filename == ""): return {sv.name(), " @ ", time_str, " [", id, "] ", message}; (name != "" && filename == ""): return {sv.name(), " @ ", time_str, ": ", name, " [", id, "] ", message}; (name == "" && filename != ""): begin $swrite(line_str, "%0d", line); return {sv.name(), " ",getShortFileName(filename), "(", line_str, ")", " @ ", time_str, " [", id, "] ", message}; end (name != "" && filename != ""): begin $swrite(line_str, "%0d", line); return {sv.name(), " ", getShortFileName(filename), "(", line_str, ")", " @ ", time_str, ": ", name, " [", id, "] ", message}; end endcase endfunction endclass: custom_report_server and in the build_phase of the test virtual function void build_phase(uvm_phase phase); // Set the custom report server to output the uvm_info messages in custom format custom_report_server my_server = new; uvm_report_server::set_server( my_server ); super.build_phase(phase); ... endfunction Quote Link to comment Share on other sites More sharing options...
halfrater Posted March 17, 2016 Report Share Posted March 17, 2016 Based on other replies I have done the following: class custom_report_server extends uvm_report_server; ... endclass: custom_report_server and in the build_phase of the test virtual function void build_phase(uvm_phase phase); ... endfunction How do you inherit a abstract class (uvm_report_server) with a lot of 'pure virtual' methods overriding only a single 'compose_message' method? Quote Link to comment Share on other sites More sharing options...
halfrater Posted March 17, 2016 Report Share Posted March 17, 2016 The issue is closed.UVM 1.2 requires ‘uvm_default_report_server’ extending and ‘compose_report_message(..)’ method overriding. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.