Programming 언어/Skill

[SKILL 강좌] calculate_area : 5. calibre rule deck 생성

호드맨 2017. 1. 19. 15:00

이번 강좌 글은 file 생성 부분이 있어서 조금 내용은 길지만 크게 복잡한 내용은 아닐 것 같습니다. 예전에 올렸던 원클릭 DRC, LVS 등과 같이, calibre Rule file을 생성한 뒤 ipc를 통해 calibre 실행시키는 내용입니다. 다른 점이 있다면 예전에는 rule 파일은 include 만 하면서 template 파일을 생성하였지만, 지금은 rule file 자체를 써야 합니다. 복잡한 rule은 아니니까 해볼까요.

강좌4 까지 만든 gui

 

;# calculate_area_step2() 함수 수정

procedure(calculate_area_step2()
   prog(()
      when(isFile("../veri/4_gds/touch_streamOut")
         calculator->cal_Label->value = "Stream Out Finish!!"
         calculator->cal_Label->invisible = 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  -- (1)

         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" cellName)
         fprintf(outPort "LAYOUT PRIMARY \"%s\"\n" cellName)
         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") -- (2)
         
         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 11155 // m0 pin\n")
            fprintf(outPort "LAYER MAP 55 DATATYPE 250 11155 // m0 fill\n")
            fprintf(outPort "LAYER MAP 55 DATATYPE 251 11155 // m0 actFill\n")
            fprintf(outPort "LAYER MAP 241 DATATYPE 0 11155 // m0 drawing\n")
            fprintf(outPort "LAYER MAP 241 DATATYPE 2 11155 // m0 pin\n")
            fprintf(outPort "LAYER MAP 241 DATATYPE 250 11155 // m0 fill\n")
            fprintf(outPort "LAYER MAP 241 DATATYPE 251 11155 // 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 11155 // m0 fill\n")
            fprintf(outPort "LAYER MAP 120 DATATYPE 251 11155 // 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 11156 // v0 fill\n")
            fprintf(outPort "LAYER MAP 56 DATATYPE 251 11156 // 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
....
.... ; continue to top metal -- (3)
....

         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
....
.... ; continue to top metal
....
            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) ; -- (4)

         return(t)
      ) ;end of when

      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


;# 주석
;# (1) :  cal_net_file_SF 에 들어가는 파일을 읽어 각 node name 들을 list 로 저장
;# (2) : SVRF (Standard Verification Rule Format) 으로 작성된 calibre rule file
;# 앞부분이다. 대충 아무 calibre rule 파일들 열어봐도 비슷한 내용이 있을 것이다.
;# 자세한 option 이나 설명은 다른 글에서 설명하도록 하고 넣을 옵션들을 넣으면 됨
;# (3) : Top metal , Bottom metal 선택에 따라 metal , via layer 의 선언부분을 옵션으로
;# 쓰도록 해놓았다. metal 이 많아서 일부분만 적었지만, foreach 등을 이용해서 좀 더 복잡하게
;# 짠다면 layer number 등만 주고도 짧게 가능할 것 같다. 하지만 layer number 등은 잘 수정
;# 되지 않으므로, 그냥 코드짤 때 한번에 적어주었다. 저런식으로 실제 Top metal 까지 적어주면
;# 될 것이다. 모든 code를 보려면 강좌 맨 끝의 묶음글을 열어보자.
;# (4) : 앞서 (3)과 마찬가지로 Top, Bottom metal 선택에 따라 각 node 에 대한 rule을 작성해
;# 주는 곳이다. 좀 길어서 복잡해 보이지만 각 node에 해당 layer 들을 M1_nodeName 과 같이
;# 각 layer 별로 선언해주고, 마지막에 rule 을 만들 string을 RULEW1 RULEW2 에 strcat 함수를
;# 통해 하나씩 더해나간 다음 마지막에 fprintf로 한번에 적어주었다. 노가다는 싫지만 이런
;# 노가다를 줄이는게 더 노가다라서..

실행은 되겠지만 각자 쓰는 공정에 맞게 하기 위해선 꽤 수정이 필요할 것 같습니다. layer Number를 알기 위해선 layermap 파일을 보셔야 하고 layermap 파일의 format에 대해선 이 또한 나중에 다뤄봅시다. Metal layer 몇 개 안 쓸 경우 좀 짧아질 수는 있겠네요. 사실 다른 공정에서 이러한 flow가 꼭 필요하진 않을 것으로도 보입니다. skill 강좌니까 그냥 그러려니 하시고 필요한 tool 들은 직접 만드시면 됩니다.

짜다 보니 export_gds 할 때 제 경우엔../veri/4_gds 폴더가 있지만, 없는 경우엔 동작을 안 하겠네요. cal_export_gds 함수를 살짝 고쳐주겠습니다. (뒷수습)

 

;# cal_export_gds()

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

중간에 흐름도 끊기고 코드도 지저분해지면서 의욕도 떨어지네요. 오탈자가 있을지 모르지만 아래 코드는 복붙 한 거니 문제없이 동작할 겁니다. gui로 cellName, net file을 지정하고 실행하게 되면 해당 경로에../veri/45_area_cal/area_cal.rule 파일을 확인할 수 있을 겁니다.

길어져버린 코드를 넣어놓겠습니다. 아마도 다음 강좌에서는 이 rule 파일을 실행시키고 결과 파일을 가지고 좀 보기 좋게 꾸며 report 파일을 만들어 보겠습니다.

 

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

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