File "original_path.il"

Full Path: /home/analogde/www/VirtualKeyboardSample/SKILL/original_path.il
File size: 11.38 KB
MIME-type: text/plain
Charset: utf-8

procedure(InitLib()

	LibList = '("tsmc18" "B" "C")

	when(LibSelect==nil   LibSelect=car(LibList) )

	case( LibSelect
  		("tsmc18"
		      MetalList = '("METAL1" "METAL2" "METAL3" "METAL4")
	       )   
	      ("B"
		      MetalList = '("M1" "M2" "M3" "M4")   
	      )  
  	      ("C"
		      MetalList = '("A1" "A2" "A3") 
	      )    
 	);case

	M1=car(MetalList)
	M2=cadr(MetalList) 
	M3=caddr(MetalList) 
	M4=cadddr(MetalList)

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(creation_path()

		PathList = enterPath( 
			             ?prompts
		                     list( "Enter the first point:"
                                           "Enter the next point:" )
                                     ?points LastPoint   ;the start point for the next path
                                     ;?doneProc "pathDone"
                                     ?wantPoints 2
                                     ?pathWidth float(Width) 
                                     ?pathStyle "VariableEnd"
                                     ?beginExtent float(Width_Ext)
                                     ?endExtent float(Width_Ext)
                                    )

		if( abs(caar(PathList)-caadr(PathList))>0.001 then
		      Layer = Layer_H
		      Width = Width_H
		      Width_Ext = Width_V/2
		      if( caar(PathList)-caadr(PathList) < -0.001 then
		         Direction_2Vias = "H_L"
		      else 
                         Direction_2Vias = "H_R"
         	      );if
                else
      		      Layer = Layer_V
                      Width = Width_V
                      Width_Ext = Width_H/2 
                      if( cadar(PathList)-cadadr(PathList) < -0.001 then
                          Direction_2Vias = "V_B"
                      else 
                          Direction_2Vias = "V_T"
                      );if      
                 );if        


		if( form_route->SameWidth->value == t  then
		    APath=dbCreatePath(CV Layer PathList Width "extendExtend")
		else
		    APath=dbCreatePath(CV Layer PathList Width "varExtendExtend")
		    APath~>beginExt = Width_Ext
		    APath~>endExt = Width_Ext
		 );if

		StartPoint = car(PathList)
		LastPoint = last(PathList)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(AddAVia(ViaCenter)
	
	printf(">>> %L \n" ViaCenter)

	x = car(ViaCenter)
	y = cadr(ViaCenter)

	case(Direction_2Vias
    	      ("H_L"
     		printf("A\n")
		angle = "R0"
		row = 2
		y = y + 0.26
              )
              ("H_R"
                printf("B\n")
		 printf("C\n")
		angle = "R0"
		row = 2
		y = y - 0.26
              ) 
              ("V_T"
                printf("C\n")
		angle = "R0"
		row = 2
		y = y - 0.26
              )     
              ("V_B"
                printf("D\n")
		angle = "R0"
		row = 2
		y = y + 0.26
              )
	)

	xy = list(x y)

	cv = geGetEditCellView() 
	angle = "R0"
	viaParams = list(list("cutRows" row) list("cutColumns" col)) 
	dbCreateVia(cv MasterCV xy angle viaParams) 
	
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(route()

   	        CV = geGetEditRep(hiGetCurrentWindow())

     	        leSetFormSnapMode("orthogonal")

	        when(LibSelect==nil || Layer_H==nil || Layer_V==nil || Width_H==nil || Width_V==nil
		      LibSelect = hiGetCurrentForm()->Library->value
		      Layer_H = hiGetCurrentForm()->MetalField_H->value
		      Layer_V = hiGetCurrentForm()->MetalField_V->value
		  
		      if(form_route->SameWidth->value == nil  then  
		          Width_H = hiGetCurrentForm()->MetalWidth_H->value
		          Width_V = hiGetCurrentForm()->MetalWidth_V->value
  		      else
		          Width_H = Width_V = hiGetCurrentForm()->Metal_Width->value
                      )
                )

	        LastPoint = '()
	        Width = Width_H
	        Width_Ext = Width_V/2
	
		row = 1
		col = 1

		via_techno = list("M2_M1" "M3_M2" "M4_M3")	
		cv = geGetEditCellView()
		tech = techGetTechFile(cv)
		viaParams = list(list("cutRows" row) list("cutColumns" col))
		;via1 = techFindViaDefByName(tech nth(0 via_techno) )
		;via2 = techFindViaDefByName(tech nth(1 via_techno) ) 

 		n=0
		declare(PathLayer[20])

		while( n<20
		      creation_path()
		      PathLayer[n] = APath~>layerName
		      ViaCenter = StartPoint

		      when( n > 0     
			    cond(
			         ((PathLayer[n]==M1&&PathLayer[n-1]==M2)||(PathLayer[n]==M2&&PathLayer[n-1]==M1) 
				   MasterCV = techFindViaDefByName(tech nth(0 via_techno) )
			           AddAVia(ViaCenter)
                                 )
    
		                 ((PathLayer[n]==M2&&PathLayer[n-1]==M3)||(PathLayer[n]==M3&&PathLayer[n-1]==M2)
				   MasterCV = techFindViaDefByName(tech nth(1 via_techno) )  	
			           AddAVia(ViaCenter)
			         )   
      				
				 ((PathLayer[n]==M4&&PathLayer[n-1]==M3)||(PathLayer[n]==M3&&PathLayer[n-1]==M4)
			           MasterCV = techFindViaDefByName(tech nth(2 via_techno) )  	
			           AddAVia(ViaCenter)
			         )  

 			         ((PathLayer[n]==M1&&PathLayer[n-1]==M3)||(PathLayer[n]==M3&&PathLayer[n-1]==M1)
			           MasterCV = techFindViaDefByName(tech nth(0 via_techno) )
			           AddAVia(ViaCenter) 
				   MasterCV = techFindViaDefByName(tech nth(1 via_techno) )  	
			           AddAVia(ViaCenter)
			         )

			         ((PathLayer[n]==M2&&PathLayer[n-1]==M4)||(PathLayer[n]==M4&&PathLayer[n-1]==M2)
			           MasterCV = techFindViaDefByName(tech nth(1 via_techno) )  	
			           AddAVia(ViaCenter) 
			           MasterCV = techFindViaDefByName(tech nth(2 via_techno) ) 
				   AddAVia(ViaCenter)
			         )                

			         ((PathLayer[n]==M1&&PathLayer[n-1]==M4)||(PathLayer[n]==M4&&PathLayer[n-1]==M1)
			           MasterCV = techFindViaDefByName(tech nth(0 via_techno) ) 
			           AddAVia(ViaCenter) 
				   MasterCV = techFindViaDefByName(tech nth(1 via_techno) ) 
			           AddAVia(ViaCenter)                
			           MasterCV = techFindViaDefByName(tech nth(2 via_techno) ) 
			           AddAVia(ViaCenter)                 
		                 )  
		      );cond
	     );when
	    n++    
	  );while        

	leSetFormSnapMode("diagonal")
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(SameWidthP()

  	if( form_route->SameWidth->value == t  then
       		form_route->Metal_Width->enabled = t
	        form_route->Metal_Width->editable = t
                form_route->MetalWidth_H->enabled = nil
                form_route->MetalWidth_H->editable = nil
                form_route->MetalWidth_V->enabled = nil  
                form_route->MetalWidth_V->editable = nil
        else
                form_route->Metal_Width->enabled = nil
                form_route->Metal_Width->editable = nil
                form_route->MetalWidth_H->enabled = t
                form_route->MetalWidth_H->editable = t
                form_route->MetalWidth_V->enabled = t  
                form_route->MetalWidth_V->editable = t 
        )

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(ChangeLib()

	LibSelect = form_route->Library->value
	InitLib()

	form_route->MetalField_H->choices = MetalList
	form_route->MetalField_H->value = M1
	form_route->MetalField_V->choices = MetalList
	form_route->MetalField_V->value = M2
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure(gui_route()
let((Library MetalField_H MetalField_V MetalWidth_H MetalWidth_V 
     Metal_Width MyLabel form_route SameWidth
     PathList Layer Width Width_Ext APath StartPoint LastPoint
     ViaOrigin Direction_2Vias LibList MetalList
     CV LibSelect PathLayer ViaCenter MasterCV Width_H Width_V Layer_H Layer_V
     M1 M2 M3 M4 
    )

		InitLib() 

		Library = hiCreateCyclicField(
                			      ?name   'Library
                			      ?prompt  "Library: "
                		              ?choices   LibList 
                                             ;?value   car(LibList)
                                              ?defValue   car(LibList)
                                              ?callback  "ChangeLib()" 
                                             )

		MetalField_H = hiCreateCyclicField(
                				   ?name      'MetalField_H
                				   ?prompt   "Horizontal Metal: "
				                   ?choices    MetalList
				                   ;?value     M1
                 				   ?defValue   M1
				                   ?callback  "Layer_H = MetalField_H->value"
                                                  )
		
		MetalField_V = hiCreateCyclicField(
		                		   ?name   'MetalField_V
				                   ?prompt "Vertical Metal: "
				                   ?choices   MetalList
				                   ;?value   M2
				                   ?defValue  M2
				                   ?callback  "Layer_V = MetalField_V->value"
                                                  )

		MetalWidth_H = hiCreateFloatField(
				                 ?name   'MetalWidth_H
				                 ?prompt "Horizontal Width: "
				                 ?range  '(0.001 1000)
				                 ;?value   1.0
				                 ?defValue   1.0
				                 ?enabled   nil
				                 ?editable   nil
				                 ?callback  "Width_H = MetalWidth_H->value"
				                )
		
		MetalWidth_V = hiCreateFloatField(
                				 ?name   'MetalWidth_V
                				 ?prompt  "Vertical Width: "
                				 ?range  '(0.001 1000)
                				 ;?value   1.0
                				 ?defValue   1.0
                				 ?enabled   nil
                				 ?editable   nil
                				 ?callback  "Width_V = MetalWidth_V->value"
                				)


		SameWidth = hiCreateBooleanButton(
				                ?name   'SameWidth
				                ?buttonText  "Same Width"
				                ;?value    t
				                ?defValue   t
				                ?buttonLocation 'right 
				                ?callback  "SameWidthP()"
				                )

		Metal_Width = hiCreateFloatField(
                				 ?name   'Metal_Width
				                 ?prompt  "Metal Width: "
				                 ?range  '(0.001 1000)
				                 ;?value  1.0
				                 ?defValue   1.0
				                 ?enabled   t
				                 ?editable  t
				                 ?callback  "Width_H = Width_V = Metal_Width->value "
                				)

		MyLabel = hiCreateLabel(
				         ?name   'MyLabelField
				         ?labelText  "Create by Moi"
				         ?justification  'right
				         ?enabled    nil
				         ?invisible   t
				       )


		form_route = hiCreateAppForm(
					      ?name 'form_route
					      ?formTitle "    Routing Advanced  "
					      ?callback "route()"
					      ?fields
     						 list(
						         list(Library       20:10    100:30   60    )
						         list(MetalField_H  20:50    180:30   110   )
						         list(MetalField_V  210:50   180:30   110   ) 
						         list(SameWidth     20:90   180:30   110   )
						         list(Metal_Width   210:90  180:30   110   )         
						         list(MetalWidth_H  20:130   180:30   110   )
						         list(MetalWidth_V  210:130  180:30   110   ) 
						         list(MyLabel       250:170  150:25    )
       						)
					      ?unmapAfterCB t
				) 

		hiDisplayForm( form_route )

	);let
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
hiSetBindKey("Layout" "F8" "gui_route()")