• 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. ADE-XL and matlab debugging

Stats

  • Locked Locked
  • Replies 17
  • Subscribers 126
  • Views 22684
  • 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

ADE-XL and matlab debugging

danmc91
danmc91 over 10 years ago

I came across a limitation in the waveform calculator recently and decided to  try out using matlab for processing some simulation results.  I've had some successes and at least as many failures and am hoping to get the failures resolved.

matlab version:  2012B

IC version:  6.1.6.500.6

MMSIM version: 13.11.078

Platform:  RHEL 5.5

  1. Simulate with ADE-L, look at results in matlab.  After using addpath() twice in matlab or setting MATLABPATH to include both .../tools/spectre/matlab and .../tools/spectre/matlab/64bit I was able to read results using cds_srr(), run my analysis, etc.
    1. Is there a way in ADE-L (not -XL) to include a matlab measure in the outputs or launch matlab to produce some plots? 
    2. The documentation seemed to miss me needing to add the .../tools/spectre/matlab/64bit part to MATLABPATH and I was failing to find cds_innersrr at first.
  2. Launch matlab from the CIW window:  shell("matlab &").  Weird.  doesn't seem to work.  I think DISPLAY may not be set but shell("xterm -e matlab &") launches matlab with the gui, no problem.
  3. Simulate in ADE-XL, use a matlab output.  Here is where I totally crash and burn. 
    1. ERROR (ADEXL-4031): Matlab script directory.  It doesn't like a colon in my ADE-XL file structure and I'm told to use:  envSetVal("adexl.setup" "useNMPForMapping" 'boolean t).  However the adexl.setup partition doesn't exist.  adexl.setupdb does exist but making this setting does not make the error go away.
    2. WARNING (ADEXL-4010): No outputs specified in the Matlab script.  Scalar outputs can be specified in 'axlResult' in Matlab script..  But I *do* have axlResult=3.7; in my script (just put in a number to rule out other issues.
    3. I can't find any log of any sort at all related to the matlab script running.  If I watch the output of 'top' I see a matlab process start and then end.  I've tried making my matlab script only open up a text file for writing, printing out "hello, world" to the file and closing it.  Even that doesn't happen.
    4. Then I tried envSetVal("adexl.gui" "copyMeasurementScripts" 'boolean nil) to avoid having the matlab script end up in a directory with ":" in the name.  I put that envSetVal in my .cdsinit and restarted virtuoso and ADE-XL.  Same result as before (script got copied to ADE-XL directory with a ":" in the name and I got a ERROR (ADEXL-4031): Matlab script directory).
    5. If I ever get past this, can I return a waveform (or multiple waveforms) back to ADE-XL from matlab?

This seems very close but close is not good enough.  The lack of any sort of log that I can find is perhaps the most frustrating.  I don't know how ADE-XL is launching matlab, what arguments it may be giving to matlab, what environment it may be giving to matlab, etc.  It makes it very hard to debug.

Thanks

-Dan

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Hi Dan,

    The most useful way to debug things is to enter:

    axlDebugFlag=t

    in the CIW before starting ADE XL and running the simulation. In addition to some other verbiage, it also tells you about the interaction between ADE XL and Matlab. It's invaluable for debugging problems with this interface.

    Some answers to your questions:

    1. I never use addpath in my scripts - all I do is setenv MATLABPATH to `cds_root spectre`/tools/spectre/matlab/64bit (I only use 64-bit Matlab, as that's the only supported version these days, if I remember rightly)
      1. No, matlab outputs are only supported in ADE XL, not ADE L
      2. I think this is covered in the MMSIM documentation for the Matlab toolbox. Ah, I see - it doesn't mention the 64bit part... (looks like it hasn't been updated for a while)
    2. That's odd. It works for me. I don't think it can be $DISPLAY, since that should be set before virtuoso runs. Maybe something in your environment is not getting the path set correctly, but that seems unlikely.
    3. ADE XL stuff:
      1. Note that the useNMPForMapping will only help for new ADE XL views. Existing ADE XL views don't get influenced by this variable. However, the case where it causes problems is where you have a ":" in your testname (which is unfortunately the default in ADE XL). You can solve that by just renaming the test (click on the name twice and rename it )
      2. Hopefully the debug flag will get to the bottom of this. All ADE XL does is launch "axlMatlab" (which is in <ICInstDir>/tools/dfII/bin and pass envGetVal("adexl.simulation" "matlabRunArguments") to it (which defaults to "-nodesktop -nosplash")
      3. The debug flag will help here
      4. The point in a should help here. The other thing you have to be careful about is having an OCEAN script with the same name in the working directory. I believe that Matlab always looks in the working directory first for a script regardless of the path (we do an addpath to add the scripts directory to the path). In general I'd probably leave the copyMeasurementScripts at its default value (t).
      5. No, the script can only output a single scalar number. You can get it to dump data somewhere or even output a plot, but outputting a waveform is not possible. There are enhancement requests related to this if I remember rightly.

    (note my letters a-e correspond to your sub-numbers 1-5 etc).

    Once you have got this working, it does work fairly smoothly - but the lack of good error reporting is one of the things that tends to make this a challenge to set up.

    Hope that helps!

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • danmc91
    danmc91 over 10 years ago
    Renaming the test got the matlab script to run. I couldn't see that axlDebugFlag=t (ran first thing after launching virtuoso) did anything at all. I didn't see any extra output in my CIW window when i then launched ADE-XL and ran a sim. Is there some place I should look for the debug output? One thing I have noticed is that if there is a bug in the matlab script then I don't see any sort of log where the error is listed. It is too bad that the copyMeasurementScripts nil doesn't seem to work. I'm really not a fan of having my matlab script embedded inside of the adexl view. I tried setting the matlabRunArguments to "" in the hopes that I would get an interactive matlab session and be able to more effectively debug my matlab script. As it stands, any sort of matlab error and I get nothing back to look and no error message at all.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Hi Dan,

    Can you check Options->Log Filter in the CIW - do you have "Standard message output" checked? If not, then it's not going to appear. Other than that, you should see "DAVINCI" messages in the CIW.

    If there's a bug in the matlab script, you should see some info about it in the CIW if you have the debug flag turned on - so hopefully you typed it correctly.

    You don't have to put the script inside the ADE XL view - that was only a suggestion. It should work fine to set copyMeasurementScripts to nil - I was just saying that you don't have to, and my preference is to manage all the files related to the ADE XL view together (useful if using design management, as the whole set of data gets managed together then). If you don't want that, that's OK too.

    I wouldn't in general mess with the matlabRunArguments because if you allow it to bring up the GUI, ADE XL will not be able to synchronize with it because it is trying to look for information on the matlab standard output, and if running with the matlab GUI, it doesn't appear on standard output and that won't work...

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • danmc91
    danmc91 over 10 years ago
    I double checked the log filter and "Standard message output" was already turned on. I didn't see any DAVINCI messages. I can't see that setting copyMeasurementScripts to nil does anything. I put it in my .cdsinit and restarted virtuoso. I entered /home/dan/myscript.m and then as soon as I run the sim, it copies the script over and changes the outputs setup.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Dan,

    For me, axlDebugFlag works, but looking again at the code, it probably should have been _axlDebugFlag=t (with a leading underscore). I can't test the matlab interface as I'm not using my work computer (where I have access to matlab), but I'm pretty sure that should do it. It's more verbose however and prints far more other things.

    You're right though - copyMeasurementScripts set to nil doesn't seem to be working. I just tried it. I filed CCR 1422706 to get this fixed. It appears initially that the path is preserved, but as soon as it saves the adexl view (either via save or by running a sim), it changes it to be in the adexl view.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • danmc91
    danmc91 over 10 years ago

    Adding the "_" in front, so using _axlDebugFlag=t, did turn on a bunch of DAVINCI DEBUG output.  This is certainly helpful although I can think of a few relatively simple enhancements which would all be quite useful and make this whole flow much more user friendly.

    - A log file dedicated to the matlab portion would be most useful.  While I can now see errors in the matlab script (I introduced one to see how it showed up) in the debug output, it is a bit hard to read.  I'm guessing the same applies to ocean measures.

    - It would be very useful to have a "debug the matlab measure" mode where it would launch the script but then instead of exiting, leave a matlab prompt.  That would make it much simpler to work out any kinks in the script..  My short term workaround is to use exist() to see if  axlCurrentResultsPath is defined and if not, use a hard coded path.  Then I can use the same script standalone for debugging and as an output (except the copying to ADE-XL view is unfriendly towards this.

    - Allowing matlab (and also ocean) measures in ADE-L (not ADE-XL) would be very helpful.

    - The ability to return a waveform instead of only a scalar would be useful.

    - The ability to return multiple outputs from the same script would be quite usefull

    - It would be nice if I could use octave as well as matlab

    Thanks for the help

    -Dan

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Hi Dan,

    I would suggest that some of these you contact customer support and request them as enhancements. I can give you some references for some of them that I think would be worth following up on, and I'll indicate those that are unlikely to have anything done on:

    1. Log file - excellent idea. Debugging right now is far harder than it should be.
    2. This is probably not that straightforward when you have multiple tests or multiple outputs (or sweeps, corners etc) as all will go through the same matlab; matlab doesn't actually exit. I can see why you want it though...
    3. I think it's highly unlikely Matlab or Ocean script output support will be added to ADE L
    4. Waveform output is an existing enhancement CCR (filed by me): 989142
    5. Multiple outputs - good idea. There are a number of existing requests for this - the master CCR is 1034185
    6. Octave support. There are CCRs for this, but there is little prospect of this. We have looked into it in some detail, but the Octave license  makes this a non-starter for a commercial tool (I won't go into all the details here - but we have looked into this in some depth and tried to find solutions to it). I can entirely see why you'd want this (and some of the CCRs on this are from me), but this is very unlikely to be possible.

    So for 1, 4 and 5 above, I'd suggest contacting support and then either new CCRs or duplicates can be filed. Maybe 2 as well, although that's not so obvious how it could be done.

    Kind Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Curtisma
    Curtisma over 9 years ago

    Hey Dan:

    I have also been using the matlab output scripts. I found it useful to have MATLAB create its own log using the diary command which can capture MATLAB outputs and errors to a file.

    You can also make it easier to debug by having the MATLAB script open an interactive session and display the normal matlab desktop when the script is ran by using the "desktop" command within your script.  Note that it can take a little while to open the matlab desktop and the script is run for each corner or each monte carlo sim ran.  The "workspace" command can also be useful for viewing variables as they change.


    -Curtis

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Curtisma
    Curtisma over 9 years ago
    Andrew:

    I thought I had this matlab script method basically working a couple of months ago. However now that I have come back to it somehow a colon keeps popping up in my path even though I don't have a colon in my test name in adexl.

    Here is the path it moves the script to:
    /prj/sky78140_mk5325asm_CR/work_libs/mayberc/cds/design/SW_CTRL_mk5325a_01_power_TB/adexl/test_states/sky78140_mk5325asm_CR_mayberc/SW_CTRL_mk5325a_01_power_TB/spectre/Vreg2p5v_stb_cap_Vreg2p5v_stb:1_state_capTest2p5.15/outputsScriptsDir

    The test is named Vreg2p5v_stb_cap and it seems that it now appends the ":1_state_capTest2p5.15" which includes the run name I used "capTest2p5.15" and unfortunately a colon.

    Any way I can get around this to get it working again?

    -Curtis
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Curtisma
    Curtisma over 9 years ago

    I reran my old testbench where I had it working and it specified the following as the run directory:

    /prj/sky78140_mk5325asm_CR/work_libs/mayberc/cds/design/POR_VIO_TB/adexl/test_states/sky78140_mk5325asm_CR_mayberc/POR_VIO_TB/spectre/POR_VIO_TB_Transient_Vlo_active/outputsScriptsDir/plotPOR.m

    You can see it used "POR_VIO_TB_Transient_Vlo_active" rather than "Vreg2p5v_stb_cap_Vreg2p5v_stb:1_state_capTest2p5.15"

    The old adexl state still runs correctly.

    • 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