📄 hyperlynx-4_11.ulp
字号:
#usage "* Exports the board to HyperLynx Signal-Integrity Transfer Format (.HYP)\n"
"* \n"
"* HyprLynx.ULP Written by Frank Hoffman of LLOYD I/O INC\n"
"* Copyright (c) 1997, All Rights Reserved by LLOYD I/O INC\n"
"* 503/222-0702 frankh@lloydio.com www.lloydio.com\n"
"* \n"
"* 1 sided boards use layer 16\n"
"* 2 sided boards use layers 1 and 16\n"
"* 4 layer boards use layers 1,2 and 15, 16\n"
"* 6 layer boards use layers 1,2,3 and 14,15,16\n"
"* 8 layer boards use layers 1,2,3,4 and 13,14,15,16\n"
"* 10 layer boards use layers 1,2,3,4,5 and 12,13,14,15,16\n"
"* 12 layer boards use layers 1,2,3,4,5,6 and 11,12,13,14,15,16\n"
"* 14 layer boards use layers 1,2,3,4,5,6,7 and 10,11,12,13,14,15,16\n"
"* 16 layer boards use layers 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16\n"
"* \n"
"* Adapted for Eagle-Version 4.1 \n"
"* - Unrouted layer not exported\n"
"* - Export also Wire-Arcs\n"
"* - SMD shape Roundnes is included\n"
"* - PAD shape LONG OFFSET (Oblong) is included\n"
"* - PAD accept Top, Bottom and Inner (MDEF) layer\n"
"* - VIA generate only used layer in stack\n"
"* 02.04.2004 alf@cadsoft.de\n"
"* - W.curve correction in C.element.package.wires(W)\n"
"* 21.04.2005 alf@cadsoft.de\n"
"* \n";
string Version = "Version 2.00 9/11/97 -- 4.11 21/04/2005";
// Version 4.11 : W.curve correction in C.element.package.wires(W) 21.04.2005
//***********************************************
// Definitions of yes and no! Do not modify!
char yes = 1; // yes must be different from no.
char no = 0; // no must be zero (0)
//********************************************************************************************
//********************************************************************************************
//********************************************************************************************
// USER MODIFYABLE DATA
// Generate Files Options:
char GenerateReferenceFile = yes; // Generate the Reference File ('yes'/'no')
char GenerateHyperlynxFile = yes; // Generate the Hyperlynx File ('yes'/'no')
// Generate Component Types Options:
char UseComponentTypes = yes; // Devices Q, T, U, IC, C, D, L, R, BD, etc. ('yes'/'no')
// Generate Component Pin Direction Options:
char GeneratePinDirection = no; // If 'yes', slows down many many times.
// Component Value Change Options:
char TruncateComponentValues = no; // Truncate ".1uf 50v" to ".1uf" ('yes'/'no')
char ConvertCapValues = yes; // Convert Capacitor Values. i.e. change ".1" to ".1u" ('yes'/'no')
string ConvertLT1to = "uF"; // values less than 1 are labeled as this unit
string ConvertGE1to = "uF"; // convert greater than or equal to 1 are labeled as this unit
// Board Thickness AND Stack Up Options:
char UseBoardStackUp = yes; // Use board thickness data ('yes'/'no')
real board_thickness = 0.0625; // Board Thickness, if 0: use fixed layer sizes else calc layer thicknesses
// Copper Value Options:
real zerooz = 0.0000; // zero copper thickness
real halfoz = 0.0007; // 0.5 oz copper thickness
real oneoz = 0.0014; // 1.0 oz copper thickness
real twooz = 0.0028; // 2.0 oz copper thickness
// Copper Layer Thickness for Each Layer of Copper
real copper_thickness[] = {0.0, halfoz,halfoz,halfoz,halfoz,halfoz,halfoz,
halfoz,halfoz,halfoz,halfoz,halfoz,halfoz,
halfoz,halfoz,halfoz,halfoz}; // 1st number is not used (no layer 0)
// Copper Layer Plating Thickness for Each Layer of Copper.
// Top and Bottom are used most often.
real copper_plating[] = {0.0, halfoz,zerooz,zerooz,zerooz,zerooz,zerooz,
zerooz,zerooz,zerooz,zerooz,zerooz,zerooz,
zerooz,zerooz,zerooz,halfoz}; // 1st number is not used (no layer 0)
// Dielectric Value Options:
real dicons = 4.8; // default dielectric constant
real dit1ly = 0.0611; // dielectric thickness for 1 sided board
real dit2ly = 0.0597; // dielectric thickness for 2 sided board
real ditmly = 0.0200; // dielectric thickness for multilayered boards
real dielectric_constant[] = { dicons,dicons,dicons,dicons,dicons,dicons,dicons,dicons,dicons};
real dielectric_thickness[] = { dit1ly,dit2ly,ditmly,ditmly,ditmly,ditmly,ditmly,ditmly,ditmly};
// Special Wire Width Options:
real RectOutlineWireWidth = 0.001; // Rectangle outline wire width in inches
real HoleOutlineWireWidth = 0.001; // Holes outline wire width in inches
// Precision of board components to accurately draw and locate.
// (After the decimal '.' point.)
int precision_of_perimeter = 4; // board perimeter dimension precision
int precision_of_layers = 5; // layer thickness precision
int precision_of_pads = 3; // pad/smd size precision
int precision_of_nets = 4; // pin/via/segment/width precision
//********************************************************************************************
//********************************************************************************************
//********************************************************************************************
// DO NOT MODIFY ANYTHING BELOW THIS LINE //
int index[]; // sorting index array (indirect)
// pad info
int ISAPAD = 0; // through hole pad
int ISASMD = 1; // surface mount device pad
int ISAVIA = 18; //
// *** HyperLynx pad shapes ***
int OVALROUND = 0; // '0' means oval or round (pad_sx=pad_sy if round)
int RECTSQUARE = 1; // '1' means rectangular or square (pad_sx=pad_sy if square)
int OBLONG = 2; // '2' means oblong (oblong shape is a rectangular with rounded corners)
string PadShapes[]; // list of hyp's pad shapes
string HypPadShapes[]; // list of hyp's pad shapes
string EaglePadShapes[]; // list of eagle pad shapes
int Total_Pads = -1; // total pads
int pad_type[]; // pad types (ISAPAD,ISASMD)
int pad_layer[]; // 0 = Pad, 1 or 16 = SMD, 18 = Via
int pad_shape_Top_rnds[]; // hyperlynx type OVALROUND, RECTSQUARE, OBLONG
int pad_shape_Inner[]; // hyperlynx type OVALROUND, RECTSQUARE, OBLONG
int pad_shape_Bott[]; // hyperlynx type OVALROUND, RECTSQUARE, OBLONG
real pad_angle_end[]; // Pad rotation or Via End layer (Vias can not rotate!)
int pad_diameter_Top_or_dx[];
int pad_diameter_Inner[];
int pad_diameter_Bott[];
int pad_dy_elong_start[]; // SMD-dy, Pad-Eleongation, Via Stack-Start
int pad_drill[];
string padStackList = "#\ttype\tlayer\tTop_rnd\tInner\tBott\tang_end\tdx_T\tdx_I\tdx_B\tdy_el\tdril\n";
// copper layer info
string LayerNames[]; // layer names
int copp_lookup[] = {0, 1,16, 2,15, 3,14, 4,13, 5,12, 6,11, 7,10, 8,9 };
int copp_used_layer[];
int Total_Layers; // total number of used layers
int layer_counter; // layer counter
real Total_Board_Thickness; // calculated total board thickness
/* ----- Eagle HELP --------------------------------
PAD_SHAPE_SQUARE square
PAD_SHAPE_ROUND round
PAD_SHAPE_OCTAGON octagon
PAD_SHAPE_LONG long
PAD_SHAPE_OFFSET offset
PAD_SHAPE_ANNULUS annulus (only in Supply-Layer)
PAD_SHAPE_THERMAL thermal (only in Supply-Layer)
-------------------------------------------------- */
// define the HyperLynx Pad Shapes
PadShapes[ PAD_SHAPE_SQUARE ] = "1"; // hyp's square and rectangle shape
HypPadShapes[ PAD_SHAPE_SQUARE ] = "Square"; // HyperLynx's square and rectangle shape
EaglePadShapes[ PAD_SHAPE_SQUARE ] = "Square"; // Eagle's square and rectangle shape
PadShapes[ PAD_SHAPE_ROUND ] = "0"; // hyp's round and oval shape
HypPadShapes[ PAD_SHAPE_ROUND ] = "Round"; // HyperLynx's round and oval shape
EaglePadShapes[ PAD_SHAPE_ROUND ] = "Round"; // Eagle's round and oval shape
PadShapes[ PAD_SHAPE_OCTAGON ] = "0"; // hyp's octagon is a round shape
HypPadShapes[ PAD_SHAPE_OCTAGON ] = "Round"; // HyperLynx's octagon is a round shape
EaglePadShapes[ PAD_SHAPE_OCTAGON ] = "Octagon"; // Eagle's octagon is a round shape
PadShapes[ PAD_SHAPE_LONG ] = "2"; // hyp's oblong, rectangle with rounded corners
HypPadShapes[ PAD_SHAPE_LONG ] = "Oblong"; // HyperLynx's oblong, rectangle with rounded corners
EaglePadShapes[ PAD_SHAPE_LONG ] = "Long"; // Eagle's oblong, rectangle with rounded corners
PadShapes[ PAD_SHAPE_OFFSET ] = "0"; // hyp's round and oval shape
HypPadShapes[ PAD_SHAPE_OFFSET ] = "Round"; // HyperLynx's oblong, rectangle with rounded corners
EaglePadShapes[ PAD_SHAPE_OFFSET ] = "Offset"; // Eagle's (Long) Offset, rectangle with rounded corners
// ***************************************************************************
// layers
// This routine counts visible layers and stores the name in an internal table
// Layer names beginning with '$' have the leading '$' striped.
// This routine is called from a loop
void CountLayers(UL_LAYER L) {
if ( ( L.number >= 1 ) && ( L.number <= 16 ) ) {
if ( strchr( L.name, '$' ) == 0 ) {
LayerNames[L.number] = strsub( L.name, 1 );
}
else {
LayerNames[L.number] = L.name;
}
if (L.visible) {
layer_counter++;
if (L.used) copp_used_layer[L.number] = 1;
}
}
}
// This routine writes out the layer names as signal layers or power planes
// It also writes out the dielectric layer info when needed
// This routine is called from a loop
string layernam; // layer name buffer
void PrintLayer(UL_LAYER L) {
real diele_thickness; // calculated dielectric thickness
real copp_thickness; // calculated total copper thickness
int i; // loop counter
if (L.visible) {
if ( L.number >= 1 && L.number <= 16 ) {
if ( strchr( L.name, '$' ) == 0 ) { // ** is it a Power plane?
layernam = strsub( L.name, 1 );
printf("(PLANE T=%6.*f L=%s)\n",
precision_of_layers, copper_thickness[L.number], layernam);
}
else {
printf("(SIGNAL T=%6.*f P=%6.*f L=%s)\n",
precision_of_layers, copper_thickness[L.number],
precision_of_layers, copper_plating[L.number],
L.name);
}
layer_counter++;
if (board_thickness) {
Total_Board_Thickness = board_thickness;
copp_thickness = 0.0;
for (int i = 1; i <= Total_Layers; i++ ) {
copp_thickness += copper_thickness[copp_lookup[i]] + copper_plating[copp_lookup[i]];
}
if (Total_Layers <= 2 ) diele_thickness = ( board_thickness - copp_thickness );
else diele_thickness = ( board_thickness - copp_thickness ) / ( real(Total_Layers) - 1.00 );
}
else {
diele_thickness = dielectric_thickness[Total_Layers/2];
copp_thickness = 0.0;
for (int i = 1; i <= Total_Layers; i++ ) {
copp_thickness += copper_thickness[copp_lookup[i]] + copper_plating[copp_lookup[i]];
}
if (Total_Layers <= 2 ) Total_Board_Thickness = copp_thickness + diele_thickness;
else Total_Board_Thickness = copp_thickness + (diele_thickness * ( real(Total_Layers) - 1.00 ));
}
if (layer_counter < Total_Layers) {
printf("(DIELECTRIC T=%6.*f C=%4.*f ",
precision_of_layers,diele_thickness,
precision_of_layers,dielectric_constant[Total_Layers/2]);
printf("L=DL%02d)\n",layer_counter);
}
if (Total_Layers == 1) {
printf("(DIELECTRIC T=%6.*f C=%4.*f ",
precision_of_layers,diele_thickness,
precision_of_layers,dielectric_constant[Total_Layers/2]);
printf("L=DL%02d)\n",layer_counter);
}
}
}
}
// ***************************************************************************
// pads
int search_A_Pad( int apad_type, int apad_layer,
int apad_shape_Top_rnds, int apad_shape_Inner, int apad_shape_Bott,
real apad_angle_end,
int apad_dx_Top, int apad_dx_Inner, int apad_dx_Bott,
int apad_dy_elong_start,
int apad_dril ) {
int found = -1;
for ( int i = 0; i <= Total_Pads; i++ ) {
if ( pad_type[i] == apad_type &&
pad_layer[i] == apad_layer &&
pad_shape_Top_rnds[i] == apad_shape_Top_rnds &&
pad_shape_Inner[i] == apad_shape_Inner &&
pad_shape_Bott[i] == apad_shape_Bott &&
pad_angle_end[i] == apad_angle_end &&
pad_diameter_Top_or_dx[i] == apad_dx_Top &&
pad_diameter_Inner[i] == apad_dx_Inner &&
pad_diameter_Bott[i] == apad_dx_Bott &&
pad_dy_elong_start[i] == apad_dy_elong_start&&
pad_drill[i] == apad_dril )
{
found = i;
break;
}
}
return( found);
}
// This routine inserts a pad of known type and size into the pad table
// The returned value reflects the current number of pads in the table
// If the pad size already exists, the pad is not inserted
void Insert_A_Pad( int apad_type, int apad_layer,
int apad_shape_Top_rnds, int apad_shape_Inner, int apad_shape_Bott,
real apad_angle_end,
int apad_dx_Top, int apad_dx_Inner, int apad_dx_Bott,
int apad_dy_elong_start,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -