Programming 언어/Skill

[SKILL 강좌] calculate_area : 6. calibre report 작성 -끝-

호드맨 2017. 1. 23. 21:34

gui로 여러 field 들을 만들어 보고, gds 뽑고, calibre rule deck까지 작성하였습니다. 간단한 툴을 만들기 위한 대부분의 기능들을 한 강좌에 담은 것 같아 뿌듯합니다. skill을 포함하여 SVRF, 각종 layout 에 연관된 기능을 많이 알아야 따라 하기 수월하니 조금 막히더라도 너무 낙심하지 마세요. gui는 이전 강좌에서와 똑같습니다. 다시 한번 캡처해서 협찬해 주신 권하연 님께 감사를! 

강좌4 까지 만든 gui

이번 강좌에서는 만들었던 calibre rule deck을 실행시키고, 나온 결과를 보기 좋게 뜯어고치는 기능을 넣을 겁니다. 보고 싶은 양식대로 매번 고치긴 힘들잖아요. 

 

;# 일단 새로운 함수 하나 추가해 보겠습니다.
;# 첫번째 변수 string을 두번째 변수 Num 만큼 길이로 늘려 (앞쪽에 공백추가) 주는 기능입니다.
;# 뭔가 비슷한 함수가 있었던 것도 같은데 기억안나서 짜봤습니다.
;# 보기 조금 흉해서 뒤쪽에 공백 넣을것 계산해서 작성 했습니다.

procedure(print_fix_length(string Num)
   prog(()
      length = length(string)

      for(i 0 Num-2-length
         string=strcat(" " string)
      );end of for

      string=strcat(string " ")

      return(string)
   );end of prog
);end of procedure

기존 파일의 아무 곳에나 (전 맨 뒤) 추가하여 주시면 되겠습니다. 그리고 이전에 Rule Deck 작성한 부분 step 2의 when함수 안쪽에 다음 단계로 진행을 위해 추가 해 줍시다. 

 

;# step2 when 함수 안쪽의 close(outPort) 와 return(t) 사이에 아래를 추가함

ipcProcess = ipcBeginProcess(strcat("cd ../veri/45_area_cal ; rm -f touch_cal ; calibre -drc area_cal.rule ; cat " calculator->cal_cellName_SF->value ".rdb | grep '^DA [MVT]' > " calculator->cal_cellName_SF->value ".rdb1 ; touch touch_cal"))
hiRegTimer("calculate_area_step3()" 30)

;# 설명
;# ipc로 해당 디렉토리의 touch 파일을 지운 뒤 ; calibre drc 실행 ; 결과파일에서
;# DA M,DA V,DA T 로 시작하는 줄만 cellName.rdb1 으로 저장 후 touch 파일 생성

설명이 막 나가는 감이 있지만 앞서 강좌 글들과 크게 다르지 않으니..  여하튼 calibre drc 돌리고 결과 파일을 살짝 손 본 뒤 step3로 진행하게 됩니다. 물론 calibre 진행은 돌려놓고 바로 3단계에서 2단계에서와 마찬가지로 calibre가 끝나 touch 파일이 생성되기를 기다릴 겁니다.

 

;# step3 procedure 한방에 가봅시다.

