• 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. Calibration on ADC - Calculations are all correct - but...

Stats

  • Replies 1
  • Subscribers 143
  • Views 557
  • Members are here 0

Calibration on ADC - Calculations are all correct - but plotting doesn't work on sweeps?!

jehh
jehh 4 months ago

Hello,

I am trying to do a calibration of an ADC using the calculator functions. I keep getting issues with unbound variables from my calibration calculations.

Steps that I am using (roughly sketched, do a bunch of similar calculations):

1) create digital word bus using:

awvCreateBus("code_out" list(awvAnalog2Digital(VT("/code_x<9>") nil nil 0.5 nil "centre") awvAnalog2Digital(VT("/code_x<8>") nil nil 0.5 nil "centre") awvAnalog2Digital(VT("/code_x<7>") nil nil 0.5 nil "centre") awvAnalog2Digital(VT("/code_x<6>") nil nil 0.5 nil "centre") awvAnalog2Digital(VT("/code_x<5>") nil nil 0.5 nil "centre") awvAnalog2Digital(VT("/code_x<4>") nil nil 0.5 nil "centre") awvAnalog2Digital(VT("/code_x<3>") nil nil 0.5 nil "centre") awvAnalog2Digital(VT("/code_x<2>") nil nil 0.5 nil "centre") awvAnalog2Digital(VT("/code_x<1>") nil nil 0.5 nil "centre") awvAnalog2Digital(VT("/code_x<0>") nil nil 0.5 nil "centre")) "Unsigned Decimal")

2)

Then I use a cross statement to get a time value - I use || operator to get 0 if crossing statement fails.

3)

I had some issue with extracting the word at the time but ended up with:

atoi(awvGetScalarFromWave(value(code_out t_v1_calib_sample)))

4)

Then I do some calculations and then I multiply a gain and offset to a wave where I converted the digital code to a an analog waveform using:

code_out_V = clip(awvDigital2Analog(code_out 4.7 0 0 ?mode "busvalue") t_conv_done VAR("simtime"))
code_out_V_corr = ((code_out_V_sample * g_calib) + o_calib)

Now the issue:

When running a single point simulation this works very well - however when running sweeps I can no longer plot my code_out_V_corr ? It fails saying that a bunch of variables are unbound. 

Errors:
ERROR (ADE-1057): Could not evaluate expression
        Name:'q2_meas'
        Expression:'atoi(awvGetScalarFromWave(value(code_out t_v2_calib_sample)))'
     because of the following error(s)
        ("atoi" 0 t nil ("*Error* atoi: argument #1 should be a string (type template = \"tg\")" srrWave:0x67461a60))
     Ensure that the definition of the expression is correct.
*Error* ("atoi" 0 t nil ("*Error* atoi: argument #1 should be a string (type template = \"tg\")" srrWave:0x67461ac0))


ERROR (ADE-1057): Could not evaluate expression
        Name:'q1_meas'
        Expression:'atoi(awvGetScalarFromWave(value(code_out t_v1_calib_sample)))'
     because of the following error(s)
        ("atoi" 0 t nil ("*Error* atoi: argument #1 should be a string (type template = \"tg\")" srrWave:0x67461ac0))
     Ensure that the definition of the expression is correct.
*Error* ("difference" 0 t nil ("*Error* difference: can't handle (unbound - unbound)"))


ERROR (ADE-1057): Could not evaluate expression
        Name:'g_calib'
        Expression:'(q_fs * ((v2_meas - v1_meas) / (q2_meas - q1_meas)))'
     because of the following error(s)
        ("difference" 0 t nil ("*Error* difference: can't handle (unbound - unbound)"))
     Ensure that the definition of the expression is correct.
*Error* ("times" 0 t nil ("*Error* times: can't handle (unbound * unbound)"))


ERROR (ADE-1057): Could not evaluate expression
        Name:'o_calib'
        Expression:'(q_fs * (v1_meas - ((q1_meas * g_calib) / q_fs)) * VAR("v_lsb"))'
     because of the following error(s)
        ("times" 0 t nil ("*Error* times: can't handle (unbound * unbound)"))
     Ensure that the definition of the expression is correct.
*Error* ("times" 0 t nil ("*Error* times: can't handle (srrWave:0x67461490 * unbound)"))


ERROR (ADE-1057): Could not evaluate expression
        Name:'code_out_V_corr'
        Expression:'((code_out_V_sample * g_calib) + o_calib)'
     because of the following error(s)
        ("times" 0 t nil ("*Error* times: can't handle (srrWave:0x67461490 * unbound)"))

Version info:

xrun(64)    24.03-s003
Spectre Version 23.1.0.722.isr15 64bit (Running Spectre X simulation
Virtuoso IC23.1-64b.ISR12.37

  • Sign in to reply
  • Cancel
  • jehh
    jehh 4 months ago

    Some more info: It seems that the atoi caused an issue - I've tried converting the digital bus with awvDigital2Analog -> Which removes the need to convert the list of strings that atoi couldn't handle when you have done a sweep.

    • Cancel
    • Vote Up +1 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