• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. quotation mark replacement with pcreReplace?

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 14455
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

quotation mark replacement with pcreReplace?

oyayla
oyayla over 6 years ago

Hi,

I am trying to get outputs from ocean using  outputs() function into a list from a post layout simulation(netlist is dspf file). The format of outputs() is sth like this: /VCO/VCO_CORE/CAPBANK[0]/MMN0:G

To be able to plot these with ocean, I need to convert them to below format:

v("VCO.VCO_CORE\\/CAPBANK\\[0\\]\\/MMN0\\:G)

In other words, I need to use double escape character before "/ [ ] : " characters. We can assume VCO section is common for all saved nets so /VCO/ => VCO. is not much an issue. Also I was able to change [ ] : and / with pcreCompile and pcreReplace but I couldn't figure out how to add quotation mark after v(

To add double backslach before : [ ]/ , I have below

comPat2 = pcreCompile("[:/\\[\\]]")

pcreReplace(comPat1 "/VCO/VCO_CORE/CAPBANK[0]/MMN0:G" "\\\\&" 0)

The question is how I can replace quotation mark in pcreReplace such that /VCO/ becomes v("VCO?

Thanks

yayla

Version Info:

ICADV12.3 64b 500.21

spectre -W =>

Tool 'cadenceMMSIM' Current project version '16.10.479'
sub-version  16.1.0.479.isr9

  • Cancel
Parents
  • oyayla
    oyayla over 6 years ago

    I am putting the sample of code I am trying to fix. As mentioned earlier, this script is supposed to get saved nets from outputs() function, post-process with pcre and plot it.

        sigList_raw = outputs()

        ; Compile patterns
        comPatSpecial = pcreCompile("[:/\\[\\]]")
        comPatTop = pcreCompile("/VCO/(.*)")

        sigList = list(nil)
       
        foreach(sg sigList_raw
            pcreExecute(comPatTop sg)
            sigNet = pcreSubstitute("v(\\\"VCO\\.\\1\\\")")

            ;Add escapes for special characters
            sigNet = pcreReplace(comPatSpecial sigNet "\\\\&" 0)

           plot(sigNet)

        ); foreach sigList

    Example input: /VCO/VCO_CORE/CAPBANK[0]/MMN0:G

    Expected output: v("VCO.VCO_CORE\\/CAPBANK\\[0\\]\\/MMN0\\:G")

    and plot the waveform.

    Current issue with this script is that final signal names are strings as below and when I use evalstring, it gives below error message:

    "v(\"VCO.VCO_CORE\\/CAPBANK\\[0\\]\\/MMN0\\:G\")"

    Error message:

    *Error* evalstring: argument #1 should be a string (type template = "ts")

    Thanks

    yayla

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • oyayla
    oyayla over 6 years ago

    I am putting the sample of code I am trying to fix. As mentioned earlier, this script is supposed to get saved nets from outputs() function, post-process with pcre and plot it.

        sigList_raw = outputs()

        ; Compile patterns
        comPatSpecial = pcreCompile("[:/\\[\\]]")
        comPatTop = pcreCompile("/VCO/(.*)")

        sigList = list(nil)
       
        foreach(sg sigList_raw
            pcreExecute(comPatTop sg)
            sigNet = pcreSubstitute("v(\\\"VCO\\.\\1\\\")")

            ;Add escapes for special characters
            sigNet = pcreReplace(comPatSpecial sigNet "\\\\&" 0)

           plot(sigNet)

        ); foreach sigList

    Example input: /VCO/VCO_CORE/CAPBANK[0]/MMN0:G

    Expected output: v("VCO.VCO_CORE\\/CAPBANK\\[0\\]\\/MMN0\\:G")

    and plot the waveform.

    Current issue with this script is that final signal names are strings as below and when I use evalstring, it gives below error message:

    "v(\"VCO.VCO_CORE\\/CAPBANK\\[0\\]\\/MMN0\\:G\")"

    Error message:

    *Error* evalstring: argument #1 should be a string (type template = "ts")

    Thanks

    yayla

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to oyayla

    In theory you should just be able to use the name from outputs() directly, but I think in this case the name is confusing the mapping code. So I suggest that instead you do:

    sigList=outputs(?map nil)
    foreach(sg sigList
      plot(v(sg))
    )

    This will be much simpler - you're over-complicating the problem. I wouldn't use evalstring anyway, I'd use a pattern substitution and then pass the result to the v() function; however, the approach of getting the unmapped names (with ?map nil) is even simpler and avoids having to do all the substitution.

    Regards,

    Andrew.

    • Cancel
    • Vote Up +2 Vote Down
    • Cancel
  • oyayla
    oyayla over 6 years ago in reply to Andrew Beckett

    Hi Andrew,


    Thanks for the reply. I have tried both plot(v(sg)) way and ?map nil way. Both of them are working as you mentioned.

    Thanks for the suggestions which saved me the above complications.

    Thanks,

    yayla

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information