( ESNUG 361 Item 4 ) --------------------------------------------- [11/16/00]
Subject: ( ESNUG 360 #17 ) DC-Tcl 'Collections' Is Not Like Tcl 'Lists'
> I thought that this may be useful for people using Tcl as their scripting
> language for DC. Synopsys has a new form of list equivalent in Tcl called
> 'collection'. I assumed that the 'collection' worked similar to 'list'
> with their custom commands, but it did not turn out so. ... I was trying
> to remove a collection item from an collection, but it does not work.
>
> - Rajkumar Kadam
> Quantum Corp.
From: Gregg Lahti <gregg.d.lahti@intel.com>
Hi John,
I used an almost similar example in the paper I presented at Boston SNUG
'00 this year. See http://www.deepchip.com and look for the TOPS files in
"Downloads" to get a copy og my paper called "Tcl: The Good, The Bad,
and The Ugly". In the example:
DCSH method of getting all inputs without any clocks:
in_list = all_inputs() - all_clocks()
Tcl method for the same operation:
set inlist [all_inputs] ;# inlist contains a collection!
foreach_in_collection ic [all_clocks] {
set inlist [remove_from_collection $inlist [get_object_name $ic]]
}
The difference from your AE's example is the use of get_object_name, which
will get the name of the object (or collection, actually). The
remove_from_collection procedure requires the name of the object or the same
object class. In your example, you were trying to remove one class of an
object from a different class of an object. In the example I used above,
the get_object_name procedure works only for single-instance items, so one
could not use get_obect_name on the inlist variable because inlist contains
multiple collections.
One of the issues we found using collections is that they are "linked" to
the design and are not static in nature (more like a filehandle into the
design). For example, if I have a variable set to a collection of ports and
I remove one of the ports in the design, the variable containing the
collections is now invalid and I wouldn't be able to run any timing using
the variable. End result is the variables need a "reallocation" or
basically need to set the variable to the group of collections again before
using them if you've tweaked the design in any significant way. Otherwise,
you get the nasty "collection has been modified or deleted" error.
I agree it would have been nicer to use Tcl lists. However, I can see the
predicament that Synopsys has when the tools have attributes of items that
it needs to keep track of (such as load, input delay, name, and direction
attributes for a port). Using Tcl forces the user to see more of the
under-the-hood operations that DC allowed but it does give the user more
flexibility in terms of object-oriented programming (gasp!) to do synthesis
ops. You could always convert back to lists, although the headache of
managing lists of lists is not worth the effort of learning how to use
collections more effeciently, IMHO.
- Gregg Lahti
Intel Corp. Chandler, AZ
|
|