cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rgaddi
Adventurer
Adventurer
4,216 Views
Registered: ‎04-22-2008

Raise warning/error like the tools do

This has got to be a simple question, but I just can't find the answer.  I can puts a message that starts off "ERROR: [Vivado 12-1411] Cannot..."  But that doesn't actually make it an error that comes up red, appears in the Messages log and is filterable as an error, etc.  Likewise warnings, critical warnings, etc.

 

 

Anyone know what the mechanism to use for that is?

0 Kudos
10 Replies
prathikm
Moderator
Moderator
4,187 Views
Registered: ‎09-15-2016

Hi @rgaddi,

 

Are you talking about changing severity of message in Vivado? If yes, check this Answer Record for more information on how-to.

 

But if you are trying to filter out error messages in log, in tool search for the word "error" and click highlight. Another good idea is to use tool like Notepad++ etc. for log and search for term "error" which displays option to "find all in current document".

 

--------------------------------------------------------------
Please mark the appropriate answer as "Accept as solution" if information provided is helpful.
Give 'Kudos' to a post which you think is useful and reply oriented.
--------------------------------------------------------------

 

rgaddi
Adventurer
Adventurer
4,133 Views
Registered: ‎04-22-2008

@prathikm, that's not what I'm talking about.

 

If in the Tcl console I type the command

 

get_pins badvalue

 

I get a response of "WARNING: [Vivado 12-508] No pins matched 'badvalue'."  In the Tcl console, that message is in orange to indicate a warning.  It also appears in the Messages tab as a warning.  In short, there is some underlying mechanism that is called to emit that message as a warning, which causes that warning to appear in all the ways that warnings appear.

 

From my own Tcl code, how do I generate a warning through that same mechanism?

 

 

0 Kudos
prathikm
Moderator
Moderator
4,120 Views
Registered: ‎09-15-2016

Hi @rgaddi,

 

I guess you can try something like catch command with if-else condition for this.

Please check UG894 (page no.62). 

 

--------------------------------------------------------------
Please mark the appropriate answer as "Accept as solution" if information provided is helpful.
Give 'Kudos' to a post which you think is useful and reply oriented.
--------------------------------------------------------------

0 Kudos
amaccre
Moderator
Moderator
4,105 Views
Registered: ‎04-24-2013

Hi @rgaddi,

 

Check out the create_drc_check command. You can see it's syntax with create_drc_check -help

 

 

Here is a section from the help file.

 

Capture.JPG

 

You can set the severity for any message to be higher or lower, however you cannot downgrade errors.

These are there to prevent damage, they may appear to be downgraded but will still apply.

 

set_msg_config -id "Synth 8-32" -new_severity "INFO"
set_msg_config -id "Synth 8-32" -suppress

 

Let me know if this helps.

 

Best Regards
Aidan

 

 

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------
0 Kudos
rgaddi
Adventurer
Adventurer
3,979 Views
Registered: ‎04-22-2008

Thanks @amaccre, but that's still not quite it.  I'm not trying to add a DRC procedure into the design.  I just wanted to raise an error from a script I'm running that imports my pin definitions from my schematic tool and have that error be highly noticeable the way the rest of the tools' errors are.  I was assuming that there must have been some hook that does that; prints a given string in red and marks it in the Errors pane.  Apparently that's just not a thing that Vivado exposes in Tcl.  Odd choice.

amaccre
Moderator
Moderator
3,967 Views
Registered: ‎04-24-2013

Hi @rgaddi,

 

If you are calling a script using the source tcl command e.g. source some_script.tcl then the commands are sent to the tcl parser.

 

If the commands are Vivado commands such as get_pins then the output of these will show in the Messages tab with the appropriate error level Warning / Critical Warning etc. i.e.

 

In the tcl console:

# get_pins *fred*
WARNING: [Vivado 12-508] No pins matched '*fred*'.

 

Results in the Messages tab:

[Vivado 12-508] No pins matched '*fred*'.

 

If it is a normal TCL syntax error e.g you forget to define a variable then it will show in the tcl console as red but not get written to the Messages tab as Vivado has not been told how to handle this.

 

If you want Vivado to handle these issues gracefully then you need to write the error handling code, return the error and have the rules checker apply the correct level of severity.

 

In the previous example the dataWidthCheck procedure has this format i.e. 

 

if {[llength $vios] > 0} {
    return -code error $vios
} else {
    return {}
}

 

The create_drc_check then sets severity of the error for the Messages tab, in this case it was an advisory but you could make it an error.

 

create_drc_check -name {RAMW-1} -hiername {RAMB Checks} -desc {Data Width Check} -rule_body dataWidthCheck -severity Error

 

You cannot just write puts "ERROR: [Vivado 12-1411] Cannot..."  into a script and expect VIvado to know what to do with it.

 

Best Regards

Aidan

 

 

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------
0 Kudos
eanema
Visitor
Visitor
2,084 Views
Registered: ‎01-23-2019

I know this thread is a few years old now but I just wanted to add some (somewhat) useful (and hopefully relavent) information. I am attempting to write a script that throws an error/critical warning/warning/info/status and after much digging I eventually turned up the send_msg_id command. This command is used to do just that. The help screen give some useful information (send_msg_id -help), but basically you would use it like this for example:

 

send_msg_id "MyApp 10-101" {CRITICAL WARNING} {Too much information.}

 

When you execute this command in the Tcl console window within a project everything works fine, so if you call a script that contains this function all is good and your critical warning will be displayed.

 

BUT, and this is the real issue, it will not work in a pre/post.tcl hook script. This is unfortunate because it really removes usability of the pre/post script to handle any error condition in the script. The reason it will not work is because the pre/post hook scripts are run in non-project mode and your project does not exist in this context. So ya, completly silly but aparently thats just the way it is. 

 

For more reading on this topic have a read through this link here: using tcl hook scripts

 

The only thing that I could come up with to grab the attention of the user in project mode was to return an error from the script. Something like:

return -code error "Error: I'm sorry, Dave. I'm afraid I can't do that."

 

The above code will exit the hook script, cause an error to be displayed and a message to appear in the messages window:

ERROR: [runtcl-1] Error: I'm sorry, Dave. I'm afraid I can't do that.

 

Anyways, maybe this will change in a newer version of Vivado, but I'm not counting on it...

Hope this helped

fransschreuder
Participant
Participant
1,349 Views
Registered: ‎08-12-2010

This is what I was looking for, the other example works, but is too complicated.

0 Kudos
ryanjohnson8
Explorer
Explorer
278 Views
Registered: ‎05-30-2017

Why is "send_msg_id" not in UG835, TCL Command Reference Guide ?

chinmays
Xilinx Employee
Xilinx Employee
221 Views
Registered: ‎06-27-2018

@ryanjohnson8 ,

It should be. Let me check, why this command is still not added in UG835. Meanwhile, you can find info about this command in Vivado itself, just run send_msg_id -help in tcl console.

~Chinmay

0 Kudos