AWhooley Posted September 26, 2011 Report Share Posted September 26, 2011 (edited) Hi, Is it possible to control when the print method of an object is called through the message APIs e.g. 'uvm_info? For example I want to print out the contents of the transaction received by the driver but only when debugging my code. Thus I would like to be able to do the following: `uvm_info("",$sformatf("Verbosity is %s", tx.print), UVM_DEBUG); Obviously this does not work. I also tried accessing the enumerated type that UVM_DEBUG belongs to (uvm_verbosity) but it does not look like I can access it. It is possible I trued to access it incorrectly as I did not provide any hierarchical path to it or anything like that. if (uvm_verbosity == UVM_DEBUG) tx.print Anyway what would be the best approach to achieve what I would like to achieve? Should I specify "UVM_NOPRINT" for all the properties in my transaction and then write a do_print function where I print the properties using uvm_info instead? Thanks Alan Edited September 26, 2011 by tzar Formatting Quote Link to comment Share on other sites More sharing options...
mea1201 Posted September 26, 2011 Report Share Posted September 26, 2011 Have you tried passing the +UVM_VERBOSITY=UVM_DEBUG plusarg setting through your simulator call? That's one way to set the verbosity level for each simulation run. Quote Link to comment Share on other sites More sharing options...
AWhooley Posted September 26, 2011 Author Report Share Posted September 26, 2011 Hi, Yes that would let me set the verbosity level to UVM_DEBUG. However my issue is how best to wrap my call to tx.print such that it only runs when the verbosity level is set to UVM_DEBUG. Thanks Alan Quote Link to comment Share on other sites More sharing options...
uwes Posted September 27, 2011 Report Share Posted September 27, 2011 hi, for instance: `uvm_info("KIND",$sformatf("object is %s", tx.sprint()), UVM_DEBUG); as alternative if more code is required (with some downsides): if (uvm_report_enabled(UVM_HIGH)) begin // end Quote Link to comment Share on other sites More sharing options...
shail Posted September 29, 2011 Report Share Posted September 29, 2011 uvm_report_enabled is method of uvm_report_object and so is available in uvm_component, but not in uvm_transaction or uvm_sequence_item so in case where you want to print something based on verbosity, there seems to be no way, except you define a function that converts all your prints to a string and returns string... For example, a sequence item has a payload (dynamic array) of size 1-1000 . Obviously, one would not want to print the whole array every time, but only when verbosity is UVM_DEBUG or UVM_FULL. one way to do this is foreach (payload[j]) begin `uvm_info(get_type_name(), $sformatf("payload[%d] = 0x%h",j, payload[j]),UVM_FULL) end but this would print uvm-message tag in every line and is ugly.. What one would want to do is something like, what we can do for uvm_component .i.e. from within do_print method of transaction..... if (uvm_report_enabled(UVM_FULL)) begin foreach (data[i]) begin printer.print_int($sformatf("data[%d]",i),data[i],$bits(data[i]),UVM_HEX); end end How can that be done ? I hope, this is what original user wanted to ask. Quote Link to comment Share on other sites More sharing options...
uwes Posted September 29, 2011 Report Share Posted September 29, 2011 hi, all messaging is done through the context. this is either the component you are in OR via the global context which routes the msg to uvm_root. this means you simply have to pick a component and use uvm_report_enabled(). for a sequence you can use the get_sequencer() for a transaction you could choose anything applicable.if you dont know your real context you may use uvm_root. /uwe Quote Link to comment Share on other sites More sharing options...
shail Posted September 29, 2011 Report Share Posted September 29, 2011 Thanks.. Two questions here: 1) How do I know the context for a uvm_transaction that is flowing through multiple components.(note I do not want to use components uvm_report_enabled() function for a reason. 2) Curious to know, what type of problems could be created if uvm_transaction is extended of uvm_report_object instead of uvm_object in uvm ? 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.