procedure(calculate_area_step3()
   prog(()
      when(isFile("../veri/45_area_cal/touch_cal")
         calculator->cal_Label->value = "Calibre Run Finish!!"
         calculator->cal_Label->invisble = nil

         inPort = infile(strcat("../veri/45_area_cal/" calculator->cal_cellName_SF->value ".rdb1"))
         myPort = outfile(strcat("../veri/45_area_cal/" calculator->cal_cellName_SF->value ".rep2"))

         fprintf(myPort "##################################################################################################\n")
         fprintf(myPort "## node Area Compare result\n")
         fprintf(myPort "## Create by Hodman(Joung Hwan)\n")
         fprintf(myPort "##    e-mail(company) : jounghwan.bahk@lge.com\n")
         fprintf(myPort "##         (personal) : hodman211@naver.com\n")
         fprintf(myPort "##################################################################################################\n")
         fprintf(myPort "\n")
         fprintf(myPort "##################################################################################################\n\n")
         fprintf(myPort "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
         fprintf(myPort "                     NODE NAME     ") ;; -- (1)

            wordCount = 0  ;; (2)

            if(calculator->cal_bot_layer_CF->value == "m0" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M0  ")
               wordCount = wordCount + 3
            );end of if M0
   
            if(calculator->cal_top_layer_CF->value == "m0" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V0  ")
               wordCount = wordCount + 3
            );end of if V0
   
            if(calculator->cal_bot_layer_CF->value == "m1" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M1  ")
               wordCount = wordCount + 3
            );end of if M1
   
            if(calculator->cal_top_layer_CF->value == "m1" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V1  ")
               wordCount = wordCount + 3
            );end of if V1
   
            if(calculator->cal_bot_layer_CF->value == "m2" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M2  ")
               wordCount = wordCount + 3
            );end of if M2
         
            if(calculator->cal_top_layer_CF->value == "m2" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V2  ")
               wordCount = wordCount + 3
            );end of if V2
         
            if(calculator->cal_bot_layer_CF->value == "m3" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M3  ")
               wordCount = wordCount + 3
            );end of if M3
         
            if(calculator->cal_top_layer_CF->value == "m3" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V3  ")
               wordCount = wordCount + 3
            );end of if V3
         
            if(calculator->cal_bot_layer_CF->value == "m4" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M4  ")
               wordCount = wordCount + 3
            );end of if M4
         
            if(calculator->cal_top_layer_CF->value == "m4" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V4  ")
               wordCount = wordCount + 3
            );end of if V4
         
            if(calculator->cal_bot_layer_CF->value == "m5" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M5  ")
               wordCount = wordCount + 3
            );end of if M5
         
            if(calculator->cal_top_layer_CF->value == "m5" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V5  ")
               wordCount = wordCount + 3
            );end of if V5
         
            if(calculator->cal_bot_layer_CF->value == "m6" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M6  ")
               wordCount = wordCount + 3
            );end of if M6
         
            if(calculator->cal_top_layer_CF->value == "m6" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V6  ")
               wordCount = wordCount + 3
            );end of if V6
         
            if(calculator->cal_bot_layer_CF->value == "m7" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M7  ")
               wordCount = wordCount + 3
            );end of if M7
         
            if(calculator->cal_top_layer_CF->value == "m7" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V7  ")
               wordCount = wordCount + 3
            );end of if V7
         
            if(calculator->cal_bot_layer_CF->value == "m8" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M8  ")
               wordCount = wordCount + 3
            );end of if M8
         
            if(calculator->cal_top_layer_CF->value == "m8" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V8  ")
               wordCount = wordCount + 3
            );end of if V8
         
            if(calculator->cal_bot_layer_CF->value == "m9" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M9  ")
               wordCount = wordCount + 3
            );end of if M9
         
            if(calculator->cal_top_layer_CF->value == "m9" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V9  ")
               wordCount = wordCount + 3
            );end of if V9
         
            if(calculator->cal_bot_layer_CF->value == "m10" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M10 ")
               wordCount = wordCount + 3
            );end of if M10
         
            if(calculator->cal_top_layer_CF->value == "m10" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V10 ")
               wordCount = wordCount + 3
            );end of if V10
         
            if(calculator->cal_bot_layer_CF->value == "m11" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M11 ")
               wordCount = wordCount + 3
            );end of if M11
         
            if(calculator->cal_top_layer_CF->value == "m11" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V11 ")
               wordCount = wordCount + 3
            );end of if V11
         
            if(calculator->cal_bot_layer_CF->value == "tm0" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  TM0 ")
               wordCount = wordCount + 3
            );end of if TM0
         
            if(calculator->cal_top_layer_CF->value == "tm0" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  TV0 ")
               wordCount = wordCount + 3
            );end of if TV0
         
            if(calculator->cal_bot_layer_CF->value == "tm1" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  TM1 ")
               wordCount = wordCount + 3
            );end of if TM1

         fprintf(myPort "\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n") ; -- (3)

         report_num = 0
         while(word=read(inPort)
            report_num++
            if(report_num == 2 then
               word_list = parseString(word "_")
               node = buildString(cdr(word_list) "_")
               fprintf(myPort "%s" print_fix_length(node 35))
            );end of if -- (4)

            if(mod(report_num 3)==0 then
               if(word==0 then
                  fprintf(myPort ":      ")
               else
                  if(word<=10 then
                     length = 1
                  else
                     length = floor(log10(word)+1)
                  );end of if

                  value = float(word)
                  value = round2(value/0.1)*0.1
                  fprintf(myPort ":")
                  for(i 1 4-length
                     fprintf(myPort " ")
                  );end of for
                  fprintf(myPort "%.1f" value)

               );end of if
            );end of if  -- (5)

            if(report_num == wordCount then
               fprintf(myPort "\n")
               report_num = 0
            );end of if
         );end of while

         close(inPort)
         close(myPort)

         ipcBeginProcess(strcat("cat ../veri/45_area_cal/" calculator->cal_cellName_SF->value ".rep2 | sed 's/:   0\\.0/:   ...:/g' > ../veri/4_area_cal/" calculator->cal_cellName_SF->value ".rep ; gvim ../veri/45_area_cal/" calculator->cal_cellName_SF->value ".rep") ; -- (6)

         return(t)
      ); end of when
      if(calculator->cal_Label->invisible == t then
         calculator->cal_Label->invisible = nil
         calculator->cal_Label->value = "Calibre Running.."
      else
         calculator->cal_Label->invisible = t
      );end of if
      hiRegTimer("calculate_area_step3()" 30)  ;; -- (7)
      return(t)
   );end of prog
);end of procedure calculate_area_step3()

 

;# 주석
;#
;# (1) : when 이 성립되면, 즉 calibre drc가 끝나고 touch 파일이 생성되면 결과 리포트 파일을
;# 만들 겁니다. 적어놓은 건 그냥 리포트 파일 header 부분입니다.
;# (2) : metal Layer가 얼마나 있는지 확인을 위한 변수 입니다. metal Layer 당 3 씩
;# 키울 겁니다. (이유는 뒤에)
;# (3) : 앞서 강좌5에서와 마찬가지로 각 layer 마다 해당 Layer Name 을 출력할 것이며
;# 주석2의 변수를 3씩 키울 겁니다.
;# (4) : calibre drc 후에 grep 으로 정리한 파일을 보면 각 layer 면적만 출력됩니다.
;# 그래서 각 node name을 추출하기 위한 함수를 짰습니다. 두번째 word에 M3_node 와 같이
;# 표시되므로 문자열 조작을 조금하여 구했습니다.
;# (5) : 각 3의 배수 word 마다 해당 Layer 의 면적이 표시되어 있으므로 주석2에서 3씩 키운 겁니다.
;# 3의 배수 word 마다 값을 소수점 한자리에서 반올림하여 적어주었습니다.
;# (6) : 나중에 추가했던 건데.. 면적이 반올림하여 0.0 으로 되는 것들은 그냥 .... 으로 표시했습니다.
;# (7) : when 바깥 쪽은 이전 step2와 마찬가지로 calibre 실행 중에는 calibre running.. 을
;# 3초마다 껐다 켰다 하게 했습니다.

어마 무시한 길이의 코드가 되었지만.. 중간에 좀 반복적인 구문이 많아서 쓸데없이 길어진 걸 생각하면, 그래도 나름 선방했습니다. 다음 강좌를 어떤 식으로 할지 결정하진 못했는데, 이번 것처럼 너무 길진 않도록 할 생각입니다. 아직 떠오르는 게 없어서 며칠 생각해보고 돌아오도록 하겠습니다.

부족한 점이 많지만 읽어주셔서 감사합니다. ^--^ 호드맨 드림. 

 

더보기
;# calculator.il 파일 전문

cal_cellName_SF = hiCreateStringField(
        ?name 'cal_cellName_SF
        ?prompt "Cell Name"
        ?defValue ""
        ?callback ""
) ;end of cal_cellName_SF

cal_cur_button = hiCreateButton(
        ?name 'cal_cur_button
        ?buttonText "Current Cell"
        ?callback "cal_cur_button_CB()"
) ;end of cal_cur_button

procedure(cal_cur_button_CB()
   prog(()
      calculator->cal_cellName_SF->value = deGetCellView()->cellName
   );end of prog
);end of procedure cal_cur_button_CB()

cal_net_file_SF = hiCreateStringField(
        ?name 'cal_net_file_SF
        ?prompt "Net File "
        ?defValue ""
        ?callback ""
) ;end of cal_net_file_SF

cal_net_file_button = hiCreateButton(
        ?name 'cal_net_file_button
        ?buttonText "..."
        ?callback "ddsFileBrowseCB(calculator 'cal_net_file_SF)"
) ;end cal_net_file_button

cal_top_layer_CF = hiCreateCyclicField(
        ?name 'cal_top_layer_CF
        ?choices list("m0" "m1" "m2" "m3" "m4" "m5" "m6" "m7" "m8" "m9" "m10" "m11" "TM0" "TM1")
        ?prompt "CHECK TOP LAYER"
        ?value "m11"
) ;end of cal_top_layer_CF

cal_bot_layer_CF = hiCreateCyclicField(
        ?name 'cal_bot_layer_CF
        ?choices list("m0" "m1" "m2" "m3" "m4" "m5" "m6" "m7" "m8" "m9" "m10" "m11" "TM0" "TM1")
        ?prompt "CHECK BOT LAYER"
        ?value "m1"
) ;end of cal_bot_layer_CF

cal_run_button = hiCreateButton(
        ?name 'cal_run_button
        ?buttonText "Calculate Area"
        ?callback "calculate_area()"
) ;end of cal_cur_button

cal_gdsex_BB = hiCreateBooleanButton(
        ?name 'cal_gdsex_BB
        ?buttonText "Run with gds export"
        ?defValue t
) ;end of cal_gdsex_BB

cal_Label = hiCreateLabel(
        ?name 'cal_Label
        ?labelText "skill programming!\nhttp://hodman.tistory.com"
) ;end of cal_Label

calculatorID = hiCreateAppForm(
          ?name 'calculator
          ?buttonLayout 'Empty
          ?formTitle "Layer Area Calculator"
          ?fields 
             list(
                list(cal_cellName_SF        040:020 280:030 70)
                list(cal_cur_button         315:020 100:040)
                list(cal_net_file_SF        040:060 380:030 70)
                list(cal_net_file_button    415:060 040:040)
                list(cal_top_layer_CF       060:100 040:040 120)
                list(cal_bot_layer_CF       060:130 040:040 120)
                list(cal_run_button         265:100 150:060)
                list(cal_gdsex_BB           060:160 150:060)
                list(cal_Label              265:170 180:030 14)
             );end of list

          ?initialSize list(500 250)
          ?minSize list(500 250)
);end of calculatorID

procedure(calculator()
   prog(()
      hiDisplayForm(calculator '(100 100))
   );end of prog
);end of procedure calculator()

procedure(reload()
   prog(()
      if(hiIsFormDisplayed(calculatorID) then
         hiFormCancel(calculator)
      ); end of if
      hiRegTimer("load(\"/user/hodman/private/skill/calculator.il\")" 1)
      hiRegTimer("calculator()" 10)
   );end of prog
);end of procedure reload()

procedure(calculate_area()
   prog(()
      printf("CellName : %s\n" calculator->cal_cellName_SF->value)
      printf("We will reference %s, for Net information.\n" calculator->cal_net_file_SF->value)
      printf("Calculate Layer from %s to %s\n" calculator->cal_bot_layer_CF->value calculator->cal_top_layer_CF->value)
      if(calculator->cal_gdsex_BB->value == t then
         cal_export_gds()
      else
         ipcProcess = ipcBeginProcess("touch ../veri/4_gds/touch_streamOut")
      );end of if
      hiRegTimer("calculate_area_step2()" 30)
   );end of prog
);end of procedure calculate_area()

procedure(calculate_area_step2()
   prog(()
      when(isFile("../veri/4_gds/touch_streamOut")
         calculator->cal_Label->value = "Stream Out Finish!!"
         calculator->cal_Label->invisble = nil

         myPort=infile(calculator->cal_net_file_SF->value)
         node_list = nil
   
         while(nodeName=read(myPort)
            node_list = append1(node_list nodeName)
         );end of while

         close(myPort)
   
         ipcProcess=ipcBeginProcess("mkdir -p ../veri/45_area_cal")
         ipcWait(ipcProcess)
   
         outPort = outfile("../veri/45_area_cal/area_cal.rule")
   
         fprintf(outPort "LAYOUT PATH \"../4_gds/%s.gds\"\n" calculator->cal_cellName_SF->value)
         fprintf(outPort "LAYOUT PRIMARY \"%s\"\n" calculator->cal_cellName_SF->value)
         fprintf(outPort "LAYOUT SYSTEM GDSII\n")
         fprintf(outPort "\n")
         fprintf(outPort "DRC RESULTS DATABASE \"compare.DB\"\n")
         fprintf(outPort "\n")
         fprintf(outPort "DRC KEEP EMPTY NO\n")
         fprintf(outPort "DRC CHECK TEXT ALL\n")
         fprintf(outPort "\n")
         fprintf(outPort "DRC MAXIMUM RESULTS ALL //FLAT MODE EXTRACTION Make COMMENT\n")
         fprintf(outPort "DRC MAXIMUM VERTEX  ALL //FLAT MODE EXTRACTION Make COMMENT\n")
         fprintf(outPort "\n")
         fprintf(outPort "DRC INCREMENTAL CONNECT YES\n")
         fprintf(outPort "DRC TOLERANCE FACTOR 0.0005\n")
         fprintf(outPort "\n")
         fprintf(outPort "LAYOUT CASE NO\n")
         fprintf(outPort "LAYOUT DEPTH ALL\n")
         fprintf(outPort "\n")
         fprintf(outPort "VIRTUAL CONNECT NAME \"?\"\n")
         fprintf(outPort "\n")
         fprintf(outPort "UNIT CAPACITANCE FF\n")
         fprintf(outPort "UNIT LENGTH      U\n")
         fprintf(outPort "UNIT RESISTANCE  OHM\n")
         fprintf(outPort "UNIT TIME        US\n")
         fprintf(outPort "\n")
         fprintf(outPort "FLAG ACUTE   YES\n")
         fprintf(outPort "FLAG OFFGRID YES\n")
         fprintf(outPort "FLAG SKEW    YES\n")
         fprintf(outPort "\n")
         fprintf(outPort "PRECISION 1000\n")
         fprintf(outPort "\n")
         fprintf(outPort "VARIABLE OFF_GRID 1\n")
         fprintf(outPort "\n")
         fprintf(outPort "TEXT DEPTH PRIMARY\n")

         LAYERON = nil

         if(calculator->cal_bot_layer_CF->value == "m0" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET55I   1155 // m0\n")
            fprintf(outPort "LAYER MAP 55 DATATYPE 0 1155 // m0 drawing\n")
            fprintf(outPort "LAYER MAP 55 DATATYPE 2 1155 // m0 pin\n")
            fprintf(outPort "LAYER MAP 55 DATATYPE 250 1155 // m0 fill\n")
            fprintf(outPort "LAYER MAP 55 DATATYPE 251 1155 // m0 actFill\n")
            fprintf(outPort "LAYER MAP 241 DATATYPE 0 1155 // m0 drawing\n")
            fprintf(outPort "LAYER MAP 241 DATATYPE 2 1155 // m0 pin\n")
            fprintf(outPort "LAYER MAP 241 DATATYPE 250 1155 // m0 fill\n")
            fprintf(outPort "LAYER MAP 241 DATATYPE 251 1155 // m0 actFill\n")
            fprintf(outPort "LAYER MAP 120 DATATYPE 0 1155 // m0 drawing\n")
            fprintf(outPort "LAYER MAP 120 DATATYPE 2 1155 // m0 pin\n")
            fprintf(outPort "LAYER MAP 120 DATATYPE 250 1155 // m0 fill\n")
            fprintf(outPort "LAYER MAP 120 DATATYPE 251 1155 // m0 actFill\n")
            fprintf(outPort "TEXT LAYER 55 ATTACH 55 MET55I\n")
            fprintf(outPort "\n")
         );end of if M0

         if(calculator->cal_top_layer_CF->value == "m0" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA56I   1156 // v0\n")
            fprintf(outPort "LAYER MAP 56 DATATYPE 0 1156 // v0 drawing\n")
            fprintf(outPort "LAYER MAP 56 DATATYPE 250 1156 // v0 fill\n")
            fprintf(outPort "LAYER MAP 56 DATATYPE 251 1156 // v0 actFill\n")
            fprintf(outPort "CONNECT MET55I MET4I BY VIA56I\n")
            fprintf(outPort "\n")
         );end of if V0

         if(calculator->cal_bot_layer_CF->value == "m1" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET4I   11114 // m1\n")
            fprintf(outPort "LAYER MAP 4 DATATYPE 0 11114 // m1 drawing\n")
            fprintf(outPort "LAYER MAP 4 DATATYPE 2 11114 // m1 pin\n")
            fprintf(outPort "LAYER MAP 4 DATATYPE 250 11114 // m1 fill\n")
            fprintf(outPort "LAYER MAP 4 DATATYPE 251 11114 // m1 actFill\n")
            fprintf(outPort "TEXT LAYER 4 ATTACH 4 MET4I\n")
            fprintf(outPort "\n")
         );end of if M1

         if(calculator->cal_top_layer_CF->value == "m1" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA13I   1113 // v1\n")
            fprintf(outPort "LAYER MAP 13 DATATYPE 0 1113 // v1 drawing\n")
            fprintf(outPort "LAYER MAP 13 DATATYPE 250 1113 // v1 fill\n")
            fprintf(outPort "LAYER MAP 13 DATATYPE 251 1113 // v1 actFill\n")
            fprintf(outPort "LAYER MAP 43 DATATYPE 0 1113 // v1 drawing\n")
            fprintf(outPort "LAYER MAP 43 DATATYPE 250 1113 // v1 fill\n")
            fprintf(outPort "LAYER MAP 43 DATATYPE 251 1113 // v1 actFill\n")
            fprintf(outPort "LAYER MAP 44 DATATYPE 0 1113 // v1 drawing\n")
            fprintf(outPort "LAYER MAP 44 DATATYPE 250 1113 // v1 fill\n")
            fprintf(outPort "LAYER MAP 44 DATATYPE 251 1113 // v1 actFill\n")
            fprintf(outPort "LAYER MAP 40 DATATYPE 0 1113 // v1 drawing\n")
            fprintf(outPort "LAYER MAP 40 DATATYPE 250 1113 // v1 fill\n")
            fprintf(outPort "LAYER MAP 40 DATATYPE 251 1113 // v1 actFill\n")
            fprintf(outPort "CONNECT MET4I MET14I BY VIA13I\n")
            fprintf(outPort "\n")
         );end of if V1

         if(calculator->cal_bot_layer_CF->value == "m2" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET14I   1114 // m2\n")
            fprintf(outPort "LAYER MAP 14 DATATYPE 0 1114 // m2 drawing\n")
            fprintf(outPort "LAYER MAP 14 DATATYPE 2 1114 // m2 pin\n")
            fprintf(outPort "LAYER MAP 14 DATATYPE 250 1114 // m2 fill\n")
            fprintf(outPort "LAYER MAP 14 DATATYPE 251 1114 // m2 actFill\n")
            fprintf(outPort "LAYER MAP 112 DATATYPE 0 1114 // m2 drawing\n")
            fprintf(outPort "LAYER MAP 112 DATATYPE 2 1114 // m2 pin\n")
            fprintf(outPort "LAYER MAP 112 DATATYPE 250 1114 // m2 fill\n")
            fprintf(outPort "LAYER MAP 112 DATATYPE 251 1114 // m2 actFill\n")
            fprintf(outPort "TEXT LAYER 14 ATTACH 14 MET14I\n")
            fprintf(outPort "\n")
         );end of if M2
      
         if(calculator->cal_top_layer_CF->value == "m2" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA17I   1117 // v2\n")
            fprintf(outPort "LAYER MAP 17 DATATYPE 0 1117 // v2 drawing\n")
            fprintf(outPort "LAYER MAP 17 DATATYPE 250 1117 // v2 fill\n")
            fprintf(outPort "LAYER MAP 17 DATATYPE 251 1117 // v2 actFill\n")
            fprintf(outPort "LAYER MAP 95 DATATYPE 0 1117 // v2 drawing\n")
            fprintf(outPort "LAYER MAP 95 DATATYPE 250 1117 // v2 fill\n")
            fprintf(outPort "LAYER MAP 95 DATATYPE 251 1117 // v2 actFill\n")
            fprintf(outPort "LAYER MAP 96 DATATYPE 0 1117 // v2 drawing\n")
            fprintf(outPort "LAYER MAP 96 DATATYPE 250 1117 // v2 fill\n")
            fprintf(outPort "LAYER MAP 96 DATATYPE 251 1117 // v2 actFill\n")
            fprintf(outPort "CONNECT MET14I MET18I BY VIA17I\n")
            fprintf(outPort "\n")
         );end of if V2
      
         if(calculator->cal_bot_layer_CF->value == "m3" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET18I   1118 // m3\n")
            fprintf(outPort "LAYER MAP 18 DATATYPE 0 1118 // m3 drawing\n")
            fprintf(outPort "LAYER MAP 18 DATATYPE 2 1118 // m3 pin\n")
            fprintf(outPort "LAYER MAP 18 DATATYPE 250 1118 // m3 fill\n")
            fprintf(outPort "LAYER MAP 18 DATATYPE 251 1118 // m3 actFill\n")
            fprintf(outPort "LAYER MAP 113 DATATYPE 0 1118 // m3 drawing\n")
            fprintf(outPort "LAYER MAP 113 DATATYPE 2 1118 // m3 pin\n")
            fprintf(outPort "LAYER MAP 113 DATATYPE 250 1118 // m3 fill\n")
            fprintf(outPort "LAYER MAP 113 DATATYPE 251 1118 // m3 actFill\n")
            fprintf(outPort "TEXT LAYER 18 ATTACH 18 MET18I\n")
            fprintf(outPort "\n")
         );end of if M3
      
         if(calculator->cal_top_layer_CF->value == "m3" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA21I   1121 // v3\n")
            fprintf(outPort "LAYER MAP 21 DATATYPE 0 1121 // v3 drawing\n")
            fprintf(outPort "LAYER MAP 21 DATATYPE 250 1121 // v3 fill\n")
            fprintf(outPort "LAYER MAP 21 DATATYPE 251 1121 // v3 actFill\n")
            fprintf(outPort "LAYER MAP 67 DATATYPE 0 1121 // v3 drawing\n")
            fprintf(outPort "LAYER MAP 67 DATATYPE 250 1121 // v3 fill\n")
            fprintf(outPort "LAYER MAP 67 DATATYPE 251 1121 // v3 actFill\n")
            fprintf(outPort "LAYER MAP 68 DATATYPE 0 1121 // v3 drawing\n")
            fprintf(outPort "LAYER MAP 68 DATATYPE 250 1121 // v3 fill\n")
            fprintf(outPort "LAYER MAP 68 DATATYPE 251 1121 // v3 actFill\n")
            fprintf(outPort "CONNECT MET18I MET22I BY VIA21I\n")
            fprintf(outPort "\n")
         );end of if V3
      
         if(calculator->cal_bot_layer_CF->value == "m4" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET22I   1122 // m4\n")
            fprintf(outPort "LAYER MAP 22 DATATYPE 0 1122 // m4 drawing\n")
            fprintf(outPort "LAYER MAP 22 DATATYPE 2 1122 // m4 pin\n")
            fprintf(outPort "LAYER MAP 22 DATATYPE 250 1122 // m4 fill\n")
            fprintf(outPort "LAYER MAP 22 DATATYPE 251 1122 // m4 actFill\n")
            fprintf(outPort "LAYER MAP 114 DATATYPE 0 1122 // m4 drawing\n")
            fprintf(outPort "LAYER MAP 114 DATATYPE 2 1122 // m4 pin\n")
            fprintf(outPort "LAYER MAP 114 DATATYPE 250 1122 // m4 fill\n")
            fprintf(outPort "LAYER MAP 114 DATATYPE 251 1122 // m4 actFill\n")
            fprintf(outPort "TEXT LAYER 22 ATTACH 22 MET22I\n")
            fprintf(outPort "\n")
         );end of if M4
      
         if(calculator->cal_top_layer_CF->value == "m4" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA25I   1125 // v4\n")
            fprintf(outPort "LAYER MAP 25 DATATYPE 0 1125 // v4 drawing\n")
            fprintf(outPort "LAYER MAP 25 DATATYPE 250 1125 // v4 fill\n")
            fprintf(outPort "LAYER MAP 25 DATATYPE 251 1125 // v4 actFill\n")
            fprintf(outPort "CONNECT MET22I MET26I BY VIA25I\n")
            fprintf(outPort "\n")
         );end of if V4
      
         if(calculator->cal_bot_layer_CF->value == "m5" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET26I   1126 // m5\n")
            fprintf(outPort "LAYER MAP 26 DATATYPE 0 1126 // m5 drawing\n")
            fprintf(outPort "LAYER MAP 26 DATATYPE 2 1126 // m5 pin\n")
            fprintf(outPort "LAYER MAP 26 DATATYPE 250 1126 // m5 fill\n")
            fprintf(outPort "LAYER MAP 26 DATATYPE 251 1126 // m5 actFill\n")
            fprintf(outPort "LAYER MAP 115 DATATYPE 0 1126 // m5 drawing\n")
            fprintf(outPort "LAYER MAP 115 DATATYPE 2 1126 // m5 pin\n")
            fprintf(outPort "LAYER MAP 115 DATATYPE 250 1126 // m5 fill\n")
            fprintf(outPort "LAYER MAP 115 DATATYPE 251 1126 // m5 actFill\n")
            fprintf(outPort "TEXT LAYER 26 ATTACH 26 MET26I\n")
            fprintf(outPort "\n")
         );end of if M5
      
         if(calculator->cal_top_layer_CF->value == "m5" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA29I   1129 // v5\n")
            fprintf(outPort "LAYER MAP 29 DATATYPE 0 1129 // v5 drawing\n")
            fprintf(outPort "LAYER MAP 29 DATATYPE 250 1129 // v5 fill\n")
            fprintf(outPort "LAYER MAP 29 DATATYPE 251 1129 // v5 actFill\n")
            fprintf(outPort "CONNECT MET26I MET30I BY VIA29I\n")
            fprintf(outPort "\n")
         );end of if V5
      
         if(calculator->cal_bot_layer_CF->value == "m6" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET30I   1130 // m6\n")
            fprintf(outPort "LAYER MAP 30 DATATYPE 0 1130 // m6 drawing\n")
            fprintf(outPort "LAYER MAP 30 DATATYPE 2 1130 // m6 pin\n")
            fprintf(outPort "LAYER MAP 30 DATATYPE 250 1130 // m6 fill\n")
            fprintf(outPort "LAYER MAP 30 DATATYPE 251 1130 // m6 actFill\n")
            fprintf(outPort "TEXT LAYER 30 ATTACH 30 MET30I\n")
            fprintf(outPort "\n")
         );end of if M6
      
         if(calculator->cal_top_layer_CF->value == "m6" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA33I   1133 // v6\n")
            fprintf(outPort "LAYER MAP 33 DATATYPE 0 1133 // v6 drawing\n")
            fprintf(outPort "LAYER MAP 33 DATATYPE 250 1133 // v6 fill\n")
            fprintf(outPort "LAYER MAP 33 DATATYPE 251 1133 // v6 actFill\n")
            fprintf(outPort "CONNECT MET30I MET34I BY VIA33I\n")
            fprintf(outPort "\n")
         );end of if V6
      
         if(calculator->cal_bot_layer_CF->value == "m7" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET34I   1134 // m7\n")
            fprintf(outPort "LAYER MAP 34 DATATYPE 0 1134 // m7 drawing\n")
            fprintf(outPort "LAYER MAP 34 DATATYPE 2 1134 // m7 pin\n")
            fprintf(outPort "LAYER MAP 34 DATATYPE 250 1134 // m7 fill\n")
            fprintf(outPort "LAYER MAP 34 DATATYPE 251 1134 // m7 actFill\n")
            fprintf(outPort "TEXT LAYER 34 ATTACH 34 MET34I\n")
            fprintf(outPort "\n")
         );end of if M7
      
         if(calculator->cal_top_layer_CF->value == "m7" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA37I   1137 // v7\n")
            fprintf(outPort "LAYER MAP 37 DATATYPE 0 1137 // v7 drawing\n")
            fprintf(outPort "LAYER MAP 37 DATATYPE 250 1137 // v7 fill\n")
            fprintf(outPort "LAYER MAP 37 DATATYPE 251 1137 // v7 actFill\n")
            fprintf(outPort "CONNECT MET34I MET38I BY VIA37I\n")
            fprintf(outPort "\n")
         );end of if V7
      
         if(calculator->cal_bot_layer_CF->value == "m8" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET38I   1138 // m8\n")
            fprintf(outPort "LAYER MAP 38 DATATYPE 0 1138 // m8 drawing\n")
            fprintf(outPort "LAYER MAP 38 DATATYPE 2 1138 // m8 pin\n")
            fprintf(outPort "LAYER MAP 38 DATATYPE 250 1138 // m8 fill\n")
            fprintf(outPort "LAYER MAP 38 DATATYPE 251 1138 // m8 actFill\n")
            fprintf(outPort "TEXT LAYER 38 ATTACH 38 MET38I\n")
            fprintf(outPort "\n")
         );end of if M8
      
         if(calculator->cal_top_layer_CF->value == "m8" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA41I   1141 // v8\n")
            fprintf(outPort "LAYER MAP 41 DATATYPE 0 1141 // v8 drawing\n")
            fprintf(outPort "LAYER MAP 41 DATATYPE 250 1141 // v8 fill\n")
            fprintf(outPort "LAYER MAP 41 DATATYPE 251 1141 // v8 actFill\n")
            fprintf(outPort "CONNECT MET38I MET46I BY VIA41I\n")
            fprintf(outPort "\n")
         );end of if V8
      
         if(calculator->cal_bot_layer_CF->value == "m9" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET46I   1146 // m9\n")
            fprintf(outPort "LAYER MAP 46 DATATYPE 0 1146 // m9 drawing\n")
            fprintf(outPort "LAYER MAP 46 DATATYPE 2 1146 // m9 pin\n")
            fprintf(outPort "LAYER MAP 46 DATATYPE 250 1146 // m9 fill\n")
            fprintf(outPort "LAYER MAP 46 DATATYPE 251 1146 // m9 actFill\n")
            fprintf(outPort "TEXT LAYER 46 ATTACH 46 MET46I\n")
            fprintf(outPort "\n")
         );end of if M9
      
         if(calculator->cal_top_layer_CF->value == "m9" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA45I   1145 // v9\n")
            fprintf(outPort "LAYER MAP 45 DATATYPE 0 1145 // v9 drawing\n")
            fprintf(outPort "LAYER MAP 45 DATATYPE 250 1145 // v9 fill\n")
            fprintf(outPort "LAYER MAP 45 DATATYPE 251 1145 // v9 actFill\n")
            fprintf(outPort "CONNECT MET46I MET54I BY VIA45I\n")
            fprintf(outPort "\n")
         );end of if V9
      
         if(calculator->cal_bot_layer_CF->value == "m10" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET54I   1154 // m10\n")
            fprintf(outPort "LAYER MAP 54 DATATYPE 0 1154 // m10 drawing\n")
            fprintf(outPort "LAYER MAP 54 DATATYPE 2 1154 // m10 pin\n")
            fprintf(outPort "LAYER MAP 54 DATATYPE 250 1154 // m10 fill\n")
            fprintf(outPort "LAYER MAP 54 DATATYPE 251 1154 // m10 actFill\n")
            fprintf(outPort "TEXT LAYER 54 ATTACH 54 MET54I\n")
            fprintf(outPort "\n")
         );end of if M10
      
         if(calculator->cal_top_layer_CF->value == "m10" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA53I   1153 // v10\n")
            fprintf(outPort "LAYER MAP 53 DATATYPE 0 1153 // v10 drawing\n")
            fprintf(outPort "LAYER MAP 53 DATATYPE 250 1153 // v10 fill\n")
            fprintf(outPort "LAYER MAP 53 DATATYPE 251 1153 // v10 actFill\n")
            fprintf(outPort "CONNECT MET54I MET58I BY VIA53I\n")
            fprintf(outPort "\n")
         );end of if V10
      
         if(calculator->cal_bot_layer_CF->value == "m11" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET58I   1158 // m11\n")
            fprintf(outPort "LAYER MAP 58 DATATYPE 0 1158 // m11 drawing\n")
            fprintf(outPort "LAYER MAP 58 DATATYPE 2 1158 // m11 pin\n")
            fprintf(outPort "LAYER MAP 58 DATATYPE 250 1158 // m11 fill\n")
            fprintf(outPort "LAYER MAP 58 DATATYPE 251 1158 // m11 actFill\n")
            fprintf(outPort "TEXT LAYER 58 ATTACH 58 MET58I\n")
            fprintf(outPort "\n")
         );end of if M11
      
         if(calculator->cal_top_layer_CF->value == "m11" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA57I   1157 // v11\n")
            fprintf(outPort "LAYER MAP 57 DATATYPE 0 1157 // v11 drawing\n")
            fprintf(outPort "LAYER MAP 57 DATATYPE 250 1157 // v11 fill\n")
            fprintf(outPort "LAYER MAP 57 DATATYPE 251 1157 // v11 actFill\n")
            fprintf(outPort "CONNECT MET58I MET64I BY VIA57I\n")
            fprintf(outPort "\n")
         );end of if V11
      
         if(calculator->cal_bot_layer_CF->value == "tm0" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET64I   1164 // tm0\n")
            fprintf(outPort "LAYER MAP 64 DATATYPE 0 1164 // tm0 drawing\n")
            fprintf(outPort "LAYER MAP 64 DATATYPE 2 1164 // tm0 pin\n")
            fprintf(outPort "LAYER MAP 64 DATATYPE 250 1164 // tm0 fill\n")
            fprintf(outPort "LAYER MAP 64 DATATYPE 251 1164 // tm0 actFill\n")
            fprintf(outPort "TEXT LAYER 64 ATTACH 64 MET64I\n")
            fprintf(outPort "\n")
         );end of if TM0
      
         if(calculator->cal_top_layer_CF->value == "tm0" then LAYERON = nil)
         if(LAYERON == t then
            fprintf(outPort "LAYER VIA63I   1163 // tv0\n")
            fprintf(outPort "LAYER MAP 63 DATATYPE 0 1163 // tv0 drawing\n")
            fprintf(outPort "LAYER MAP 63 DATATYPE 250 1163 // tv0 fill\n")
            fprintf(outPort "LAYER MAP 63 DATATYPE 251 1163 // tv0 actFill\n")
            fprintf(outPort "CONNECT MET64I MET42I BY VIA63I\n")
            fprintf(outPort "\n")
         );end of if TV0
      
         if(calculator->cal_bot_layer_CF->value == "tm1" then LAYERON = t)
         if(LAYERON == t then
            fprintf(outPort "LAYER MET42I   1142 // tm1\n")
            fprintf(outPort "LAYER MAP 42 DATATYPE 0 1142 // tm1 drawing\n")
            fprintf(outPort "LAYER MAP 42 DATATYPE 2 1142 // tm1 pin\n")
            fprintf(outPort "LAYER MAP 42 DATATYPE 250 1142 // tm1 fill\n")
            fprintf(outPort "LAYER MAP 42 DATATYPE 251 1142 // tm1 actFill\n")
            fprintf(outPort "TEXT LAYER 42 ATTACH 42 MET42I\n")
            fprintf(outPort "\n")
         );end of if TM1

         foreach(node node_list
            LAYERON = nil
            RULEW1 = strcat("AREA_" node " { DENSITY ")
            RULEW2 = " [ "
   
            if(calculator->cal_bot_layer_CF->value == "m0" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M0_%s  = NET MET55I  '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M0_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M0_" node ") ")
            );end of if M0
   
            if(calculator->cal_top_layer_CF->value == "m0" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V0_%s  = NET VIA56I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V0_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V0_" node ") ")
            );end of if V0
   
            if(calculator->cal_bot_layer_CF->value == "m1" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M1_%s  = NET MET4I  '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M1_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M1_" node ") ")
            );end of if M1
   
            if(calculator->cal_top_layer_CF->value == "m1" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V1_%s  = NET VIA13I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V1_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V1_" node ") ")
            );end of if V1
   
            if(calculator->cal_bot_layer_CF->value == "m2" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M2_%s  = NET MET14I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M2_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M2_" node ") ")
            );end of if M2
         
            if(calculator->cal_top_layer_CF->value == "m2" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V2_%s  = NET VIA17I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V2_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V2_" node ") ")
            );end of if V2
         
            if(calculator->cal_bot_layer_CF->value == "m3" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M3_%s  = NET MET18I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M3_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M3_" node ") ")
            );end of if M3
         
            if(calculator->cal_top_layer_CF->value == "m3" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V3_%s  = NET VIA21I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V3_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V3_" node ") ")
            );end of if V3
         
            if(calculator->cal_bot_layer_CF->value == "m4" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M4_%s  = NET MET22I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M4_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M4_" node ") ")
            );end of if M4
         
            if(calculator->cal_top_layer_CF->value == "m4" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V4_%s  = NET VIA25I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V4_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V4_" node ") ")
            );end of if V4
         
            if(calculator->cal_bot_layer_CF->value == "m5" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M5_%s  = NET MET26I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M5_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M5_" node ") ")
            );end of if M5
         
            if(calculator->cal_top_layer_CF->value == "m5" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V5_%s  = NET VIA29I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V5_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V5_" node ") ")
            );end of if V5
         
            if(calculator->cal_bot_layer_CF->value == "m6" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M6_%s  = NET MET30I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M6_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M6_" node ") ")
            );end of if M6
         
            if(calculator->cal_top_layer_CF->value == "m6" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V6_%s  = NET VIA33I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V6_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V6_" node ") ")
            );end of if V6
         
            if(calculator->cal_bot_layer_CF->value == "m7" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M7_%s  = NET MET34I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M7_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M7_" node ") ")
            );end of if M7
         
            if(calculator->cal_top_layer_CF->value == "m7" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V7_%s  = NET VIA37I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V7_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V7_" node ") ")
            );end of if V7
         
            if(calculator->cal_bot_layer_CF->value == "m8" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M8_%s  = NET MET38I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M8_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M8_" node ") ")
            );end of if M8
         
            if(calculator->cal_top_layer_CF->value == "m8" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V8_%s  = NET VIA41I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V8_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V8_" node ") ")
            );end of if V8
         
            if(calculator->cal_bot_layer_CF->value == "m9" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M9_%s  = NET MET46I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M9_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M9_" node ") ")
            );end of if M9
         
            if(calculator->cal_top_layer_CF->value == "m9" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V9_%s  = NET VIA45I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V9_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V9_" node ") ")
            );end of if V9
         
            if(calculator->cal_bot_layer_CF->value == "m10" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M10_%s = NET MET54I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M10_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M10_" node ") ")
            );end of if M10
         
            if(calculator->cal_top_layer_CF->value == "m10" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V10_%s = NET VIA53I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V10_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V10_" node ") ")
            );end of if V10
         
            if(calculator->cal_bot_layer_CF->value == "m11" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "M11_%s = NET MET58I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "M11_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(M11_" node ") ")
            );end of if M11
         
            if(calculator->cal_top_layer_CF->value == "m11" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "V11_%s = NET VIA57I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "V11_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(V11_" node ") ")
            );end of if V11
         
            if(calculator->cal_bot_layer_CF->value == "tm0" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "TM0_%s = NET MET64I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "TM0_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(TM0_" node ") ")
            );end of if TM0
         
            if(calculator->cal_top_layer_CF->value == "tm0" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(outPort "TV0_%s = NET VIA63I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "TV0_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(TV0_" node ") ")
            );end of if TV0
         
            if(calculator->cal_bot_layer_CF->value == "tm1" then LAYERON = t)
            if(LAYERON == t then
               fprintf(outPort "TM1_%s = NET MET42I '%s'\n" node node)
               RULEW1 = strcat(RULEW1 "TM1_" node " ")
               RULEW2 = strcat(RULEW2 "+AREA(TM1_" node ") ")
            );end of if TM1

            RULEW1 = strcat(RULEW1 "> 0")
            RULEW2 = strcat(RULEW2 "] RDB only \"" calculator->cal_cellName_SF->value ".rdb\" }")

            fprintf(outPort "%s %s\n" RULEW1 RULEW2)

         );end of foreach

         close(outPort)

         ipcProcess = ipcBeginProcess(strcat("cd ../veri/45_area_cal ; rm -f touch_cal ; calibre -drc area_cal.rule ; cat " calculator->cal_cellName_SF->value ".rdb | grep '^DA [MVT]' > " calculator->cal_cellName_SF->value ".rdb1 ; touch touch_cal"))

         hiRegTimer("calculate_area_step3()" 30)

         return(t)
      )
      if(calculator->cal_Label->invisible == t then
         calculator->cal_Label->invisible = nil
         calculator->cal_Label->value = "Streaming Out.."
      else
         calculator->cal_Label->invisible = t
      );end of if
      hiRegTimer("calculate_area_step2()" 30)
      return(t)
   );end of prog
);end of procedure calculate_area_step2()

