• 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. help - search a word in a file using SKILL

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 144
  • Views 1171
  • 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

help - search a word in a file using SKILL

llobak
llobak over 15 years ago

Hi,

 This is what I'm trying to do using SKILL:

- open up a file

- search a certain keyword in the file( example: i would like to search the keywork "cell height = 123" so that i can extract the value 123 from the file)

 Can anyone provide me with some help on how to achieve what i hope to do? I'm facing problem because the file that i read from does not have a fix format( this mean that the keyword that i want to search for can be anywhere in the file).

Thanks,

SL

  • Cancel
Parents
  • Quek
    Quek over 15 years ago

    Hi SL

    The following skillscript should be able to solve your problem:

    procedure( CCSreadFile(myFile pattern)
       prog( (inPort inLine inLineList)
          inPort=infile(myFile)
          unless( inPort
             printf("%s cannot be opened\n" myFile)
             return(t)
          ) ;unless

          while( gets(inLine inPort)
             if(rexMatchp(pattern inLine) then
                inLine=index(inLine pattern)
                inLineList=parseString(inLine "= ")
                return(nth(2 inLineList))
             ) ;if
          ) ;while
          close(inPort)
          inPort=nil
      ) ;prog
    ) ;procedure

    Load and execute it in ciw using:
    load "readfile.il"
    CCSreadFile("myFile.txt" "cell height")

    It will return the value of cell height. I assumed that the words "cell height = 123" appears only once in the line.

    Best regards
    Quek

    readfile.il
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Quek
    Quek over 15 years ago

    Hi SL

    The following skillscript should be able to solve your problem:

    procedure( CCSreadFile(myFile pattern)
       prog( (inPort inLine inLineList)
          inPort=infile(myFile)
          unless( inPort
             printf("%s cannot be opened\n" myFile)
             return(t)
          ) ;unless

          while( gets(inLine inPort)
             if(rexMatchp(pattern inLine) then
                inLine=index(inLine pattern)
                inLineList=parseString(inLine "= ")
                return(nth(2 inLineList))
             ) ;if
          ) ;while
          close(inPort)
          inPort=nil
      ) ;prog
    ) ;procedure

    Load and execute it in ciw using:
    load "readfile.il"
    CCSreadFile("myFile.txt" "cell height")

    It will return the value of cell height. I assumed that the words "cell height = 123" appears only once in the line.

    Best regards
    Quek

    readfile.il
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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