( ESNUG 288 Item 8 ) ----------------------------------------------- [5/7/98]

Subject: ( ESNUG 287 #13 ) Mapping From Hierarchical Paths -> Design Names

> I have a uniquified, hierarchical design.  I would like to start with
> a path to a cell
>
>   "h2u1/h3u4/lh_out_reg"
>
> and figure out which design it is in so I can change my current_design
> to it.  Conceptually, I want to
>
>   cd "h2u1/h3u4".
>
> Is there a simple way to go back and forth between paths and design
> names?  I have tried the current_instance command, but I really need
> to cd between designs, not instances.  I want to take the path of a
> gate or a net, cd to the design containing it, then run a script that
> adds and deletes nets and cells.  I can only do these commands in the
> design itself.
>
>   - Will Leavitt
>     GigaNET, Inc.                           Concord, MASS


From: James Muha~ <jmuha@sedona.ch.intel.com>

John,

First, set the current_instance to the instance containing the cell, then
set the current_design to the current_reference.  You need to append "/.."
to the path to the leaf cell in order to set the current_instance to the
instance containing the cell.

  current_instance = <path_to_leaf_cell>/..
  current_design = current_reference

  - James Muha~
    Intel

         ----    ----    ----    ----    ----    ----   ----

From: "Tom Harrington" <tharring@ford.com>

Hey, John,

Have you tried using current_reference?  It's useful for converting an
instance name to the corresponding design name.  It's not a command but
rather a variable that always contains the current instance's reference.
If the current_instance is the cell you're interested in, you can do
'current_design current_reference' to set the current design to the
corresponding cell.  You could also do 'find design current_reference'
or 'list current_reference' to make sure you know where you are.

Also, keep in mind that current_instance can be used like the Unix 'cd'
command; for example, "current_instance .." will move you up a level.
So with current_reference, you can cd between instances, and then
get the design names.  It's awkward, but it works.

In the example above, since h2u1/h3u4/lh_out_reg is the path to a cell,
you could set current_design to the design corresponding to h2u1/h3u4
as follows:

  current_instance h2u1/h3u4/lh_out_reg/..
  current_design current_reference

If lh_out_reg is a leaf cell, you can't set current_instance to it directly.
But the above will work just fine and put you at the cell containing
lh_out_reg.

Of course, if you could just start with h2u1/h3u4 as the initial path,
you could do it this way:

  current_instance h2u1/h3u4
  current_design current_reference

I think that current_reference will do what you need.  Good luck.

  - Tom Harrington
    Ford Microelectronics                     Colorado Springs, CO

         ----    ----    ----    ----    ----    ----   ----

From: [ Synopsys R&D ]

John,

In response to ( ESNUG 287 Item 13 ), try the following.

  execute (-s dirname h2u1/h3u4/lh_out_reg)
  parent_cell = dc_shell_status
  get_attribute parent_cell ref_name
  foreach(des, dc_shell_status) {}
  current_design des

  - [ Synopsys R&D ]

         ----    ----    ----    ----    ----    ----   ----

From: Will Leavitt <leavitt@giga-net.com>

Well, posting to esnug motivated me to dig a little deeper.  All I need to
do is get the ref_name attribute:

  dc_shell> get_attribute find(cell, "h2u1/h3u4") ref_name
     Performing get_attribute on cell 'h2u1/h3u4'.
     {"crc_gen_2"}
  dc_shell> current_design dc_shell_status
     Current design is 'crc_hec_2'.
     {"crc_hec_2"}

  - Will Leavitt
    GigaNET

         ----    ----    ----    ----    ----    ----   ----

From: [ Synopsys Methodology Consulting ]

John,

This may not be your idea of simple, but it works:

1) Create the following Bourne shell script (called "cdinst.sh"):

  #!/bin/sh
  inst_list=`echo $1 | awk -F/ '{ for (i=1;i<NF;i++) print $i " "}'`
  for inst in $inst_list
  do
    echo get_attribute $inst ref_name
    echo current_design dc_shell_status
  done

NOTE: This script assumes that the argument given is a hierarchical cell or
net reference. If it's a pin reference, you'll have to modify the awk
command to strip off the last two elements instead of just one.

2) make sure it's executable and in the path, then in dc_shell:

  dc_shell> sh cdinst.sh h2u1/h3u4/lh_out_reg > cdinst.dc
  dc_shell> include cdinst.dc

NOTE: The "cdinst.sh" script creates the following commands:

  get_attribute h2u1 ref_name
  current_design dc_shell_status
  get_attribute h3u4 ref_name
  current_design dc_shell_status

I hope this helps.

  - [ Synopsys Methodology Consulting ]



 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)