• 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. getAsciiWave

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 14956
  • 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

getAsciiWave

imagesensor123
imagesensor123 over 14 years ago

Hi,

  there is a function named "getAsciiWave()", it's really useful for printing some data as a curve,but i found two arguments which are x_skip y_skip in the function, it seems that we can just skip lines from the begining of the file, so problem is that if we can pick up some lines in a file to be printed, such as we just need to print the lines from 20 to 40 as a curve, i think this function is not applicable for this requirement, do you have a better way? thanks in advance!

addition: getAsciiWave() is in the oceanref P201

Regards,

zfeng

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    Zfeng,

    You should be able to adapt this code to meet your requirements:

    Note: a newer version (June 2020) has been added in this post which allows the maximum number of rows to be read to be specified.

    /* abTable.il

    Author A.D.Beckett
    Group Custom IC (UK), Cadence Design Systems Ltd.
    Language SKILL
    Date Jan 11, 1999
    Modified
    By

    Read a waveform from a file of numbers, and return
    it as a waveform object

    e.g.

    myWave=abTable("data.asc")
    myWave2=abTable("withheader.asc" ?skip 1 ?xCol 2 ?yCol 3)

    ***************************************************

    SCCS Info: @(#) abTable.il 01/11/99.13:03:34 1.1

    */


    /**********************************************************************
    * *
    * (abTable fileName @key (xCol 1) (yCol 2) (skip 0)) *
    * *
    * Reads a tabulated file of numbers from file specified in *
    * fileName, and the remain arguments are keyword. xCol and yCol *
    * are the column numbers of the x and y axis (starting from 1). *
    * skip is the number of lines to skip at the beginning (for headers). *
    * A waveform object is returned. *
    * *
    **********************************************************************/


    (procedure (abTable fileName @key (xCol 1) (yCol 2) (skip 0))
    (let (prt line wave xVec yVec xVal yVal)
    (unless
    (setq prt (infile fileName))
    (error "Could not read waveform from file %s\n" fileName)
    )
    /* skip header lines */
    (for count 1 skip
    (gets line prt))
    /* create the empty vectors */
    (setq xVec (drCreateVec 'double 1))
    (setq yVec (drCreateVec 'double 1))
    /* these want to be zero indexed */
    (postdecrement xCol)
    (postdecrement yCol)
    (while (setq line (lineread prt))
    /* ignore blank lines */
    (unless (equal line t)
    (setq xVal (nth xCol line))
    (setq yVal (nth yCol line))
    (unless (and (numberp xVal) (numberp yVal))
    (error "Invalid data %L\n" line)
    )
    (drAddElem xVec xVal)
    (drAddElem yVec yVal)
    )
    )
    /* create the waveform object and return it */
    (setq wave (drCreateEmptyWaveform))
    (drPutWaveformXVec wave xVec)
    (drPutWaveformYVec wave yVec)
    wave
    ))

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • imagesensor123
    imagesensor123 over 14 years ago

     Hi Andrew,

         i will try it as soon as possible, thanks very much!

    Regards,

    zfeng

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • imagesensor123
    imagesensor123 over 14 years ago

     Hi,

       i changed it a little, it works very well , thanks

    Best regards,

    zfeng

    • 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