• 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. List manipulation

Stats

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

List manipulation

Ali Bastami
Ali Bastami over 2 years ago

Hi

I am quite new to Skill programming and would appreciate support on list manipulation.

Lets say that I have a list like this

MyList=list(list("a" "b" "c") list("d" "e" "f") list("g" "h" "i") ...):

(("a" "b" "c")
("d" "e" "f")
("g" "h" "i")

...
)

and I would like to go through each "line" of the list (a subset of "a" "b" "c" of elements).

if first element of the subset = "name" then

x=first element of the subset

y=second element of the subset

z=third element of the subset.

and loop through the list.

Thanks!

  • Cancel
Parents
  • AurelBuche
    AurelBuche over 2 years ago

    Hi,
    You can do something like:

    ;; Lisp style
    (foreach sublist MyList
      (when (equal "name" (car sublist))
      (destructuringBind (x y z) sublist
    (printf "x: %A y: %A z: %A\n" x y z)
    )))

    ;; C-style
    foreach( sublist MyList
    when( nth(0 sublist) == "name"
    let( (x y z)
    x = nth(0 sublist)
    y = nth(1 sublist)
    z = nth(2 sublist)
    printf("x: %A y: %A z: %A\n" x y z)
    )))

    Hope this helps,

    Cheers,

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • AurelBuche
    AurelBuche over 2 years ago

    Hi,
    You can do something like:

    ;; Lisp style
    (foreach sublist MyList
      (when (equal "name" (car sublist))
      (destructuringBind (x y z) sublist
    (printf "x: %A y: %A z: %A\n" x y z)
    )))

    ;; C-style
    foreach( sublist MyList
    when( nth(0 sublist) == "name"
    let( (x y z)
    x = nth(0 sublist)
    y = nth(1 sublist)
    z = nth(2 sublist)
    printf("x: %A y: %A z: %A\n" x y z)
    )))

    Hope this helps,

    Cheers,

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Ali Bastami
    Ali Bastami over 2 years ago in reply to AurelBuche

    Thank you for your quick respond, 

    I  think I need to develop my question a bit more, I am trying to retrieve the sos revision used in a cadence config view.
    I already have a skill script that creates a list of my included cells and views and I am trying to walk through the list and retrieve SOS rev for each cell included in the hierarchy.

    The following scripts retrieve the correct SOS revision stand alone:

    cv=dbOpenCellViewByType(mylib mycell myview)
    sosrev=SosGetRev(cv)

    but when I call this function in the loop the input parameters to the function are not updated for each sublist

    An example list would look like: 

    myList=list(
    list("Proj" "Proj_test_trx" "schematic")  ; sosrev=44
    list("Proj" "Proj_test_tx_lpm_core" "schematic") sosrev=14
    list("Proj" "Proj_test_trx" "symbol"); sosrev=44
    list("Proj" "Proj_test_trx" "schematic"); sosrev=28
    list("Proj" "Proj_test_switch_top" "symbol"); sosrev=32
    list("Proj" "Proj_test_switch_top" "schematic_Full_EM_Analysis_lga"); sosrev=14
    list("Proj" "Proj_test_switch_notch_switch" "symbol") ; sosrev=18
    list("Proj" "Proj_test_switch_notch_switch" "schematic"); sosrev=2
    list("Proj" "Proj_test_switch_notch_Cn" "symbol"); sosrev=19
    list("Proj" "Proj_test_switch_notch_Cn" "schematic_ideal"));sosrev=17

    foreach( sublist myList
    when( nth(0 sublist) == "Proj"
    let( (mylib mycell myview)
    mylib = nth(0 sublist)
    mycell = nth(1 sublist)
    myview = nth(2 sublist)
    cv=dbOpenCellViewByType(mylib mycell myview)
    sosrev=SosGetRev(cv)
    printf("mylib: %A mycell: %A myview: %A sosRev: %A\n" mylib mycell myview sosrev)
    )))

    each individual cell have different revision number. But for some reason,

    cv=dbOpenCellViewByType(mylib mycell myview)
    sosrev=SosGetRev(cv)

    only responds to the first subset of the list.

    and the results will be:

    mylib: "Proj" mycell: "Proj_test_trx" myview: "schematic" sosRev: "44"
    mylib: "Proj" mycell: "Proj_test_tx_lpm_core" myview: "schematic" sosRev: "44"
    mylib: "Proj" mycell: "Proj_test_trx" myview: "symbol" sosRev: "44"
    mylib: "Proj" mycell: "Proj_test_trx" myview: "schematic" sosRev: "44"
    mylib: "Proj" mycell: "Proj_test_switch_top" myview: "symbol" sosRev: "44"
    mylib: "Proj" mycell: "Proj_test_switch_top" myview: "schematic_Full_EM_Analysis_lga" sosRev: "44"
    mylib: "Proj" mycell: "Proj_test_switch_notch_switch" myview: "symbol" sosRev: "44"
    mylib: "Proj" mycell: "Proj_test_switch_notch_switch" myview: "schematic" sosRev: "44"
    mylib: "Proj" mycell: "Proj_test_switch_notch_Cn" myview: "symbol" sosRev: "44"
    mylib: "Proj" mycell: "Proj_test_switch_notch_Cn" myview: "schematic_ideal" sosRev: "44"

    any ide why the parameters are not updated when dbOpenCellViewByType is called?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to Ali Bastami

    Hi Ali,

    The problem is not with the dbOpenCellViewByType, since I constructed the same cellViews that you had in your example, and altered the code slightly to just do sosRev=cv since I don't have ClioSoft. (now Keysight) SOS:

    mylib: "Proj" mycell: "Proj_test_trx" myview: "schematic" sosRev: db:0x2803d61a
    mylib: "Proj" mycell: "Proj_test_tx_lpm_core" myview: "schematic" sosRev: db:0x2803d41a
    mylib: "Proj" mycell: "Proj_test_trx" myview: "symbol" sosRev: db:0x2803d31a
    mylib: "Proj" mycell: "Proj_test_trx" myview: "schematic" sosRev: db:0x2803d61a
    mylib: "Proj" mycell: "Proj_test_switch_top" myview: "symbol" sosRev: db:0x2803d21a
    mylib: "Proj" mycell: "Proj_test_switch_top" myview: "schematic_Full_EM_Analysis_lga" sosRev: db:0x2803d11a
    mylib: "Proj" mycell: "Proj_test_switch_notch_switch" myview: "symbol" sosRev: db:0x2803d01a
    mylib: "Proj" mycell: "Proj_test_switch_notch_switch" myview: "schematic" sosRev: db:0x2803cf1a
    mylib: "Proj" mycell: "Proj_test_switch_notch_Cn" myview: "symbol" sosRev: db:0x2803ce1a
    mylib: "Proj" mycell: "Proj_test_switch_notch_Cn" myview: "schematic_ideal" sosRev: db:0x2803cd1a

    as you can see, the cellVIew ids are different for every row. Or if I did:

    sosRev=list(cv~>cellName cv~>viewName) 

    and ran again:

    mylib: "Proj" mycell: "Proj_test_trx" myview: "schematic" sosRev: ("Proj_test_trx" "schematic")
    mylib: "Proj" mycell: "Proj_test_tx_lpm_core" myview: "schematic" sosRev: ("Proj_test_tx_lpm_core" "schematic")
    mylib: "Proj" mycell: "Proj_test_trx" myview: "symbol" sosRev: ("Proj_test_trx" "symbol")
    mylib: "Proj" mycell: "Proj_test_trx" myview: "schematic" sosRev: ("Proj_test_trx" "schematic")
    mylib: "Proj" mycell: "Proj_test_switch_top" myview: "symbol" sosRev: ("Proj_test_switch_top" "symbol")
    mylib: "Proj" mycell: "Proj_test_switch_top" myview: "schematic_Full_EM_Analysis_lga" sosRev: ("Proj_test_switch_top" "schematic_Full_EM_Analysis_lga")
    mylib: "Proj" mycell: "Proj_test_switch_notch_switch" myview: "symbol" sosRev: ("Proj_test_switch_notch_switch" "symbol")
    mylib: "Proj" mycell: "Proj_test_switch_notch_switch" myview: "schematic" sosRev: ("Proj_test_switch_notch_switch" "schematic")
    mylib: "Proj" mycell: "Proj_test_switch_notch_Cn" myview: "symbol" sosRev: ("Proj_test_switch_notch_Cn" "symbol")
    mylib: "Proj" mycell: "Proj_test_switch_notch_Cn" myview: "schematic_ideal" sosRev: ("Proj_test_switch_notch_Cn" "schematic_ideal")

    Perhaps you need to speak to ClioSoft support and find out if there's a problem with their function?

    Regards,

    Andrew

    • 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