📄 netlength.il
字号:
found=nil
foreach(onech ch
fprintf(b "onech->objType is %s\n" onech->objType)
if(equal(onech->objType "via") then
fprintf(b "a via is found\n")
ch=remd(onech ch)
);endif "via"
if(equal(onech->objType "tee") then
fprintf(b "a tee is found\n")
loc=onech->xy
fprintf(b "tee loc=%L \n" loc)
if(equal(loc check) then
prev_tee=t
found=t
conns=append1(conns onech)
ch=remd(onech ch)
oncethrough=nil
);end if
);endif "tee"
if(equal(onech->objType "shape") then
fprintf(b "a shape is found\n")
ch=remd(onech ch)
);end if "shape"
if(equal(onech->objType "path") then
fprintf(b "a path is found\n")
;need to check if the start or end location
;of this path is equal to "check" (check=
;location of last path/pin included in measurement)
;if true, add the cline length (check for
;radius and find the true length).
xcheck=car(check)
ycheck=cadr(check)
vfound=nil
;look for via at the "check" location
axlClearSelSet()
axlSetFindFilter(?enabled (list "noall" "VIAS" "invisible")
?onButtons (list "noall" "VIAS"))
axlOpenFindFilter()
axlSingleSelectPoint(xcheck:ycheck)
vfound=axlGetSelSet() ;via found
fprintf(b "onch->layer=%s\n" onech->layer)
;if either it's first time going through the loop (which means it's starting from a
;pin), or a via was found at the location (ie. last location was a path as well),
;or previous selection was a pin and it was either on same layer or a pinthrough
;component, then check if this path starts at the same location as checkpoint.
if((firsttime==t || vfound!=nil || (prev_tee=t && equal(l onech->layer)) || (prev_path==nil && (equal(l onech->layer) || pinthrough==t) )) then
;if before it was a pin or a via is found at current locations
segs=onech->segments
addit=nil
lastseg=car(last(segs))
firstseg=car(segs)
start_firstseg=car(firstseg->startEnd)
end_firstseg=cadr(firstseg->startEnd)
start_lastseg=car(lastseg->startEnd)
end_lastseg=cadr(lastseg->startEnd)
fprintf(b "end_lastseg=%L start_firstseg=%L\n" end_lastseg start_firstseg)
fprintf(b "lens=%L\n" lens)
if(equal(end_lastseg check) then
fprintf(b "end_lastseg=%L is equal to check=%L\n" end_lastseg check)
addit=t
check=start_firstseg
else
if(equal(start_firstseg check) then
fprintf(b "start_firstseg=%L is equal to check=%L\n" start_firstseg check)
addit=t
check=end_lastseg
);endif
);endif
if(addit then
fprintf(b "addit is true\n")
dist=0
firsttime=nil
prev_pin=nil
prev_tee=nil
oncethrough=nil
conns=append1(conns onech) ;the list of connections that we have
;included just now.
ch=remd(onech ch)
found=t ;keeps track whether a path has been found when
;backtracking the step
foreach(oneseg segs
x1 = xCoord(car(oneseg->startEnd))
x2 = xCoord(cadr(oneseg->startEnd))
y1 = yCoord(car(oneseg->startEnd))
y2 = yCoord(cadr(oneseg->startEnd))
deltax=abs(x2-x1)
deltay=abs(y2-y1)
rad=oneseg->radius
len=sqrt((deltax*deltax)+(deltay*deltay))
;if radius is not nil, then it's an arc and need to calculate
;the length for the arc.
if(rad!=nil then
rad_sq=rad*rad
len_sq=len*len
cos_theta=(2*rad_sq-len_sq)/(2*rad_sq)
theta=acos(cos_theta)
len=theta*rad
);endif(rad!=nil
dist=dist+len
);end foreach(oneseg segs
line=sprintf(line "%s %f\t" line dist)
final_dist=final_dist+dist
l=(onech->layer)
line=strcat(line l " \n")
lens=append1(lens dist)
lens=append1(lens l)
lays=cons(l lays)
fprintf(b "dist=%s found for one of the paths\n" line)
fprintf(b "elements in lens are %L\n" lens)
prev_path=t
);endif(addit
);endif(vfound!=nil
);endif "path"
if(equal((onech->objType) "pin") then
;check if the centre of this pin is at "check"
;if it is, then check if the pin is a discrete
; if it is, then get the net on the other end
; of the pin.if it's not a power pin then add
; its length and continue that until find
; a receiver
centrepin=(onech->xy)
if((prev_pin==nil && equal(centrepin check)) then
prev_path=nil
prev_pin=t
prev_tee=nil
pinthrough=onech->isThrough
ch=remd(onech ch)
comp=onech->component
compClass=comp->class
num=onech->number
ref=comp->name
;if this pin is on one of the drivers then we
;don't need to find the distance from this pin again
;because it's already being accounted for.
if(exists(x seldri x==ref) then
remvpins=append1(remvpins onech)
);end if
oncethrough=nil
line=strcat(line "\t\t\t\t" ref "." num)
;fprintf(filename line)
if(equal(compClass "DISCRETE") then
fn=comp->functions
fprintf(b "it's a discrete\n")
;find pin on the other side of discrete
con=nil
foreach(onefn fn
fnpins=onefn->pins
pin1=car(fnpins)->pin
pin2=cadr(fnpins)->pin
if(equal((pin1->number) (onech->number)) then
con=pin2
)
if(equal((pin2->number) (onech->number)) then
con=pin1
)
) ;end foreach(onefn fn
if(con!=nil then
fprintf(b "con is not nil\n")
conns=append1(conns onech)
conns=append1(conns con)
;if pin on the other side is not power pin
if(exists(x powers x==con->net->name)==nil then
;select the net on the other side
check=(con->xy)
found=t
br2=car(con->net->branches)
ch2=br2->children ;include everything connected
;to net on the other side to
;the ch list
ch2=remd(con ch2)
ch=append(ch ch2)
ch=remd(con ch)
line=strcat(line "\n")
else ;if can't add the net on other side of discrete
fprintf(b "net on other side is a power pin\n")
found=t
oncethrough=nil
line2=sprintf(line2 "%s \tline dist to pin= %f\n\n" line final_dist)
fprintf(filename line2)
line2=strcat("\t" ref "." num "\t")
line2=sprintf(line2 "%s distance=%f\n" line2 final_dist)
fprintf(brief line2)
line=strcat(line "\n")
check=onech->xy
);end if (exists...
);endif(con!=nil
else ;if not a discrete
;reached one of the endpoints
line=sprintf(line "%s \tline dist to pin= %f\n\n" line final_dist)
;line=strcat(line line2)
ch=remd(onech ch)
fprintf(filename line)
line=strcat("\t" ref "." num "\t")
line=sprintf(line "%s distance=%f\n" line final_dist)
fprintf(brief line)
fprintf(b "line printed is %s\n" line)
line=""
final_dist=0.0
found=t
oncethrough=nil ;need to go through the entire ch list and see
;if we can find any path on this pin location.
;Need to consider this to take care of
;daisy chained case.
conns=append1(conns onech)
fprintf(b "it's not a discrete. comp found=%s\n" ref)
fprintf(b "elements in lens=%L\n" lens)
foreach(onelen lens
if(numberp(onelen) then
line=sprintf(line "%s %f\t" line onelen)
final_dist=final_dist+onelen
else
line= sprintf(line "%s %s\n" line onelen)
);end if
);end foreach
) ;end if(eq(compclass DISCRETE...
);end if(eq(centrepin check) ..
);end if(eq(onech->objType "pin")
);end foreach(onech ch
);end while(oncethrough!=t)
;if there are no more pins left in ch, then make alldone=t
foreach(onech ch
comp=onech->component
if(equal(onech->objType "pin") then
alldone=t
);end if(equal
);end foreach(onech ch
;found will be true if we find any path or pin at the check
;point. if found is nil, then we went through the entire
;ch list and did not find any object at that location. Need
;to move check point to the previous location and see if
;something can be found there.
if(found==nil then
lastcon=car(last(conns))
fprintf(b "found is nil")
conns=remd(lastcon conns)
if(lastcon!=nil then
if(equal(lastcon->objType "path") then
l=car(lays)
fprintf(b "object found is a path\n")
lays=cdr(lays)
prev_pin=nil
prev_tee=nil
prev_path=t
segs=lastcon->segments
lastseg=car(last(segs))
firstseg=car(segs)
startloc=car(firstseg->startEnd)
endloc=cadr(lastseg->startEnd)
temp=list()
leng=length(lens)
for(i 1 leng-2
temp=append1(temp car(lens))
lens=nthcdr(1 lens)
)
lens=temp
fprintf(b "lens=%L" lens)
if(equal(startloc check) then
check=endloc
else
check=startloc
);end if
else
if(equal(lastcon->objType "tee") then
prev_pin=nil
prev_path=nil
prev_tee=t
else
fprintf(b "found is nil and a pin is found\n")
pin2=car(last(conns))
prev_pin=t
prev_path=nil
if(pin2->number !=nil then
conns=remd(pin2 conns)
if(equal(lastcon->xy check) then
check=pin2->xy
pinthrough=pin2->isThrough
else
check=lastcon->xy
pinthrough=lastcon->isThrough
);end if
else
pinthrough=lastcon->isThrough
check=lastcon->xy
);end if
);end if
);end if
else ;if we've traversed (back) through all the elements in
;"conns", then we should set the checkpoint back
;to the driver pin from where it started.
fprintf(b "it went to else because no last conn left\n")
prev_pin=t
prev_path=nil
check=onepin->xy
pinthrough=onepin->isThrough
);end if
line=""
final_dist=0.0
foreach(onelen lens
if(numberp(onelen) then
line=sprintf(line "%s %f\t" line onelen)
final_dist=final_dist+onelen
else
line= sprintf(line "%s %s\n" line onelen)
);end if
);end foreach
);endif
close(b)
);end while( (alldone!=nil)
);end if(exists
;);end if -need to remove it later on...just selects a particular net.
);end if (recvpins
);end foreach(onepin cpins
close(filename)
close(brief)
axlFormClose(Skill_Programs_Form)
t)
("left"
axlFormListDeleteAll(Skill_Programs_Form,"Drivers_List")
axlFormListDeleteAll(Skill_Programs_Form,"SelectedD_List")
seldri=list()
drivers=list()
foreach(onecomp comps
drivers=append1(drivers,onecomp->name)
); endforeach
;sort(available 'alphalessp)
foreach(onename drivers
axlFormSetField(Skill_Programs_Form,"Drivers_List",onename)
); endforeach
axlFormSetField(Skill_Programs_Form,"Drivers_List",nil)
axlFormSetField(Skill_Programs_Form,"SelectedD_List",nil)
t)
("right"
axlFormListDeleteAll(Skill_Programs_Form,"Drivers_List")
axlFormListDeleteAll(Skill_Programs_Form,"SelectedD_List")
drivers=list()
seldri=list()
foreach(onecomp comps
seldri=append1(seldri,onecomp->name)
); endforeach
;sort(selected 'alphalessp)
foreach(onename seldri
axlFormSetField(Skill_Programs_Form,"SelectedD_List",onename)
); endforeach
axlFormSetField(Skill_Programs_Form,"Drivers_List",nil)
axlFormSetField(Skill_Programs_Form,"SelectedD_List",nil)
t)
("left2"
axlFormListDeleteAll(Skill_Programs_Form,"Available_List")
axlFormListDeleteAll(Skill_Programs_Form,"PowerNets_List")
available=list()
selected=list()
foreach(onenet netlist
available=append1(available,onenet->name)
); endforeach
;sort(available 'alphalessp)
foreach(onename available
axlFormSetField(Skill_Programs_Form,"Available_List",onename)
); endforeach
axlFormSetField(Skill_Programs_Form,"Available_List",nil)
axlFormSetField(Skill_Programs_Form,"PowerNets_List",nil)
t)
("right2"
axlFormListDeleteAll(Skill_Programs_Form,"Available_List")
axlFormListDeleteAll(Skill_Programs_Form,"PowerNets_List")
available=list()
powers=list()
foreach(onenet netlist
powers=append1(powers,onenet->name)
); endforeach
;sort(selected 'alphalessp)
foreach(onename powers
axlFormSetField(Skill_Programs_Form,"PowerNets_List",onename)
); endforeach
axlFormSetField(Skill_Programs_Form,"Available_List",nil)
axlFormSetField(Skill_Programs_Form,"PowerNets_List",nil)
t)
("cancel"
axlFormClose(Skill_Programs_Form)
axlCancelEnterFun()
t)
); end case
); end of skill_programs_callback
;shell("rm Form.form")
); end of Skill_Programs_Menu
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -