1

I have schematic with multiple instances connected to one of the nets. I need a SKILL function that will print for all instances list of pins connected to this net

Alex
  • 2,009
  • 6
  • 24
  • 27
  • just for the future questions, better to ask it on the cadence forum. just google it SKILL cadence forum :) – Vadim Jul 07 '17 at 14:18

2 Answers2

0
procedure(CCSgetListOfConnectedInstancePinsForNet(netname)
let((cv netid instid termid revhierarchy subcktPath pinHierName inst_list)
    ;get cellview
    cv = geGetEditCellView()

    ; get netid
    netid = dbFindNetByName(cv  netname)

    foreach(inst netid~>allInstTerms~>inst
        unless(member( inst inst_list )
            inst_list = cons(inst inst_list)
        );unless
    );foreach

    ;get instid
    foreach(instid inst_list
        ;printf("Instance %L\n" instid~>name )
        foreach(term instid~>instTerms
            when(car(term~>net~>sigNames) == netname
                termid=term
                ;printf("\tNet %L is connected to terminal %L of Instance %L\n" netname termid~>name instid~>name )
                revhierarchy = reverse(mapcar('car geGetHierMemInst()))
                subcktPath = CCSgetSubcktPath(revhierarchy)
                pinHierName=strcat( subcktPath instid~>name "/" termid~>name)
                printf("%s\n" pinHierName)
            );when
        );foreach
    );foreach
    t
);let
);procedure

procedure(CCSgetSubcktPath(hierarchy)
  let( (path)
    path = buildString(reverse(hierarchy)~>name "/")
    when(path != ""
      path = strcat("/" path "/")
    ) ; end when
    path
  ) ; end let
) ; end procedure
Community
  • 1
  • 1
Alex
  • 2,009
  • 6
  • 24
  • 27
0

Or shorter:

procedure( ABC_findInstsAndPinsByNet(cvId netName)
    let( (netId returnTable)
        returnTable = makeTable("ABC_findInstsAndPinsByNet" nil)
        netId = dbFindNetByName(cvId netName)
        foreach( termId netId~>instTerms
            returnTable[termId~>inst] = cons(termId~>name returnTable[termId~>inst])
        )

        returnTable ;;return
    )
)

And then, to read it:

rezTbl = ABC_findInstsAndPinsByNet(cv() "net2")
printstruct(rezTbl)

and you will get something like:

printstruct(rezTbl)
Structure of type association table (table:ABC_findInstsAndPinsByNet):
  db:0x3f04079b: ("d")
  db:0x3f04079c: ("d" "g")
  db:0x3f04079a: ("s")
t

or if you want to parse all:

foreach( elem rezTbl
    printf("%L => %L\n" elem rezTbl[elem])
)
Adi Nistor
  • 101
  • 1
  • 3
  • In my version of code, I am going inside hierarchies and printing hierarchical path. Your version will print only current level. – Alex Jul 31 '19 at 10:42
  • hmm... can you please help me with more details: I just tried the code (Thanks for editing also the missing parts) for a net connected to block. And I got as a result only the inst/pin of the top symbol, not inside the hierarchy. Where exactly (in the code) are you going inside the hierarchy ? Thanks – Adi Nistor Aug 01 '19 at 11:34
  • I am actually took this from Cadence site and not using much. It seems devices ports not printed. Only instances. – Alex Aug 04 '19 at 06:31