• 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. escape character issue Skill/Ocean

Stats

  • Replies 2
  • Subscribers 125
  • Views 550
  • Members are here 0

escape character issue Skill/Ocean

NickJ
NickJ 4 months ago

I'm trying to write an Ocean scrip that runs a MC sim.

I need to count the number of crossings of a clock signal between 2 points on every run.

I have some code that returns the number of crossings as desired, but only for a single run

crossings=length(cross(clip(VT("/out")  StartPulse 9u ) 0.3 0 "rising"  nil nil ))

StartPulse is a time extracted from another signal, using the cross function, but in the standard way specifying the edge number.

but this fails with an MC. It requires, leafValue( VT("/out") "mcparamset" 1 ) for each point.

I created a loop to work through the MC runs

for( i 1 10
numStr = sprintf(nil "%d" i)
;leafValue( VT("/out") "mcparamset" 1 )
signalName = (strcat "leafValue( VT(\"/out\") \"mcparamset\" " numStr " )")
;printf((strcat signalName "\n"))
crossings=length(cross(clip(signalName StartPulse 9u ) 0.3 0 "rising" nil nil ))
;printf("crossings = %d \n", crossings)

)

I'm creating each leafValue name as signalName using a strcat. I've added escape characters as the quotations cause issues otherwise.

if I printf signalName I get

leafValue( VT("/out") "mcparamset" 1 )
leafValue( VT("/out") "mcparamset" 2 )
leafValue( VT("/out") "mcparamset" 3 )
leafValue( VT("/out") "mcparamset" 4 )
leafValue( VT("/out") "mcparamset" 5 )
leafValue( VT("/out") "mcparamset" 6 )
leafValue( VT("/out") "mcparamset" 7 )
leafValue( VT("/out") "mcparamset" 8 )
leafValue( VT("/out") "mcparamset" 9 )
leafValue( VT("/out") "mcparamset" 10 )

as I expected, but using it in the crossings function I get this error. It seems that the escape characters are included causing an issue.

*Error* clip: can't handle clip("leafValue( VT(\"/out\")
\"mcparamset\" 1 )" srrWave:0x36ec3040 9e-06).
*Error* crossMethod: can't handle crossMethod(nil 0.3 0 "rising" nil nil nil)

Is there a better way to do this than using a loop?

And how do I fix the issue with the escape characters? 

Cheers

  • Sign in to reply
  • Cancel
  • Andrew Beckett
    Andrew Beckett 4 months ago

    No, the issue is that you are trying to call clip() with a "signal" which is not a signal but a string. That won't work because clip (and other waveform functions) are expecting waveform objects (signals) rather than strings which are some expression within. I don't know why you are using strcat to build a signalName and then passing that to clip. Instead it would make more sense to do:

    signal=leafValue(VT("/out") "mcparamset" i)
    crossings=length(cross(clip(signal StartPulse 9u ) 0.3 0 "rising" nil nil ))

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • NickJ
    NickJ 4 months ago in reply to Andrew Beckett

    Yeah, that makes sense. Got it working now.

    Cheers.

    • 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