• 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. How to retrieve the number of waves from a srrWave object...

Stats

  • Replies 2
  • Subscribers 144
  • Views 1084
  • Members are here 0

How to retrieve the number of waves from a srrWave object?

unSkilled
unSkilled 3 months ago

Hi,

I have a filtered leafValue expression:

exprFilt = leafValue(expr "fs" 168.0M)

famIsFamily(exprFilt)
t

I want to retrieve the number of waveforms that are present in that family and plot them in separate subwindows

length(exprFilt) fails as below:

length(exprFilt)
*Error* length: argument must be a list or an array - srrWave:0x0f059720

Using the cross product of sweep parameters is not correct in this case because exprFilt is pre-filtered, Each of the variables has multiple values

famGetSweepName(exprFilt 0)
"modelFiles"
famGetSweepName(exprFilt 1)
"trim_vreg_reg2"
famGetSweepName(exprFilt 2)
"fin"
famGetSweepName(exprFilt 3)
"temperature"
famGetSweepName(exprFilt 4)
"freq"
famGetSweepName(exprFilt 5)
nil

we're not interested in all sweeps but those present in the family only. Is there a way to easily get the number of waves in a family?

  • Sign in to reply
  • Cancel
  • henker
    henker 2 months ago

    Not sure if there is a nicer way, but a naive approach would be to recursively dive into the family (of families, of ...) until you reach the waves, and sum up the numbers on return, as this would count the actual waves, independent on how the sweeps look like, e.g. like this:

    procedure( count_waves_in_fam(wave)
      let( (cnt)
        cond(
          ( drIsWaveform(wave)
            ; a single wave
            1
          )
          ( famIsFamily(wave)
            ; call self with all family members
            ; sum up the returned count
            cnt = 0
            foreach(sv famGetSweepValues(wave)
              cnt = cnt + count_waves_in_fam( famValue(wave sv) )
            )
            cnt
          )
          ( t
            error("count_waves_in_fam: cannot handle %L\n" wave)
          )
        ); cond
      ); let
    )


    IF the number of waves is actutually not what you finally want, but to open subwindows for each wave, then you might add the opening part inside the 'drIsWaveform(wave)' condition, and replace the foreach with 'famMap('count_waves_in_fam wave)', which should be at least more efficient. However, if you want to pass values up (like the count here) or down (e.g. the current sweep values), then you have to iterate yourself.

    Regards,

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • unSkilled
    unSkilled 2 months ago in reply to henker

    Hi, 

    Thanks for your reply. I haven't had the chance to tinker with this in the past days but I'll give it a go and report the outcome in the forum.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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