1

我有多个实例连接到其中一个网络的示意图。我需要一个 SKILL 函数,它将打印连接到此网络的所有实例的引脚列表

4

2 回答 2

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
于 2017-06-21T13:19:20.363 回答
0

或更短:

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
    )
)

然后,阅读它:

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

你会得到类似的东西:

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

或者如果你想解析所有:

foreach( elem rezTbl
    printf("%L => %L\n" elem rezTbl[elem])
)
于 2019-07-29T12:10:45.577 回答