How to replace netname with net expression

Discussion in 'Cadence' started by art.sib.pm, Oct 21, 2008.

  1. art.sib.pm

    art.sib.pm Guest

    Does anyone know how can I replace all net names like net0111 with net
    expression [@net0100:%:net0100!]. I've imported spectre netlist and
    need to do such replacement. Thanks
     
    art.sib.pm, Oct 21, 2008
    #1
  2. art.sib.pm

    Riad KACED Guest

    Hi,

    The is a one-liner Perl that could do the trick for you. Just type in
    the following into your UNIX prompt:

    perl -i.bak -ne 's/(net\d+)/\[\@$1:%:$1!\]/ig;' -ne print
    SpectreNetlist.scs

    So if your SpectreNetlist.scs contans :
    //
    net01 myNEt01
    net345
    net564
    net45 prefixneT45suffix
    net45
    //
    Then this command will edit your file in place to make it like this:
    //
    [@net01:%:net01!] my[@NEt01:%:NEt01!]
    [@net345:%:net345!]
    [@net564:%:net564!]
    [@net45:%:net45!] prefix[@neT45:%:neT45!]suffix
    [@net45:%:net45!]
    //
    A copy of your original netlist is saved as SpectreNetlist.scs.bak

    BTW this script does not convert net0111 into net0100 as you mentioned
    above. In other words, the number 0111 is not converted into 0100. I
    guess was a typo in your post.

    You have got to learn working with regular expressions, no matter the
    language, in case you need to do this sort of things regularly.

    Cheers,
    Riad.
     
    Riad KACED, Oct 30, 2008
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.