;================================================================================ ; Robert Johnstone ; Simon Fraser University ; ; Last Modified: 2000/11/29 ; ; Copyright 2000,2001,2002 Robert W. Johnstone ;-------------------------------------------------------------------------------- ; 2002/02/21 ; - modified code to use poly and anchor variables ; - layers are no longer hard coded ; - create spring_spiral_2 ; - fixed bug in rotor_width parameter ; 2000/11/29 ; - creation date if( (!boundp( 'admLibraryName )) then warn( "Setting the destination library to default value of ADM" ) admLibraryName = "ADM" ) pcDefinePCell( list( ddGetObj(admLibraryName) "spring_spiral" "layout" ) ; end of list for first argument ( ( inner_radius 15.0 ) ( outer_radius 50.0 ) ( shaft_radius 10.0 ) ( rotor_radius 55.0 ) ( rotor_width 0.0 ) ( turns 0.5 ) ( include_poly0 "boolean" nil ) ) ; end of parameter list prog( ; declare variables ( pcTechFile p0p_enclosure p_minSpacing p_minWidth p_nomWidth p1_enclosure a_nomWidth poly anchor x y x1 x2 x3 x4 y1 y2 y3 y4 count theta r tmp dx dy poly_a1 poly_a2 poly_b1 poly_b2 ) ; save layer names poly = "POLY1" anchor = "ANCHOR1" ; load tech file rules pcTechFile = techGetTechFile( pcCellView ) p0p_enclosure = techGetOrderedSpacingRule( pcTechFile "minEnclosure" "POLY0" poly ) if( (p0p_enclosure==nil) then warn(strcat( "minEnclosure rule for POLY0->" poly " not set") ) ) p_minSpacing = techGetSpacingRule( pcTechFile "minSpacing" poly ) if( (p_minSpacing==nil) then warn(strcat( "minSpacing rule for " poly " not set") ) ) p_minWidth = techGetSpacingRule( pcTechFile "minWidth" poly ) if( (p_minWidth==nil) then warn(strcat( "minWidth rule for " poly " not set") ) ) p_nomWidth = techGetSpacingRule( pcTechFile "nomWidth" poly ) if( (p_nomWidth==nil) then warn(strcat( "nomWidth rule for " poly " not set") ) ) p1_enclosure = techGetOrderedSpacingRule( pcTechFile "minEnclosure" poly anchor ) if( (p1_enclosure==nil) then warn(strcat( "minEnclosure rule for " poly "->" anchor " not set") ) ) a_nomWidth = techGetSpacingRule( pcTechFile "nomWidth" anchor ) if( (a_nomWidth==nil) then warn(strcat( "nomWidth rule for " anchor " not set") ) ) ; check parameters shaft_radius = if( (shaft_radiuscount) tmp count ) poly_a1 = list() poly_a2 = list() poly_b1 = list() poly_b2 = list() for( lp 0 count theta = lp * 3.141592654 * turns * 2 / count r = inner_radius + (outer_radius-inner_radius)*lp/count x = r * cos(theta) y = r * sin(theta) tmp = (outer_radius-inner_radius)/count dx = ( (r+tmp)*cos(theta+3.141592654*turns*2/count) - (r-tmp)*cos(theta-3.141592654*turns*2/count) ) * 0.5 dy = ( (r+tmp)*sin(theta+3.141592654*turns*2/count) - (r-tmp)*sin(theta-3.141592654*turns*2/count) ) * 0.5 theta = cond( ( (dx<0) atan(dy/dx)+3.141592654 ) ( (dx>0) atan(dy/dx) ) ( t if( (y<0) -3.141592654/2 3.141592654/2 ) ) ) theta = theta - 3.141592654 / 2 dx = rotor_width * 0.5 * cos(theta) dy = rotor_width * 0.5 * sin(theta) poly_a1 = cons( x+dx:y+dy poly_a1 ) poly_a2 = cons( x-dx:y-dy poly_a2 ) poly_b1 = cons( -x-dx:-y-dy poly_b1 ) poly_b2 = cons( -x+dx:-y+dy poly_b2 ) ) dbCreatePolygon( pcCellView poly append( reverse(poly_a2) poly_a1 ) ) dbCreatePolygon( pcCellView poly append( reverse(poly_b2) poly_b1 ) ) else dbCreateRect( pcCellView poly list( inner_radius:-p_minWidth*0.5 outer_radius:p_minWidth*0.5 ) ) dbCreateRect( pcCellView poly list( -inner_radius:-p_minWidth*0.5 -outer_radius:p_minWidth*0.5 ) ) ) ; create rotors theta = turns * 3.141592654 * 2 x1 = ( outer_radius - p_minWidth * 0.5 ) * cos(theta) - ( -rotor_width*0.5 ) * sin(theta) y1 = ( outer_radius - p_minWidth * 0.5 ) * sin(theta) + ( -rotor_width*0.5 ) * cos(theta) x2 = rotor_radius * cos(theta) - ( -rotor_width*0.5 ) * sin(theta) y2 = rotor_radius * sin(theta) + ( -rotor_width*0.5 ) * cos(theta) x3 = rotor_radius * cos(theta) - ( rotor_width*0.5 ) * sin(theta) y3 = rotor_radius * sin(theta) + ( rotor_width*0.5 ) * cos(theta) x4 = ( outer_radius - p_minWidth * 0.5 ) * cos(theta) - ( rotor_width*0.5 ) * sin(theta) y4 = ( outer_radius - p_minWidth * 0.5 ) * sin(theta) + ( rotor_width*0.5) * cos(theta) dbCreatePolygon( pcCellView poly list( x1:y1 x2:y2 x3:y3 x4:y4 ) ) dbCreatePolygon( pcCellView poly list( -x1:-y1 -x2:-y2 -x3:-y3 -x4:-y4 ) ) ; create poly0 ground plane if requested if( (include_poly0==t) then tmp = rotor_radius + p0p_enclosure*1.1 dbCreateEllipse( pcCellView "POLY0" list( -tmp:-tmp tmp:tmp ) ) ) ; Create the instNamePrefix property dbReplaceProp( pcCellView "instNamePrefix" "string" "spring" ) ; set version string dbReplaceProp( pcCellView "version" "string" "1.1.1" ) ; body SKILL code returns value t return(t) ) ; end of body-of-SKILL-code prog ) ; ; end of pcDefinePCell