• 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 Design
  3. how to get values of sampling points

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 125
  • Views 15860
  • 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

how to get values of sampling points

Holz
Holz over 4 years ago

Hello everyone,

I'm running sweep simulation(around 50000 point sweeps), and I get 50000 results of signal "cout", I want to sample some points of "cout" and store values through expression. I tried to do it like:

     value(v("/cout" ?result "tran") 2e-11 ?period 1e-12 ?xName "time")

Where "2e-11" is start point, "1e-12" is sampling period. But it gives me a wave, not values of sampling points, and I also checked"sample()", it looks same to value(). Is there any other function that can be used for this case? Or I must try to use SKILL?

Thanks for help!

Regards,

Holz

  • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago

    Dear Holz,

    > I'm running sweep simulation(around 50000 point sweeps), and I get 50000

    > results of signal "cout", I want to sample some points of "cout" and store

    > values through expression....

    There are numerous ways to extract samples of a waveform from a set of corner simulations. I am not sure if you want to save your samples to a text file or a vector. From your post, it is very clear you don't want to save the samples into a new waveform!

    The method that one might choose probably depends on one's level of familiarly with ocean scripts, veriloga, or SKILL. Hence, I'm not sure which is best to recommend so will take a guess...

    You can use the ocean function ocnPrint() to save samples of one or more waveforms to a text file over a specific x-axis range (time in your case). Hence, if you include ocnPrint(0 in an ocean script expression as an output expression in an Assembler/Explorer corner sweep, the samples you specify will be written to a file. Note you will need to set the file name to a unique name for each corner or all corners will write to the same file. From the ocean reference manual, the syntax for the ocnPrint(0 command follows. In Figure 1, I illustrate how to include the script as an Explorer/Assembler output. In this case, the file "test_print" contains the ocnPrint() command. I created a quick example ocean script file called "test_print.ocn" and include it as an ocean script. I've attached the file as well as the resulting sampled data from a waveform n10 of a simulation.

    I hope this helps Holz!

    Shawn

    Figure 1

    Fullscreen test_print.ocn.txt Download
    ocnPrint( ?output "test_file_n10_sampled_wave.txt" VT("/n10") ?from 2e-09 ?to 9e-09 ?step 1e-10)
    

    Fullscreen test_file_n10_sampled_wave.txt Download
    time (s)          VT("/n10") (V)
    
        2n              719.93m         
        2.1n            719.93m         
        2.2n            719.93m         
        2.3n            719.93m         
        2.4n            719.93m         
        2.5n            719.93m         
        2.6n            719.93m         
        2.7n            719.93m         
        2.8n            719.93m         
        2.9n            719.93m         
        3n              719.93m         
        3.1n            719.93m         
        3.2n            719.93m         
        3.3n            719.93m         
        3.4n            719.93m         
        3.5n            719.93m         
        3.6n            719.93m         
        3.7n            719.93m         
        3.8n            719.93m         
        3.9n            719.93m         
        4n              719.93m         
        4.1n            719.93m         
        4.2n            719.93m         
        4.3n            719.93m         
        4.4n            719.93m         
        4.5n            719.93m         
        4.6n            719.93m         
        4.7n            719.93m         
        4.8n            719.93m         
        4.9n            719.93m         
        5n              719.93m         
        5.1n             50.881u        
        5.2n             50.881u        
        5.3n             50.881u        
        5.4n             50.881u        
        5.5n             50.881u        
        5.6n             50.881u        
        5.7n             50.881u        
        5.8n             50.881u        
        5.9n             50.881u        
        6n               50.881u        
        6.1n             50.881u        
        6.2n             50.881u        
        6.3n             50.881u        
        6.4n             50.881u        
        6.5n             50.881u        
        6.6n             50.881u        
        6.7n             50.881u        
        6.8n             50.881u        
        6.9n             50.881u        
        7n               50.881u        
        7.1n             50.881u        
        7.2n             50.881u        
        7.3n             50.881u        
        7.4n             50.881u        
        7.5n             50.881u        
        7.6n             50.881u        
        7.7n             50.881u        
        7.8n             50.881u        
        7.9n             50.881u        
        8n               50.881u        
        8.1n             50.881u        
        8.2n             50.881u        
        8.3n             50.881u        
        8.4n             50.881u        
        8.5n             50.881u        
        8.6n             50.881u        
        8.7n             50.881u        
        8.8n             50.881u        
        8.9n             50.881u        
        9n               50.881u        
    

    ocnPrint

    ocnPrint( 
    [ ?output t_filename | p_port ] [ ?precision x_precision ] [ ?numberNotation s_numberNotation ] [ ?numSpaces x_numSpaces ] [ ?width x_width ] [ ?from x_from ] [ ?to x_to ] [ ?step x_step ] [ ?linLog t_linLog ] o_waveform1 [ o_waveform2 ... ] ) => t / nil

    Description

    Prints the text data of the waveforms specified in the list of waveforms.

    If you provide a filename as the ?output argument, the ocnPrint command opens the file and writes the information to it. If you provide a port (the return value of the SKILL outfile command), the ocnPrint command appends the information to the file that is represented by the port. There is a limitation of ocnPrint for precision. It works upto 30 digits for the Solaris port and 18 digits for HP and AIX.

    ocnPrint() prints z-state as “HiZ” for digital signals.

    Arguments

    ?output t_filename

    File in which to write the information. The ocnPrint command opens the file, writes to the file, and closes the file. If you specify the filename without a path, the OCEAN environment creates the file in the directory pointed to by your SKILL Path. To find out what your SKILL path is, type getSkillPath() at the OCEAN prompt.

    ?output p_port

    Port (previously opened with outfile) through which to append the information to a file. You are responsible for closing the port. See the outfile command for more information.

    ?precision x_precision

    The number of significant digits to print. This value overrides any global precision value set with the setup command.

    Valid values: 1 through 16

    Default value: 6

    Note: To print the specified significant number of digits, ensure that the value of the x_width argument is the same or greater than the value of the x_precision argument.

    ?numberNotation s_numberNotation

    The notation for print ed information. This value overrides any global format value set with the setup command.

    Valid values: ’suffix, ’engineering, ’scientific, ’none

    Default value: ’suffix

    The format for each value is ’suffix: 1m, 1u, 1n, etc.; ’engineering: 1e-3, 1e-6, 1e-9, etc.; ’scientific: 1.0e-2, 1.768e-5, etc.; ’none.

    The value ’none is provided so that you can turn off formatting and therefore greatly speed up printing for large data files. For the fastest printing, use the ’none value and set the ?output argument to a filename or a port, so that output does not go to the CIW.

    ?numSpace x_numSpaces

    The number of spaces between columns.

    Valid values: 1 or greater

    Default value: 4

    ?width x_width

    The width of each column.

    Valid values: 4 or greater

    Default value: 14

    ?from x_from

    The start value at x axis for the waveform to be printed.

    ?to x_to

    The end value at x axis for the waveform to be printed.

    ?step x_step

    The step by which text data to be printed is incremented.

    ?linLog t_linLog

    The scale to be used for printing.

    Valid values: Linear, Log

    Default value: Linear

    o_waveform1

    Waveform object representing simulation results that can be displayed as a series of points on a grid. (A waveform object identifier looks like this: srrWave:XXXXX.)

    o_waveform2

    Additional waveform object.

    Value Returned

    t

    Returns t if the text for the waveforms is printed.

    nil

    Returns nil and an error message if the text for the waveforms cannot be printed.

    Example

    ocnPrint( v( "/net56" ) ) 
    => t

    Prints the text for the waveform for the voltage of net56.

    ocnPrint( vm( "/net56" ) vp( "/net56" ) ) 
    => t

    Prints the text for the waveforms for the magnitude of the voltage of net56 and the phase of the voltage of net56.

    ocnPrint( ?output "myFile" v( "net55" ) ) 
    => t

    Prints the text for the specified waveform to a file named myFile.

    ocnPrint( ?output "./myOutputFile" v("net1") ?from 0 ?to 0.5n ?step 0.1n )

    Prints the text for the specified waveform from 0 to 0.5n on the x axis in the incremental steps of 0.1n.

    You may also be interested in a recent article that speaks to the different means to save waveform data to an ASCII file (some of which are not consistent with what I think your needs are) at the On-line support URL:

    https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1O0V000009MpZLUA0&pageName=ArticleContent

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Holz
    Holz over 4 years ago in reply to ShawnLogan

    Hello Shawn,

    thanks a lot for your detailed answers! I solve my problem!

    Regards,

    Holz

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago in reply to Holz

    Dear Holz,

    Holz said:
    I solve my problem!

    Wow - grea!  I am very happy to read the response was helpful to you! Thank you for letting us know and good luck!

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Holz
    Holz over 4 years ago in reply to ShawnLogan

    Hello Shawn,

    does ocnprint() support csv file? I mean can I store data directly into a csv file rather than txt file?

    And I am trying to run a sweep simulation, and ocnprint() only gives me one simulation result, is it possible that I get all results in a file through ocnprint()?

    Thanks again for help!

    Regards,

    Holz

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago in reply to Holz

    Dear Holz,

    > does ocnprint() support csv file? I mean
    > can I store data directly into a csv file rather
    > than txt file?

    There is a different function that was recently introduced to store the results into a .csv formatted file awvSaveToCSV(). An example of it's use, including a line to create the file name, is shown below for two waveform files named vnegr_sampled and vout_sampled.

    sprintf(print_filename "%s_waves_%s_case_%d_%s.csv" cell_name process_case sim_case date)

    awvSaveToCSV( list(vnegr_sampled vout_sampled) print_filename)

    The full set of syntax information for the function follows:

    awvSaveToCSV(
    l_waveform
    t_fileName
    [ ?from x_from ]
    [ ?to x_to ]
    [ ?precision x_precision ]
    [ ?step x_step ]
    [ ?linLog g_linLog ]
    )
    => t / nil
    Description
    Saves the waveform data to the specified CSV file.

    Arguments
    l_waveform

    Input waveform or list of input waveforms.

    t_fileName

    Name of the CSV file in which waveform data is to be saved.

    ?from x_from

    Starting X-axis value after which the waveform data is to be saved.

    ?to x_to

    End X-ais value upto which the waveform data is to be saved.

    ?precision x_precision

    Precision value to be used.

    ?step x_step

    Step value to be used.

    ?linLog g_linLog

    Specifies whether the waveform data is to be saved in a linear or logarithmic format. When this argument is set to true, data is saved in the linear format. When set to false, the logarithmic format is used.
    Examples

    awvSaveToCSV(wave filename)
    This example saves the specified waveform in the given CSV file.

    awvSaveToCSV( list(wave1 wave2 wave3) filename)
    This example saves a list of specified waveforms (wave1, wave2, and wave3) in the given CSV file.

    awvSaveToCSV( wave filename ?from 10n ?to 200n)
    This function saves the specified waveform in the given CSV file that starts from 10n and ends at 200n.

    awvSaveToCSV( wave filename ?from 10n ?to 200n ?step 10n)

    awvSaveToCSV( wave filename ?from 10n ?to 200n ?step 10n ?linLog "log")

    awvSaveToCSV( wave filename ?from 10n ?to 200n ?step 10n ?linLog "log" ?precision 12)

    The first few lines of my example csv file are:

    sample(getData("vnegr" ?resultsDir "/scratch/noclean/dcd_serdes/sml/simulation/sdd5e_TB/test_inv_bias_decay/maestro/results/maestro/Interactive.10/1/sdd5e_TB_test_inv_bias_decay_x0_1meg_tran_spectre_X_83_ohms/psf" ?result "tran") 0.0 0.015 "linear" 7.8125e-10) X,sample(getData("vnegr" ?resultsDir "/scratch/noclean/dcd_serdes/sml/simulation/sdd5e_TB/test_inv_bias_decay/maestro/results/maestro/Interactive.10/1/sdd5e_TB_test_inv_bias_decay_x0_1meg_tran_spectre_X_83_ohms/psf" ?result "tran") 0.0 0.015 "linear" 7.8125e-10) Y,sample(getData("vout" ?resultsDir "/scratch/noclean/dcd_serdes/sml/simulation/sdd5e_TB/test_inv_bias_decay/maestro/results/maestro/Interactive.10/1/sdd5e_TB_test_inv_bias_decay_x0_1meg_tran_spectre_X_83_ohms/psf" ?result "tran") 0.0 0.015 "linear" 7.8125e-10) X,sample(getData("vout" ?resultsDir "/scratch/noclean/dcd_serdes/sml/simulation/sdd5e_TB/test_inv_bias_decay/maestro/results/maestro/Interactive.10/1/sdd5e_TB_test_inv_bias_decay_x0_1meg_tran_spectre_X_83_ohms/psf" ?result "tran") 0.0 0.015 "linear" 7.8125e-10) Y
    0,4.78940607889986e-05,0,0.4504929609687573
    7.8125e-10,7.054683610639453e-05,7.8125e-10,0.4505195821295282
    1.5625e-09,8.667005847049861e-05,1.5625e-09,0.4505385307778326


    > And I am trying to run a sweep simulation,
    > and ocnprint() only gives me one simulation
    > result, is it possible that I get all results in
    > a file through ocnprint()?

    Unless you specify a unique file name for each sweep value, are you sure you are not just overwriting the file at each corner? If I perform a sweep over a variable vdda_val and want to save a file for each corner, I need to make the output file name unique for each corner. Her is an example of how you might modify the prior ocean script file I provided earlier with a corner dependent file name.

    Ocean Script file "test_print_corners.ocn"

    vdda = VAR("vdda_val")
    sprintf(vdda_val "%.0f" vdda/1e-03)
    sprintf(filename "vdda_corner_%s.txt" vdda_val)
    ocnPrint( ?output filename VT("/n10") ?from 2e-09 ?to 9e-09 ?step 1e-10)

    For vdda_val set to 720 mV and 990 mV in a two corner sweep, it creates the two files:

    vdda_corner_720.txt
    vdda_corner_990.txt

    Does this help? There are other ways to do this, but this might be closest to the method I think you made work.

    Shawn

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Holz
    Holz over 4 years ago in reply to ShawnLogan

    Hello Shawn,

    thanks again for your answer! It really helped me to solve the problem

    • 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