( ESNUG 362 Item 3 ) --------------------------------------------- [11/30/00]

From: Paul Gerlach <paulge@mdhost.cse.tek.com>
Subject: Scriptlet To Make dc_shell-tcl Shut Up About Non-Error "Errors"

John,

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 and 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


 Sign up for the DeepChip newsletter.
Email
 Read what EDA tool users really think.


Feedback About Wiretaps ESNUGs SIGN UP! Downloads Trip Reports Advertise

"Relax. This is a discussion. Anything said here is just one engineer's opinion. Email in your dissenting letter and it'll be published, too."
This Web Site Is Modified Every 2-3 Days
Copyright 1991-2024 John Cooley.  All Rights Reserved.
| Contact John Cooley | Webmaster | Legal | Feedback Form |

   !!!     "It's not a BUG,
  /o o\  /  it's a FEATURE!"
 (  >  )
  \ - / 
  _] [_     (jcooley 1991)