• 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. Allegro X Scripting - Skill
  3. Pass data/values between two skill codes/allegro instan...

Stats

  • State Not Answered
  • Replies 12
  • Subscribers 19
  • Views 6104
  • Members are here 0
More Content

Pass data/values between two skill codes/allegro instances

mir0mik
mir0mik over 2 years ago

Hi,

I'm working on a skill code that will in him self run another instance of allegro through batch call axlRunBatchDBProgram() and I would like to pass some variable/valuest to the batch instance as an input and vice versa.

Is this possible? Is there some way how to create/share variables between two programs?

Thanks!

Miro

  • Cancel
  • Sign in to reply
Parents
  • TCHA
    0 TCHA over 2 years ago

    There can be a couple of ways.

    If you want to call another database, then yes for example
    sh("allegro <board-name")
    invokes another allegro as shown in the image below

    The command line arguments of allegro are limited
    allegro -product Allegro_performance board.brd -s script.scr -nograph

    If you want to pass some other arguments, then you can do by writing a batch script, example test.scr
    writing a bat file to call that script ex: myrun.bat file to call (allegro -s test.scr -product Allegro_performance -nographic unnamed.dra)
    and calling bat file using sh("myrun.bat")

    You can refer to the article provided in the below link for more information on scripts and how to run the script in a batch mode.

    support.cadence.com/.../ArticleAttachmentPortal

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mir0mik
    0 mir0mik over 2 years ago in reply to TCHA

    Hi, thanks for the reply, but this is not the issue... I can run the another alegro but let say in the first SKill code I have a variable x = list( "A" "B" C")

    I will run the new instance of allegro with -s parameter that will run a script that will lunch a skill scrit an in than new one if I have print( x) it will be unbound variable error... The question is how to pass the x variable value from one skill to another (like share or at least copy the value)

    Thanks,

    Miro

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mir0mik
    0 mir0mik over 2 years ago in reply to mir0mik

    Hi, I'm stupid :) the "return1" will be the data I need to get. I need to test it but I think it will be OK (it was 00:15 am) when I waited the previous reply :D

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mir0mik
    0 mir0mik over 2 years ago in reply to B Bruekers

    Hi ,

    I'm albe to to send recieve/run functions through the mps however, I would like to use it as in the simplified code below...

    - host code will initialize the mps host service

    - then will run another instance of allegro in batch mode

    - during the batch call it will load client.il skill code

    - this code will establish connection to the mps send "QQQ"  to host

    - receive "measage_from_host" display it

    - exit the batch instance of allegro

    However, I have issue when trying it as it will freeze when I try to use mpsImport - any help/idea what I'm doing wrong?

    EDIT: just want to add that when the CLIENT.il is run manually on a manually run instance of allegro it works as intended. It only freeze when run through the axlRunBatchDBProgram...

    Thanks,

    Miro

    HOST.il

    defun( qqq_hostFunction ( qqq_clientData)
    printf( "Host function run %A\n" qqq_clientData)
    "message_from_host"
    )

    qqq_mpsHostID = mpsExport( "qqq_Host" "qqq_Service" "69" list( 'qqq_hostFunction))

    axlRunBatchDBProgram( "allegro" "allegro %s -s run.scr empty.brd") ;will run -nogrpah later not used for debug

    mpsClose( qqq_mpsHostID)

    RUN.SCR

    skill load("CLIENT.il")
    #exit

    CLIENT.il

    axlUIConfirm( "Client Start")

    qqq_mpsClientID = mpsImport( "qqq_Host" "qqq_Service" "69" ) ;allegro will freeze when I use this line (when commented out with the next line too it will proceed to the axlOSExit

    axlUIConfirm( qqq_mpsClientID -> qqq_hostFunction( "QQQ")) ;thist should display the "message_from_host"

    axlOSExit(0)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • B Bruekers
    0 B Bruekers over 2 years ago in reply to mir0mik

    I think the freeze is because you started the client board with axlRunBatchDBProgram(). This will block the host, so probably the MPS as well.

    Looking at your code I'm not sure what you want to achieve;
    1) running 2 instances of (non blocked! ) Allegro simutainusly and have user interaction with them at the same time.
       -> start Allegro with a shell command, use the mps system

    2) Extract data from the 2nd (client) brd file, and continue with the orignal 'host' design after finished
       -> save the host database, open 'client' design. Do whatever you need to do there and when finished re-open the host design.
       During the 'client' session all your skill variables are available. You can also 'store' polygons or things between the two boards.
       Only the dbid's are (logically) not shared between the boards

    So something like this:

    defun( start_client (clientFile)
        let( (hostDesign tmpFile)
            hostDesign = axlGetDrawingName()    ;store current design name, to open it later.
            tmpFile = axlTempFile(nil)
            axlOSFileCopy(clientFile tmpFile nil)    ;copy client file to temporary file, so we dont edit the orignal file.
            axlSaveDesign(?design axlCurrentDesign() ?noConfirm t)    ;save current work
            unwindProtect(        ;use this to make sure whatever happend in the first statement the 2nd statement is always called.
                when(axlOpenDesignForBatch(tmpFile "wf")
                    ;do whatever you need to do here.         
                    run_during_client()

                )
                axlOpenDesignForBatch(hostDesign "wf")
            )
        errset(axlTempFileRemove(tmpFile))
        axlUIWUpdate(nil)
    ))

    defun( run_during_client ()
         axlUIConfirm("this is the client design")
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mir0mik
    0 mir0mik over 2 years ago in reply to B Bruekers

    Hi B Bruekers,

    Thanks! That makes sense, I will check the documentation to set it not blocking (if possible)...

    What I want to achieve is this:

    - imagine we have a global library where some of the JEDECs can be updated (maybe some corrections etc...)

    - imagine you have a *.brd file that uses JEDECs from the global library

    - what I want to do is "check if the JEDECs (symdef) in the *.brd file are the latest version (I want to use VERSION_ID parameter)

    - the problem is that once the JEDECs is placed in the *.brd file it is stored in the "local library in the *.brd file"

    - my plan was to run a skill code that would get all "symdef"s and store them to a list and then I wanted to use axlLoadSymbol() to load the symbol from "global library" to check the VERSION _ID but axlLoadSymbol() will load the symbol from the "local library" if present.

    - so I came with an idea to run another instance of Allegro (in non graphic mode) > pass a list of symdefs from the original board > use axlLoadSymbol() to load them in the new empty *.brd > this way I would obtain the VERSION_IDs from the "global library" > pass the VERSION_IDs back to the first instance and close the second instance > check which VERSION_IDs do not match and alert the user but without refreshing the symbols in the original board and without saving the original board...

    So this is the idea that I want to achieve, maybe there is a better way how to get the VERSION_IDs from the global library instead of the board library...
    I wanted to avoid - saving the original design and make it a "one button" solution...

    Thanks!

    Miro

    EDIT:

    In the batch help for Allegro:

    [-mps<XXX>]
    - These are not typically not required. See MPS
    on-line documents for full description.

    I think this will be the way how to start it with the MPS ruining I now need to find what to pass to the option... 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • B Bruekers
    0 B Bruekers over 2 years ago in reply to mir0mik

    Now it is clear what you want to achieve :)

    There are a few ways to do such checks. Personally i would use extraca to read the version_id from the library directly.

    You could also do it with creating a new BRD file (empty), and place all symbols to be checked in it. Then read out all version_id's and return to the main design. (so the 2nd option with axlOpenDesignForBatch()) But I beleive this will cause a big delay/wait for the enduser.

    Check some old posts of me regarding this topic :

    https://community.cadence.com/cadence_technology_forums/pcb-design/f/pcb-editor-skill/43609/compare-the-database-footprint-with-library-footprint--skill/

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • B Bruekers
    0 B Bruekers over 2 years ago in reply to mir0mik

    Now it is clear what you want to achieve :)

    There are a few ways to do such checks. Personally i would use extraca to read the version_id from the library directly.

    You could also do it with creating a new BRD file (empty), and place all symbols to be checked in it. Then read out all version_id's and return to the main design. (so the 2nd option with axlOpenDesignForBatch()) But I beleive this will cause a big delay/wait for the enduser.

    Check some old posts of me regarding this topic :

    https://community.cadence.com/cadence_technology_forums/pcb-design/f/pcb-editor-skill/43609/compare-the-database-footprint-with-library-footprint--skill/

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • mir0mik
    0 mir0mik over 2 years ago in reply to B Bruekers

    Extracta may be good solution! Thanks for the idea... However, could you please look at the EDIT section of the previous post the -mps parameter? Any knowledge about this? Did you ever tried this?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mir0mik
    0 mir0mik over 2 years ago in reply to B Bruekers

    Hi, tried some stuff with extracta but is quite slow...

    this code using ipcBeginProcess for extracta will crash when run on the library folder (about 4000+ psm/dra pairs)
    it probably would be OK if all symbols are already placed in the brd file, but starting new process for each dra is slow...

    /*

    qqq_cnt = 0
    qqq_tmp = list( nil nil)
    foreach( qqq_element getDirFiles( "d:/Cadence/Master_Library_Current/PCB/.")
    when( substring( lowerCase( qqq_element) -4 4) == ".psm"
    when( isFile( sprintf( nil "d:/Cadence/Master_Library_Current/PCB/%s.dra" substring( qqq_element 1 strlen( qqq_element) - 4))) == t
    qqq_cid = ipcBeginProcess( sprintf( nil "extracta -q -s -k -r d:/Cadence/Master_Library_Current/PCB/%s.dra d:/Cadence/SKILL/ext_qqq.txt d:/Cadence/SKILL/out.txt" substring( qqq_element 1 length( qqq_element) - 4)))
    ipcWait( qqq_cid)
    qqq_inPort = infile( "d:/Cadence/SKILL/out.txt")
    while(
    gets( qqq_readOutLine qqq_inPort)
    tconc( qqq_tmp list( qqq_element qqq_readOutLine))
    )
    close( qqq_inPort)
    qqq_cnt++
    )
    )
    )
    println( qqq_cnt)
    car( qqq_tmp)

    */

    however, this code I would like to run in the second instance of allegro (still not able to do that:( ), will be finished in about 2 seconds on the same folder...

    /*

    qqq_cnt = 0
    qqq_tmp = list( nil nil)
    foreach( qqq_element getDirFiles( "d:/Cadence/Master_Library_Current/PCB/.")
    when( substring( lowerCase( qqq_element) -4 4) == ".psm"
    when( isFile( sprintf( nil "d:/Cadence/Master_Library_Current/PCB/%s.dra" substring( qqq_element 1 strlen( qqq_element) - 4))) == t
    qqq_padstackID = axlLoadSymbol( "PACKAGE" substring( qqq_element 1 strlen( qqq_element) - 4))
    tconc( qqq_tmp list( qqq_element qqq_padstackID -> prop -> VERSION_ID))
    qqq_cnt++
    )
    )
    )
    println( qqq_cnt)
    car( qqq_tmp)

    */

    I don't know, maybe I'm doing something wrong with the extracta... I just need to run the axlLoadSymbol in an empty board and get back the list and it will be crazy fast...

    Miro

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • TCHA
    0 TCHA over 2 years ago in reply to mir0mik

    @mir0mik, any further update on this? Is the issue resolved?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Cadence Guidelines

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