( ESNUG 365 Item 14 ) -------------------------------------------- [02/15/01]
Subject: ( ESNUG 362 #3 ) Non-Error "Errors", DC/PT Tcl Nasties & ACS
> I've been beating my head against Tcl as we're transitioning to use it
> with dc_shell. I thought I would share a little snippet I developed
> through much trial & error, and ask the world if there is a better way.
>
> The problem I'm trying to solve is that we would like some general purpose
> scripts for our project that will apply constraints to any block given to
> it. So we want a conditional application of output_delay on a reset pin,
> based on whether the reset pin exists or not. You could just:
>
> set_output_delay 5 -clock clk [get_ports {Reset}]
>
> but then Synopsys says:
>
> Warning: Can't find port 'Reset' in design 'test'. (UID-95)
> Error: Nothing matched for collection (SEL-005)
>
> if that port doesn't exist. But maybe that's okay except that errors are
> bad when grepping for real errors. Through much effort we came up with:
>
> proc exists { thingy } {
> redirect /dev/null {set a [eval $thingy]}
> if {$a == {}} {
> return 0;
> } else {
> return 1;
> }
> }
>
> if {[exists {get_ports Reset}]} {
> set_output_delay 5 -clock clk [get_ports {Reset}]
> }
>
> Synopsys does it if the pin exists, it reports nothing if it doesn't.
> Note the selection of brackets and braces, they are all important! This
> seems to work for get_ports and get_designs, I don't know what else.
> This seems really useful to me. Has anyone any better methods?
>
> - Paul Gerlach
> Tektronix, Inc. Beaverton, OR
From: Paul Zimmer <pzimmer@cisco.com>
Hi, John,
I was going to suggest that many (but not all) of the get_... commands have
a -quiet switch. This is how I handle problems like the one Paul mentioned.
pt_shell> q [get_ports *]
{"clkin", "clkout", "gen_out", "in"}
pt_shell> get_ports reset
Warning: No ports matched 'reset' (SEL-004)
Error: Nothing matched for ports (SEL-005)
pt_shell> get_ports -quiet reset
pt_shell>
But DC-tcl IS NOT LIKE Primetime Tcl!!!!!!!! I guess Synopsys needs to
work on the consistent use of their options. Gerlach told me he got
this when he tried my "-quiet" suggestion:
dc_shell-t> get_ports -quiet {Reset}
Warning: -quiet ignored on 'get_ports'
Warning: Can't find port 'Reset' in design 'test'. (UID-95)
I can't test in dc_shell because I'm not set up to run dc_tcl, but this
works in Primetime:
filter_collection [get_ports *] "full_name == reset"
filter_collection doesn't complain when the filter returns and empty
collection, and get_ports * won't get an empty collection, so this should
work.
- Paul Zimmer
Cisco Systems
---- ---- ---- ---- ---- ---- ----
From: Scott Evans <scott@sonicsinc.com>
John, an alternative would be:
if { [get_ports -quiet "Reset"] != "" } {
set_output_delay 5 -clock clk [get_ports "Reset"]
}
except that the -quiet options of get_ports isn't supported in dc_shell
(look at man get_ports). So, another, less appealing workaround is to
ignore the error in this section of your script.
set suppress_errors [concat $suppress_errors "SEL-005"]
set_output_delay 5 -clock clk [get_ports "Reset"]
Hope this helps.
- Scott Evans
Sonics, Inc. Mountain View, CA
---- ---- ---- ---- ---- ---- ----
From: Henry Berkley <asic@netcom.com>
Hi John,
I would suggest:
if [llength [get_ports Reset]] {
set_output_delay 5 -clock clk [get_ports Reset]
}
If the port exists the get_ports command returns a collection handle which
has llength of 1. If the port does not exist the get_ports command returns
an empty string which has an llength of zero.
This avoids the SEL-005 error and gets only a UID-95 warning that can be
suppressed with the suppress_message command.
- Henry George Berkley
Electronic Consulting Santa Cruz, CA
---- ---- ---- ---- ---- ---- ----
From: Peter Kamphuis <peter.kamphuis@infineon.com>
Dear John,
No answer for Paul Gerlach, but something other nasty about Tcl we've
ran into. Maybe somebody knows Tcl better and/or has a better solution
to the following. When calling external programs from dc_shell-t using
the Tcl 'exec' or Synopsys 'sh' command, you'll get an error message as
soon as the external program writes to stderr. A nice example is seen
within Synopsys' ACS where 'gmake' gets invoked:
Executing gmake -f pass0/Makefile -j > pass0/logs/gmake.log.....
Error: gmake[1]: Entering directory `abc'
Compiling design : def
...
gmake[1]: Leaving directory `abc'
Use error_info for more info. (CMD-013)
The "Error:" string gets prepended and the "CMD-013" message gets
appended to the 'gmake' output, because it writes to stderr! No errors
occurred during this run. You'll get similar behavior with any other
external tool you invoke. In some Tcl book I found the following on the
'exec', and thus also 'sh' command:
"The standard output of the program is returned as the value of the
exec command. However, if the program writes to its standard error
channel or exits with a non-zero status code, then exec raises an
error."
What you can do is using the following:
exec external_program 2>@ stdout
or, if you want to "see" the output of the external program:
puts [exec external_program 2>@ stdout]
Now the invoked program only has one output channel and the invoking
script will only be interrupted when real errors appear (non-zero exit
status). Unfortunately, if you must rely on a separate STDOUT and
STDERR of the external program (filter functionality), I don't see a
good solution. If you don't need the output, you could redirect STDERR
to /dev/null.
- Peter Kamphuis
Infineon Technologies AG Munich, Germany
============================================================================
Trying to figure out a Synopsys bug? Want to hear how 11,000+ other users
dealt with it? Then join the E-Mail Synopsys Users Group (ESNUG)!
!!! "It's not a BUG, jcooley@world.std.com
/o o\ / it's a FEATURE!" (508) 429-4357
( > )
\ - / - John Cooley, EDA & ASIC Design Consultant in Synopsys,
_] [_ Verilog, VHDL and numerous Design Methodologies.
Holliston Poor Farm, P.O. Box 6222, Holliston, MA 01746-6222
Legal Disclaimer: "As always, anything said here is only opinion."
The complete, searchable ESNUG Archive Site is at http://www.DeepChip.com
|
|