• 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. Updating pcell CDF parameters from an imported file

Stats

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

Updating pcell CDF parameters from an imported file

Wil7104
Wil7104 over 7 years ago

Hi,

I'm having an issue coding up a pcell to import a file with custom values and then updating the CDF's with these values.  The pcell CDF has a "Load File" option, and this file contains variables/values in this format:

"Offset" "4"
"Offset_MC" "2"
"R_0v" "2222"
"R_L" "0.02"
"R_Q" "1.222e-05"
"S_S" "7.222"
"S_L" "-0.00222"
"S_Q" "2.222e-05"
"S_C" "-7.222e-08"

Here is the section of code that loads the file and attempts to reassign the CDF's:

; ;;; File Loading/Saving code
;
; when( callfrom == "Load_File"
; LoadFilePath = simplifyFilename( strcat(getWorkingDir() "/Hall_model_parameters" ) )
; load( LoadFilePath )
; LoadFile = infile( LoadFilePath ) ;open output log file
;
;
; while( gets( nextLine LoadFile )
; str = parseString( nextLine " \"\n")
; case( car( str )
; ( "Offset" setq( Offset printf("%s\n" buildString( cdr( str ) ) ) ) )
; ( "Offset_MC" setq( Offset_MC printf("%s\n" buildString( cdr( str ) ) ) ) )
; ( "R" setq( R printf("%s\n" buildString( cdr( str ) ) ) ) )
; ( "R_L" setq( R_L printf("%s\n" buildString( cdr( str ) ) ) ) )
; ( "R_Q" setq( R_Q printf("%s\n" buildString( cdr( str ) ) ) ) )
; ( "S_S" setq( S_S printf("%s\n" buildString( cdr( str ) ) ) ) )
; ( "S_L" setq( S_L printf("%s\n" buildString( cdr( str ) ) ) ) )
; ( "S_Q" setq( S_Q printf("%s\n" buildString( cdr( str ) ) ) ) )
; ( "S_C" setq( S_C printf("%s\n" buildString( cdr( str ) ) ) ) )
; );case
;
; );while
; close( LoadFile )
;
; );when

The setq is not updating the CDF's and I am getting a format error after teh first value is read in due to a 't' being reported:

"4"
t
4
"Offset"
2
"Offset_MC"
"R_0v"
0.02
"R_L"
1.222e-05
"R_Q"
7.222
"S_S"
-0.00222
"S_L"
2.222e-05
"S_Q"
-7.222e-08
"S_C"
CDF: An error occurred when evaluating callback.
Callback: Load_File->callback => au1IP_hall_60_sm_b_play_cb("Load_File")

Message: *Error* fprintf/sprintf: format spec. incompatible with data - "Format is '%g', argument #1 is t"

Not sure if my code is just not set up correctly or I'm barking up the wrong tree with the printf statement to remove the "", any help would be appreciated.

Thanks,

Bob

  • Cancel
Parents
  • skillUser
    skillUser over 7 years ago

    Hi Bob,

    The use of printf is incorrect - the printf statement prints out the value and returns 't' but you want the string value. I'm not sure why you are using buildString?  My guess is that each line in the case statement should look more like this:

     sprintf(Offset "%s" cdr( str )) 

    ?  I'm assuming here that the parameter value should be a string.  If it should be a number/float format then use cdfParseFloatString() around the string, for example:

    cdfParseFloatString("-7.222e-08")
    => -7.222e-08

    Hope this helps.

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Wil7104
    Wil7104 over 7 years ago in reply to skillUser

    Thank you Lawrence, I will implement your suggestions and let you know if it works, the BuildString was used to try and strip out the parentheses (probably wrong fctn for this):

    setq( Offset_MC printf("%L\n" cdr( str ) ) )
    ("4")
    t
    setq( Offset_MC printf("%L\n" buildString( cdr( str ) ) ) )
    "4"
    t

    Thanks again,

    Bob

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Wil7104
    Wil7104 over 7 years ago in reply to skillUser

    Thank you Lawrence, I will implement your suggestions and let you know if it works, the BuildString was used to try and strip out the parentheses (probably wrong fctn for this):

    setq( Offset_MC printf("%L\n" cdr( str ) ) )
    ("4")
    t
    setq( Offset_MC printf("%L\n" buildString( cdr( str ) ) ) )
    "4"
    t

    Thanks again,

    Bob

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • skillUser
    skillUser over 7 years ago in reply to Wil7104

    Ok, in that case just use 'cadr' instead of 'cdr'.

    • 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