Programming 언어/Skill

[SKILL 강좌] operator (-> , ~>)

호드맨 2017. 1. 30. 00:04

list에 대한 내용을 적기 전에 SKILL에서 가장 간단하면서도 중요한 것을 빼먹었다. operator ("->" 또는 "~>" 지만 저는 "->"를 주요 사용하겠습니다.)의 사용에 대해서 알아봅시다.


layout (물론 schematic이나 symbol도 마찬가지) 에는 수많은 DB 들로 이루어져 있는데요. 이러한 DB에 접근하는 방법은 "->"를 사용하는 겁니다. 가장 먼저 layout 하나를 열고 (저는 "temp_lib"라는 library에  "AAA"라는 cell을 만들어 열어보았습니다. 가운데에 보기 좋게(??) "HODMAN"이라는 label을 적어보았습니다. 여기서 한 가지 함수를 공부하고 가겠습니다.

example LABEL 생성

deGetCellView( 
      [ w_window [ x_level ] ] 
)
     => d_cellview / nil

;# Returns the cellview for the item on the window stack corresponding to x_level.
;# A value of nil is returned if the stack is empty, x_level is not a valid stack level
;# in w_window, or x_level is -1. If x_level is defaulted or nil then the current item
;# on the stack is used.

이 함수는 현재 window의 cellView를 반환해줍니다. cellView 란 window에서 메뉴 부분을 뺀 시커먼 부분이라고 보시면 됩니다.


CIW 창에 deGetCellView()라고 입력해 보겠습니다.

deGetCellView()
db:0x11fedf1a

db를 반환한 것 같지만 뭔지 알 수가 없습니다. 이때 이 db에 접근하기 위해 operator 즉 "->"를 사용합니다. "dbGetCellView()->"까지 입력하면 아무 반응은 없습니다. db에 어떠한 항목들이 있는지 보기 위해서는? 를 사용하시면 됩니다.

deGetCellView()->?

(cellView objType prop bBox lib
    libName cellName cell cellViewType cellType
    conns constraintGroups DBUPerUU fileName createTime
    fileTimeStamp groupMembers groups instHeaders instHeaderRefs
    instRefs instanceMasters instances isParamCell layerHeaders
    layerPurposePairs lpps memInsts mode modifiedButNotSaved
    modifiedCounter mosaics markers trackPatterns rowHeaders
    rows nets shapes signals sigNames
    subMasters superMaster terminals userUnits viewName
    view textDisplays assocTextDisplays needRefresh netCount
    anyInstCount termCount clusters prBoundary snapBoundary
    viaHeaders viaMasters routes steiners blockages
    vias viaVariants guides sitePattern areaBoundaries
    figGroups gCellPatterns
)

 

하지만 항목들의 값까지 궁금하다면 "->??"를 사용합니다.

deGetCellView()->??

(db:0x11fedf1a cellView db:0x11fedf1a objType "cellView"
    prop 
    (db:0x11fe289a db:0x11fe28a2 db:0x11fe28a1) bBox 
    ((5.602 -12.285) 
 (27.535 -7.855)
    ) lib
    dd:0x13b41d10 libName "temp_lib" cellName "AAA"
    cell dd:0x13b41e50 cellViewType "maskLayout" cellType
    "none" conns nil constraintGroups 
    (cst:0x11fe489a cst:0x11fe489b cst:0x11fe48a8 cst:0x11fe48dd cst:0x11fe48df

                   .

                   .

                   . 중략

                   .

                   .
 db:0x11fe516d db:0x11fe516e db:0x11fe516f db:0x11fe5170 db:0x11fe5171
 db:0x11fe5172 db:0x11fe5173 db:0x11fe5174 db:0x11fe5175 db:0x11fe5176
 db:0x11fe5177 db:0x11fe5178 db:0x11fe5179
    ) sitePattern nil areaBoundaries
    nil figGroups nil gCellPatterns nil
)

너무 많아서 뭐가 뭔지 모르겠군요. 하지만 잘 보면 libName "temp_lib" cellName "AAA".. 란 부분을 보니 맞게 접근한 것 같습니다. 좀 전에 label을 하나 만들었는데 해당 label 은 shapes 란 항목에 있습니다.

 

deGetCellView()->shapes
(db:0x11fe654b)

결과가 ( )  안에 쌓여 있는데 이것은 원래 다루려고 했던 list입니다. 일단 list에 관한 몇몇 함수는 다음장으로 미루고 nth라는 함수를 통해 저 shape에 접근해 봅시다. 아래와 같이 입력해 봅니다.

nth(0 deGetCellView()->shapes)->??
(db:0x11fe654b cellView db:0x11fedf1a objType "label"
    prop nil bBox 
    ((5.602 -11.635) 
 (25.318 -8.635)
    ) children
    nil groupMembers nil isAnyInst nil
    isShape t matchPoints nil net
    nil parent nil pin nil
    purpose "drawing" textDisplays nil assocTextDisplays
    nil markers nil figGroup nil
    isUnshielded nil shieldedNet1 nil shieldedNet2
    nil layerName "METAL1" layerNum 31
    lpp 
    ("METAL1" "drawing") connRoutes nil routeStatus
    "normal" font "roman" height 3.0
    isDrafted t isOverbar nil isVisible
    t justify "centerCenter" labelType "normalLabel"
    orient "R0" theLabel "HODMAN" xy
    (15.46 -10.135) hasTextDisplay nil
)

 

역시 뭔가 복잡해 보이지만.. objType 은 "label"이고 layerName 은 "METAL1" 그리고 theLabel 은 "HODMAN"이네요. theLabel 이란 곳에 label에 넣은 text 가 들어가 있군요.

nth(0 deGetCellView()->shapes)->theLabel
"HODMAN"

 

우리가 찾던 label입니다. 이대로 끝내긴 아쉬우니 HODMAN이라고 쓴 label 부분을 바꿔보겠습니다. 여타 language처럼 SKILL에서도 "="를 이용해서 값을 넣어 줄 수 있습니다.

nth(0 deGetCellView()->shapes)->theLabel="GOOD!!"
"GOOD!!"

데이타에 접근 및 변경 성공


원래 하려던 list 관련 내용은 다음장으로 미뤄졌지만 가장 기본적인 개념인 operator ("->")에 관하여 적어봤습니다. 거의 모든 DB가 거미줄처럼 얽혀 있기 때문에 열심히 -> 찾아 -> 들어가 -> 보면 원하는 값을 찾을 수 있습니다. 다음 강좌는 (진짜로) list에 관한 몇몇 함수를 알아보고 그다음에는 내용이 너무 쉬운 분들을 위해 응용해서 함수 하나를 짜 볼까 합니다.