procedure(calculate_area_step3()
   prog(()
      when(isFile("../veri/45_area_cal/touch_cal")
         calculator->cal_Label->value = "Calibre Run Finish!!"
         calculator->cal_Label->invisble = nil

         inPort = infile(strcat("../veri/45_area_cal/" calculator->cal_cellName_SF->value ".rdb1"))
         myPort = outfile(strcat("../veri/45_area_cal/" calculator->cal_cellName_SF->value ".rep2"))

         fprintf(myPort "##################################################################################################\n")
         fprintf(myPort "## node Area Compare result\n")
         fprintf(myPort "## Create by Hodman(Joung Hwan)\n")
         fprintf(myPort "##    e-mail(company) : jounghwan.bahk@lge.com\n")
         fprintf(myPort "##         (personal) : hodman211@naver.com\n")
         fprintf(myPort "##################################################################################################\n")
         fprintf(myPort "\n")
         fprintf(myPort "##################################################################################################\n\n")
         fprintf(myPort "----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")
         fprintf(myPort "                     NODE NAME     ")

            wordCount = 0

            if(calculator->cal_bot_layer_CF->value == "m0" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M0  ")
               wordCount = wordCount + 3
            );end of if M0
   
            if(calculator->cal_top_layer_CF->value == "m0" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V0  ")
               wordCount = wordCount + 3
            );end of if V0
   
            if(calculator->cal_bot_layer_CF->value == "m1" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M1  ")
               wordCount = wordCount + 3
            );end of if M1
   
            if(calculator->cal_top_layer_CF->value == "m1" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V1  ")
               wordCount = wordCount + 3
            );end of if V1
   
            if(calculator->cal_bot_layer_CF->value == "m2" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M2  ")
               wordCount = wordCount + 3
            );end of if M2
         
            if(calculator->cal_top_layer_CF->value == "m2" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V2  ")
               wordCount = wordCount + 3
            );end of if V2
         
            if(calculator->cal_bot_layer_CF->value == "m3" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M3  ")
               wordCount = wordCount + 3
            );end of if M3
         
            if(calculator->cal_top_layer_CF->value == "m3" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V3  ")
               wordCount = wordCount + 3
            );end of if V3
         
            if(calculator->cal_bot_layer_CF->value == "m4" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M4  ")
               wordCount = wordCount + 3
            );end of if M4
         
            if(calculator->cal_top_layer_CF->value == "m4" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V4  ")
               wordCount = wordCount + 3
            );end of if V4
         
            if(calculator->cal_bot_layer_CF->value == "m5" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M5  ")
               wordCount = wordCount + 3
            );end of if M5
         
            if(calculator->cal_top_layer_CF->value == "m5" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V5  ")
               wordCount = wordCount + 3
            );end of if V5
         
            if(calculator->cal_bot_layer_CF->value == "m6" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M6  ")
               wordCount = wordCount + 3
            );end of if M6
         
            if(calculator->cal_top_layer_CF->value == "m6" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V6  ")
               wordCount = wordCount + 3
            );end of if V6
         
            if(calculator->cal_bot_layer_CF->value == "m7" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M7  ")
               wordCount = wordCount + 3
            );end of if M7
         
            if(calculator->cal_top_layer_CF->value == "m7" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V7  ")
               wordCount = wordCount + 3
            );end of if V7
         
            if(calculator->cal_bot_layer_CF->value == "m8" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M8  ")
               wordCount = wordCount + 3
            );end of if M8
         
            if(calculator->cal_top_layer_CF->value == "m8" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V8  ")
               wordCount = wordCount + 3
            );end of if V8
         
            if(calculator->cal_bot_layer_CF->value == "m9" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M9  ")
               wordCount = wordCount + 3
            );end of if M9
         
            if(calculator->cal_top_layer_CF->value == "m9" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V9  ")
               wordCount = wordCount + 3
            );end of if V9
         
            if(calculator->cal_bot_layer_CF->value == "m10" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M10 ")
               wordCount = wordCount + 3
            );end of if M10
         
            if(calculator->cal_top_layer_CF->value == "m10" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V10 ")
               wordCount = wordCount + 3
            );end of if V10
         
            if(calculator->cal_bot_layer_CF->value == "m11" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  M11 ")
               wordCount = wordCount + 3
            );end of if M11
         
            if(calculator->cal_top_layer_CF->value == "m11" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  V11 ")
               wordCount = wordCount + 3
            );end of if V11
         
            if(calculator->cal_bot_layer_CF->value == "tm0" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  TM0 ")
               wordCount = wordCount + 3
            );end of if TM0
         
            if(calculator->cal_top_layer_CF->value == "tm0" then LAYERON = nil)
            if(LAYERON == t then
               fprintf(myPort ":  TV0 ")
               wordCount = wordCount + 3
            );end of if TV0
         
            if(calculator->cal_bot_layer_CF->value == "tm1" then LAYERON = t)
            if(LAYERON == t then
               fprintf(myPort ":  TM1 ")
               wordCount = wordCount + 3
            );end of if TM1

         fprintf(myPort "\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n")

         report_num = 0
         while(word=read(inPort)
            report_num++
            if(report_num == 2 then
               word_list = parseString(word "_")
               node = buildString(cdr(word_list) "_")
               fprintf(myPort "%s" print_fix_length(node 35))
            );end of if

            if(mod(report_num 3)==0 then
               if(word==0 then
                  fprintf(myPort ":      ")
               else
                  if(word<=10 then
                     length = 1
                  else
                     length = floor(log10(word)+1)
                  );end of if

                  value = float(word)
                  value = round2(value/0.1)*0.1
                  fprintf(myPort ":")
                  for(i 1 4-length
                     fprintf(myPort " ")
                  );end of for
                  fprintf(myPort "%.1f" value)

               );end of if
            );end of if

            if(report_num == wordCount then
               fprintf(myPort "\n")
               report_num = 0
            );end of if
         );end of while

         close(inPort)
         close(myPort)

         ipcBeginProcess(strcat("cat ../veri/45_area_cal/" calculator->cal_cellName_SF->value ".rep2 | sed 's/:   0\\.0/:   ...:/g' > ../veri/4_area_cal/" calculator->cal_cellName_SF->value ".rep ; gvim ../veri/45_area_cal/" calculator->cal_cellName_SF->value ".rep")

         return(t)
      ); end of when
      if(calculator->cal_Label->invisible == t then
         calculator->cal_Label->invisible = nil
         calculator->cal_Label->value = "Calibre Running.."
      else
         calculator->cal_Label->invisible = t
      );end of if
      hiRegTimer("calculate_area_step3()" 30)
      return(t)
   );end of prog
);end of procedure calculate_area_step3()
      
procedure(cal_export_gds()
   prog(()
      cv = hiGetCurrentWindow()->cellView
      ipcProcess = ipcBeginProcess("mkdir -p ../veri/4_gds")
      ipcWait(ipcProcess)

      ipcProcess = ipcBeginProcess(sprintf(_tmp, "rm -f ../veri/4_gds/touch_streamOut ; strmout -library \"%s\" -strmFile ../veri/4_gds/%s.gds -topCell \"%s\" -view \"%s\" -enableColoring > ../veri/4_gds/pipo.log ; touch ../veri/4_gds/touch_streamOut" , cv->libName, cv->cellName, cv->cellName, cv->viewName))
); end prog
); end procedure

procedure(print_fix_length(string Num)
   prog(()
      length = length(string)

      for(i 0 Num-2-length
         string=strcat(" " string)
      );end of for

      string=strcat(string " ")

      return(string)
   );end of prog
);end of procedure