此代码并非原创,是根据Cadence Skill论坛的一份代码修改而来,主要功能是:
用户自己指定位号(需要BGA封装)和过孔,实现该位号的自动扇出功能(自动打孔 自动将过孔和焊盘连接),代码如下:
代码语言:javascript复制procedure(bga_fanout(RefDes)
logFile = "./bga_fanout_debug.log" ;LogFile Used for Debug
bga_fanout_version() ;Display the version
notdone = t
/*
bga_fanout_popup = axlUIPopupDefine(nil (list ;Define the menu
(list "Done" 'bga_fanout_done )
(list "Cancel" 'bga_fanout_cancel))
)
*/
;axlUIPopupSet(bga_fanout_popup) ;by lyn
while(notdone
bg_log = outfile(logFile)
fprintf(bg_log "======== Bga Fanout Debug Message ========n")
axlClearSelSet()
axlSetFindFilter(?enabled list("noall" "symbols") ?onButtons (list "noall" "symbols"))
;axlSingleSelectPoint();
;axlSelectByName("COMPONENT" "U187");自己选择位号
axlSelectByName("COMPONENT" RefDes);
SelBga = car(axlGetSelSet())
lowerLeftPin = nil
lowerRightPin = nil
upperLeftPin = nil
upperRightPin = nil
centerPoint = nil
beginPoint = nil
endPoint = nil
isBga = t
BgaSize = 0
when(length(SelBga->pins) < 6
isBga = nil
fprintf(bg_log "The Device isn't Bga!n")
);end when
when(SelBga && isBga
fprintf(bg_log "%sn" SelBga)
fprintf(bg_log "Symbol name: %snn" SelBga->name)
;fprintf(bg_log "lowerLeftPin: (%P)n" lowerLeftPin)
;fprintf(bg_log "upperRightPin: (%s)n" upperRightPin)
pin_definition = car(SelBga->pins)->definition->name
count_pin_name = 0
pin_name_index = 0
for(i 1 4
temp_pin = nth(i SelBga->pins)
when(temp_pin->isThrough == t
isBga = nil
);end when
if(pin_definition == temp_pin->definition->name
then
count_pin_name = count_pin_name 1
else
pin_name_index = i
);end if
);end for
fprintf(bg_log "count_pin_name %dn" count_pin_name)
fprintf(bg_log "pin_name_index %dn" pin_name_index)
fprintf(bg_log "pin_definition: %snn" pin_definition)
when(count_pin_name < 3
pin_definition = nth(pin_name_index SelBga->pins)->definition->name
);end if
fprintf(bg_log "pin_definition: %sn" pin_definition)
if(SelBga->isMirrored
then
pinLayer = "Etch/BOTTOM"
else
pinLayer = "Etch/TOP"
);end if
;Compute the Symbol wether is Bga and the centerPoint
foreach(bga_pin SelBga->pins
when(bga_pin->definition->name == pin_definition
;initialize then Coordinate
when(lowerLeftPin == nil
lowerLeftPin = bga_pin->xy
upperRightPin = bga_pin->xy
lowerRightPin = bga_pin->xy
upperLeftPin = bga_pin->xy
);end when
;fprintf(bg_log "Pin name: %sn" bga_pin->name)
;fprintf(bg_log "Pin's Net: %sn" bga_pin->net->name)
;fprintf(bg_log "Pin's Number: %sn" bga_pin->number)
;fprintf(bg_log "Pin's Coordinate: (%P)n" bga_pin->xy)
when(bga_pin->number == "C1"
beginPoint = bga_pin->xy
);end when
when(bga_pin->number == "C2"
endPoint = bga_pin->xy
);end when
when(xCoord(bga_pin->xy) <= xCoord(lowerLeftPin) && yCoord(bga_pin->xy) <= yCoord(lowerLeftPin)
lowerLeftPin = bga_pin->xy
)
when(xCoord(bga_pin->xy) >= xCoord(upperRightPin) && yCoord(bga_pin->xy) >= yCoord(upperRightPin)
upperRightPin = bga_pin->xy
)
when(xCoord(bga_pin->xy) >= xCoord(lowerRightPin) && yCoord(bga_pin->xy) <= yCoord(lowerRightPin)
lowerRightPin = bga_pin->xy
)
when(xCoord(bga_pin->xy) <= xCoord(upperLeftPin) && yCoord(bga_pin->xy) >= yCoord(upperLeftPin)
upperLeftPin = bga_pin->xy
)
;fprintf(bg_log "Pin's definition: %sn" bga_pin->definition->name)
;fprintf(bg_log "Pin's ID: %sn" bga_pin)
pinPadName = axlDBGetPad(bga_pin pinLayer "REGULAR")
;fprintf(bg_log "Pin's pad figure: %sn" pinPadName->figureName)
when(bga_pin->isThrough == t || pinPadName->figureName != "CIRCLE"
isBga = nil
axlUIWPrint(nil "- The Device isn't Bga!Please select again! -n")
);end when
fprintf(bg_log "n")
);end when
);end foreach
if(isBga
then
fprintf(bg_log "The Device is Bga!n")
when(xCoord(lowerLeftPin) > xCoord(upperLeftPin)
lowerLeftPin = xCoord(upperLeftPin):yCoord(lowerLeftPin)
);end when
when(yCoord(lowerLeftPin) > yCoord(lowerRightPin)
lowerLeftPin = xCoord(lowerLeftPin):yCoord(lowerRightPin)
);end when
when(xCoord(upperRightPin) < xCoord(lowerRightPin)
upperRightPin = xCoord(lowerRightPin):yCoord(upperRightPin)
);end when
when(yCoord(upperRightPin) < yCoord(upperLeftPin)
upperRightPin = xCoord(upperRightPin):yCoord(upperLeftPin)
);end when
fprintf(bg_log "lowerLeftPin: (%P)n" lowerLeftPin)
fprintf(bg_log "upperRightPin: (%P)n" upperRightPin)
fprintf(bg_log "lowerRightPin: (%P)n" lowerRightPin)
fprintf(bg_log "upperLeftPin: (%P)nn" upperLeftPin)
centerPoint = xCoord(upperRightPin)-(xCoord(upperRightPin)-xCoord(lowerLeftPin))/2:yCoord(upperRightPin)-(yCoord(upperRightPin)-yCoord(lowerLeftPin))/2
fprintf(bg_log "centerPoint: (%P)nn" centerPoint)
;Get Bga Size(Absolute value)
BgaSize = abs(xCoord(beginPoint) - xCoord(endPoint))/2
fprintf(bg_log "xCoord: %f %fn" xCoord(nth(6 SelBga->pins)->xy) xCoord(nth(7 SelBga->pins)->xy))
when(BgaSize == 0
BgaSize = abs(yCoord(beginPoint) - yCoord(endPoint))/2
fprintf(bg_log "yCoord: %f %fn" yCoord(nth(6 SelBga->pins)->xy) yCoord(nth(7 SelBga->pins)->xy))
fprintf(bg_log "selected Pin: (%P) (%P)nn" nth(6 SelBga->pins)->xy nth(7 SelBga->pins)->xy)
);end when
fprintf(bg_log "BgaSize is : %fn" BgaSize)
;Create Clines And Vias
;fanoutVia = car(axlUIDataBrowse('PADSTACK '(RETRIEVE_NAME) "Please Select A Via..." t)) ;Select the Via to Fanout
fanoutVia="Via8d16";需要自己指定过孔,可从焊盘库中查找
if(fanoutVia
then
/*
bga_pin = car(SelBga->pins)
when(bga_pin->definition->name == pin_definition && bga_pin->net->name != ""
lineWidth = 6;axlCNSDesignValueGet(bga_pin->net "MIN_LINE_WIDTH")
pinNet = bga_pin->net->name
fanout_dir(centerPoint bga_pin->xy)
linePath = list(bga_pin->xy xCoord(bga_pin->xy) x*BgaSize:yCoord(bga_pin->xy) y*BgaSize)
axlDBCreateLine(linePath lineWidth pinLayer pinNet)
axlDBCreateVia(fanoutVia cadr(linePath) pinNet)
axlUIWPrint(nil "Fanout NET "%s" At %P" pinNet bga_pin->xy)
);end when
*/
foreach(bga_pin SelBga->pins
when(bga_pin->definition->name == pin_definition && bga_pin->net->name != ""
lineWidth = 6;axlCNSDesignValueGet(bga_pin->net "MIN_LINE_WIDTH")
pinNet = bga_pin->net->name
fanout_dir(centerPoint bga_pin->xy)
linePath = list(bga_pin->xy xCoord(bga_pin->xy) x*BgaSize:yCoord(bga_pin->xy) y*BgaSize)
axlDBCreateLine(linePath lineWidth pinLayer pinNet)
axlDBCreateVia(fanoutVia cadr(linePath) pinNet)
axlUIWPrint(nil "Fanout NET "%s" At %P" pinNet bga_pin->xy)
);end when
);end foreach
axlUIWPrint(nil "- BGA Fanout Success! -")
notdone = nil
axlCancelEnterFun()
else
axlUIWPrint(nil "- BGA Fanout Failed! -")
notdone = nil
axlCancelEnterFun()
);end if
else
fprintf(bg_log "The Device isn't Bga!n")
)
);end when
axlDehighlightObject(SelBga)
close(bg_log)
;axlUIViewFileCreate(logFile "Bga Fanout Debug Message" nil)
);end while
);end procedure
procedure(fanout_dir(centerPoint CurrentPoint)
if(xCoord(centerPoint) >= xCoord(CurrentPoint)
then
x = -1
else
x = 1
);end if
if(yCoord(centerPoint) >= yCoord(CurrentPoint)
then
y = -1
else
y = 1
);end if
);end procedure
procedure(bga_fanout_done()
axlUIWPrint(nil "- Done -")
notdone = nil
axlCancelEnterFun()
)
;Cancel Command
procedure(bga_fanout_cancel()
axlUIWPrint(nil "- Cancel -")
notdone = nil
axlCancelEnterFun()
)
procedure(bga_fanout_version()
axlUIWPrint(nil "------ Bga Fanout V1.0 ---- Written By VivienLuo ------")
axlUIWPrint(nil "------ E-mail : admin@allegro-skill.com ------ Mar 16, 2013 ------")
);End Procedure
注意3点:
1. fanoutVia="Via8d16";需要自己指定过孔,可从焊盘库中查找
2. lineWidth = 6,此步指定焊盘到过孔的Cline的线宽,可由用户自己指定
3. 代码最后是原作者的信息。
代码的用法如下:
1. Notepad新建*.il文件,并将上述代码复制到此文件中,保存即可。
2. Allegro命令行中执行:skill load("*.il的完整路径")
3. Allegro命令行中输入:skill,则切换到skill窗口,并执行bga_fanout("U187"),U187需用户自己选择,回车等待执行完毕即可完成自动扇出。
因为一个单板需要自动扇出的IC并不多,自己指定位号可能对用户来说更加方便。