;================================================================================ ; Robert Johnstone ; Simon Fraser University ; ; Last Modified: 2000/10/14 ; ; Copyright 2000 Robert W. Johnstone ;-------------------------------------------------------------------------------- unless( boundp( 'admLibraryName ) warn( "Setting the destination library to default value of ADM" ) admLibraryName = "ADM" ) pcDefinePCell( list( ddGetObj(admLibraryName) "gear" "layout" ) ; end of list for first argument ( ( radius 40.0 ) ( tooth_height 8.0 ) ( tooth_width_o 4.0 ) ( tooth_width_i 6.0 ) ( tooth_count 16 ) ( tooth_angle 0.0 ) ( include_poly0 "boolean" nil ) ) ; end of parameter list prog( ; declare variables ( pcTechFile p0p1_enclosure p1_minSpacing p1_maxWidth p1_minWidth p1a1_enclosure p1p2_enclosure p1d_enclosure p1v_enclosure a1_nomWidth p2_nomWidth p2p1_minOverlap d_nomWidth d_maxSpacing v_nomWidth h1_nomWidth h2_nomWidth h2h1_enclosure x1 x2 x3 x4 y1 y2 y3 y4 theta hub_o hub_i radius_d radius_p2 count_r count_t count_d tmp tmp1 tmp2 ) ; match radius definition to bearing definition, whose code is used radius = radius - tooth_height * 0.5 ; load tech file rules pcTechFile = techGetTechFile( pcCellView ) p0p1_enclosure = techGetOrderedSpacingRule( pcTechFile "minEnclosure" "POLY0" "POLY1" ) unless( p0p1_enclosure warn("minEnclosure rule for POLY0->POLY1 not set") ) p1_minSpacing = techGetSpacingRule( pcTechFile "minSpacing" "POLY1" ) unless( p1_minSpacing warn("minSpacing rule for POLY1 not set") ) p1_maxWidth = techGetSpacingRule( pcTechFile "maxWidth" "POLY1" ) unless( p1_maxWidth warn("maxWidth rule for POLY1 not set") ) p1_minWidth = techGetSpacingRule( pcTechFile "minWidth" "POLY1" ) unless( p1_minWidth warn("minWidth rule for POLY1 not set") ) p1a1_enclosure = techGetOrderedSpacingRule( pcTechFile "minEnclosure" "POLY1" "ANCHOR1" ) unless( p1a1_enclosure warn("minEnclosure rule for POLY1->ANCHOR1 not set") ) p1p2_enclosure = techGetOrderedSpacingRule( pcTechFile "minEnclosure" "POLY1" "POLY2" ) unless( p1p2_enclosure warn("minEnclosure rule for POLY1->POLY2 not set") ) p1d_enclosure = techGetOrderedSpacingRule( pcTechFile "minEnclosure" "POLY1" "DIMPLE" ) unless( p1d_enclosure warn("minEnclosure rule for POLY1->DIMPLE not set") ) p1v_enclosure = techGetOrderedSpacingRule( pcTechFile "minEnclosure" "POLY1" "P1P2VIA" ) unless( p1v_enclosure warn("minEnclosure rule for POLY1->P1P2VIA not set") ) a1_nomWidth = techGetSpacingRule( pcTechFile "nomWidth" "ANCHOR1" ) unless( a1_nomWidth warn("nomWidth rule for ANCHOR1 not set") ) p2_nomWidth = techGetSpacingRule( pcTechFile "nomWidth" "POLY2" ) unless( p2_nomWidth warn("nomWidth rule for POLY2 not set") ) p2p1_minOverlap = techGetOrderedSpacingRule( pcTechFile "minOverlap" "POLY2" "POLY1" ) unless( p2p1_minOverlap warn("minOverlap rule for POLY2->POLY1 not set") ) d_maxSpacing = techGetSpacingRule( pcTechFile "maxSpacing" "DIMPLE" ) unless( d_maxSpacing warn("maxSpacing rule for DIMPLE not set") ) d_nomWidth = techGetSpacingRule( pcTechFile "nomWidth" "DIMPLE" ) unless( d_nomWidth warn("nomWidth rule for DIMPLE not set") ) v_nomWidth = techGetSpacingRule( pcTechFile "nomWidth" "P1P2VIA" ) unless( v_nomWidth warn("nomWidth rule for P1P2VIA not set") ) h1_nomWidth = techGetSpacingRule( pcTechFile "nomWidth" "HOLE1" ) unless( h1_nomWidth warn("nomWidth rule for HOLE1 not set") ) h2_nomWidth = techGetSpacingRule( pcTechFile "nomWidth" "HOLE2" ) unless( h2_nomWidth warn("nomWidth rule for HOLE2 not set") ) h2h1_enclosure = techGetOrderedSpacingRule( pcTechFile "minEnclosure" "HOLE2" "HOLE1" ) unless( h2h1_enclosure warn("minEnclosure rule for HOLE2->HOLE1 not set") ) ; precalculations p1d_enclosure = p1d_enclosure + 0.207 * d_nomWidth hub_i = if( (a1_nomWidth+p1a1_enclosure > v_nomWidth+p1v_enclosure ) (a1_nomWidth+p1a1_enclosure)*1.1 (v_nomWidth+p1v_enclosure)*1.1 ) hub_o = hub_i + p1_minSpacing * 1.1 ; check parameters d_nomWidth = d_nomWidth + 0.01 ; to reduce spurious DRC errors tmp = hub_o+p2_nomWidth+p1d_enclosure+d_nomWidth*1.4 radius = if( (radius0) then tmp1 = tmp1 + h1_nomWidth*0.5 + h2h1_enclosure ) tmp1 = tmp1 + p2p1_minOverlap + h2_nomWidth*0.5 count_t = floor( 6.283185307*tmp1 / d_maxSpacing ) count_t = if( (count_t<2) 2 count_t ) ;count_t = if( (count_t<4) 4 count_t ) ;count_t = count_t + mod( count_t 2 ) for( lp2 0 count_t-1 theta = 6.283185307 * lp2 / count_t x1 = tmp1 * cos( theta ) y1 = tmp1 * sin( theta ) dbCreateRect( pcCellView "DIMPLE" list( x1-d_nomWidth*0.5:y1-d_nomWidth*0.5 x1+d_nomWidth*0.5:y1+d_nomWidth*0.5 ) ) dbCreateRect( pcCellView "HOLE2" list( x1-h2_nomWidth*0.5:y1-h2_nomWidth*0.5 x1+h2_nomWidth*0.5:y1+h2_nomWidth*0.5 ) ) ) ) ; add teeth tooth_count = if( (tooth_count<4) 4 tooth_count ) for( lp 0 (tooth_count-1) theta = lp * 2 * 3.141592654 / tooth_count + tooth_angle * 3.141592654 / 180 x1 = ( tooth_width_o*0.5 ) * cos(theta) - ( radius + tooth_height ) * sin(theta) y1 = ( tooth_width_o*0.5 ) * sin(theta) + ( radius + tooth_height ) * cos(theta) x2 = ( -tooth_width_o*0.5 ) * cos(theta) - ( radius + tooth_height ) * sin(theta) y2 = ( -tooth_width_o*0.5 ) * sin(theta) + ( radius + tooth_height ) * cos(theta) x3 = ( -tooth_width_i*0.5 ) * cos(theta) - ( radius - 1 ) * sin(theta) y3 = ( -tooth_width_i*0.5 ) * sin(theta) + ( radius - 1 ) * cos(theta) x4 = ( tooth_width_i*0.5 ) * cos(theta) - ( radius - 1 ) * sin(theta) y4 = ( tooth_width_i*0.5 ) * sin(theta) + ( radius - 1) * cos(theta) dbCreatePolygon( pcCellView "POLY1" list( x1:y1 x2:y2 x3:y3 x4:y4 ) ) ) ; Create the instNamePrefix property dbReplaceProp( pcCellView "instNamePrefix" "string" "gear" ) ; set version string dbReplaceProp( pcCellView "version" "string" "1.6.1" ) ; body SKILL code returns value t return(t) ) ; end of body-of-SKILL-code prog ) ; ; end of pcDefinePCell