⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 netlength.il

📁 skill语言在Cadence平台二次开发中大量使用
💻 IL
📖 第 1 页 / 共 2 页
字号:
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;                      Net Length Report Generator
;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;   DESCRIPTION
;
;   If you are looking for a program to find the total length of etch from a pin  
;   on the board file to another pin, then this program is for you.
;
;   The program finds the length of nets starting from a component(s) that you 
;   pick to all other components on the board.  In detail, when you run this 
;   program a form opens up.  On this form, you select the component(s) from where 
;   you would like to start measuring the distance.  You also select Power Nets 
;   (eg. VCC, GND, etc.) that are stitched to the plane.  Then the program goes 
;   through each pin on the component  If the net name attached to the pin is not 
;   a power pin then it measures the distance starting from that pin to other 
;   components.  It passes through DISCRETEs (resistors, capacitors, etc.), and 
;   selects the net on the other side of the DISCRETE.  If this net is one of the 
;   power nets, then it stops there and records that distance.  Otherwise, it keeps 
;   on going through the CLINES and recording their distances until it reaches a 
;   non-discrete component.  It records this total length and looks for more clines 
;   at this pin location.  If any cline is found, it goes through it and looks for 
;   more components through this path.  If it does find a component taking this path, 
;   it records its distance from the start pin (on the component you selected) to this 
;   location. When no more components are found on this path, then it goes back and 
;   explores all the other paths.  

;   The program also takes into account the length of arc CLINES.  It seems that the 
;   net length report in SpectraQuest assumes straight line segments.  Thus, the 
;   distances are always off by a few mils.

;   The program generates two reports.  In one of the reports, only the final distance 
;   to the pin on other componenets is recorded.  In the other report detailed 
;   information about how it got to that pin is recorded.
;    
;   Type "det" to run this program
;   
;
;   Written by Deepika Mehta
;   Celestica Memory Development
;   dmehta@celestica.com
;   June 15,2001
;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


axlCmdRegister( "det" `det)


;##################################
;# _createForm                    #
;##################################
(defun _createForm ()

  Form = outfile("test.form" "w")

  fprintf(Form "FILE_TYPE=FORM_DEFN VERSION=2\n")
  fprintf(Form "FORM\n")
  fprintf(Form "FIXED\n")
  fprintf(Form "PORT 75 35\n")
  fprintf(Form "HEADER \"Netlist Generator\"\n")
  fprintf(Form "TILE\n")

  fprintf(Form "TEXT \"#################################################################\"\n")
  fprintf(Form "TLOC 2 2\n")
  fprintf(Form "ENDTEXT\n")

  fprintf(Form "TEXT \"         Please select the nets for which you would like to find lengths for.\"\n")
  fprintf(Form "TLOC 2 4\n")
  fprintf(Form "ENDTEXT\n")

  fprintf(Form "TEXT \"#################################################################\"\n")
  fprintf(Form "TLOC 2 6\n")
  fprintf(Form "ENDTEXT\n")

  fprintf(Form "TEXT \"Drivers\"\n")
  fprintf(Form "TLOC 2 10\n")
  fprintf(Form "ENDTEXT\n")

  fprintf(Form "TEXT \"Selected Drivers\"\n")
  fprintf(Form "TLOC 34 10\n")
  fprintf(Form "ENDTEXT\n")

  fprintf(Form "FIELD Drivers_List\n")
  fprintf(Form "FLOC 2 12\n")
  fprintf(Form "LIST \"\" 20 5\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "FIELD SelectedD_List\n")
  fprintf(Form "FLOC 34 12\n")
  fprintf(Form "LIST \"\" 20 5\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "FIELD right\n")
  fprintf(Form "FLOC 24 17\n")
  fprintf(Form "MENUBUTTON \"All ->\" 5 3\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "FIELD left\n")
  fprintf(Form "FLOC 24 14\n")
  fprintf(Form "MENUBUTTON \"<- All\" 5 3\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "TEXT \"Available Nets\"\n")
  fprintf(Form "TLOC 2 22\n")
  fprintf(Form "ENDTEXT\n")

  fprintf(Form "TEXT \"Power Nets\"\n")
  fprintf(Form "TLOC 34 22\n")
  fprintf(Form "ENDTEXT\n")

  fprintf(Form "FIELD Available_List\n")
  fprintf(Form "FLOC 2 24\n")
  fprintf(Form "LIST \"\" 20 5\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "FIELD PowerNets_List\n")
  fprintf(Form "FLOC 34 24\n")
  fprintf(Form "LIST \"\" 20 5\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "FIELD right2\n")
  fprintf(Form "FLOC 24 29\n")
  fprintf(Form "MENUBUTTON \"All ->\" 5 3\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "FIELD left2\n")
  fprintf(Form "FLOC 24 26\n")
  fprintf(Form "MENUBUTTON \"<- All\" 5 3\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "FIELD create\n")
  fprintf(Form "FLOC 2 36\n")
  fprintf(Form "MENUBUTTON \"Create Netlist\" 10 3\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "FIELD cancel\n")
  fprintf(Form "FLOC 20 36\n")
  fprintf(Form "MENUBUTTON \"CANCEL\" 10 3\n")
  fprintf(Form "ENDFIELD\n")

  fprintf(Form "ENDTILE\n")

  fprintf(Form "ENDFORM\n")
  close(Form)
); end defun
;##################################
;# End of _createForm             #
;##################################

;This function can be used to find any allegro object (eg. clines, nets,etc.)
;send the object type as argument.
(defun findAllOfType (findType "t")
  (axlClearSelSet) ;clear any previous selection

  (axlSetFindFilter ?enabled  (list "noall" findType "invisible")
    ?onButtons  (list "noall" findType)) ;"noall" is used to deselect any 
						     ;preselected buttons in allegro
  (axlAddSelectAll)
  (setq selSet (axlGetSelSet))
  selSet); end defun

;########################################################################
;#                                                                      #
;#                Function ashFindAllClines                             #
;#                                                                      #
;########################################################################
(defun ashFindAllClines ()	;find all clines
  (findAllOfType "CLINES")
); end ashFindAllClines

(defun ashFindAllComps ()	;find all components
  (findAllOfType "COMPONENTS")
); end ashFindAllComps

;Main function starts from here.
(defun det ()

  _createForm()  ;call the function to create test.form file
  Skill_Programs_Form=axlFormCreate( (gensym) "test.form" '(e outer) 'skill_programs_callback t)
  ;"skill_programs_callback" is the name of the function that controls the form

  axlFormDisplay(Skill_Programs_Form)
  

  ;Declare Variables
  netlist=list()
  powers=list()
  available=list()
  cl=list()
  net_cl=list()
  ch=list()
  drivers=list()
  seldri=list()
  drs=list()
  cpins=list()
  remvpins=list()

  netlist=axlDBGetDesign()->nets ;netlist=list containing dbids of all the nets
  ;instead of finding all nets, you could find components, drcs, padstacks, etc.
  ;see chapter 2, page 11 for a list of other design attributes that could be used here.

  if(netlist==nil then
    axlFormSetField(Skill_Programs_Form,"Available_List",list("No Netlist Loaded"))
  else
    foreach(onenet netlist
      available=append1(available,onenet->name)
	;Do not use "append" because that concatenates two lists.
	;whenever you use "append1", "sort", or any other functions that modify a 
	;list, then make sure you equate the list to the result (the manual does
	;not do this)
    ); endforeach
    available=sort(available 'alphalessp)	;sort the list in alphabetical order

    foreach(onename available
      axlFormSetField(Skill_Programs_Form,"Available_List",onename)
    ); endforeach
  );end if

  comps=axlDBGetDesign()->components
  if(comps==nil then
    axlFormSetField(Skill_Programs_Form,"Drivers_List",list("No Components in design"))
  else
    foreach(onec comps
      drivers=append1(drivers,(onec->name))
    ); endforeach
    drivers=sort(drivers 'alphalessp)
    foreach(onecomp drivers
      axlFormSetField(Skill_Programs_Form,"Drivers_List",onecomp)
    ); endforeach
  );end if


  ;The following function controls form and its fields
  (defun skill_programs_callback (Skill_Programs_Form)
    ;the following case statement checks which field has been selected
    ;and takes appropriate action
    (case Skill_Programs_Form->curField

      ("Available_List"
        ;if the cursor is in Available nets List Field then we need to 
	  ;move the selected item to the Power Nets List Field
	  powers=append1(powers,Skill_Programs_Form->curValue)
        axlFormSetField(Skill_Programs_Form,"PowerNets_List",Skill_Programs_Form->curValue)
	  axlFormSetField(Skill_Programs_Form,"PowerNets_List",nil)
		 
	  if( available!=nil then
	    axlFormListDeleteAll(Skill_Programs_Form,"Available_List")
	    available=remd((Skill_Programs_Form->curValue) available)
	  );end if

	  available=sort(available 'alphalessp)
	  if(  available!=nil then
	    foreach(one available
            axlFormSetField(Skill_Programs_Form,"Available_List",one)
	    ); endforeach
	  );end if
	  axlFormSetField(Skill_Programs_Form,"Available_List",nil)
	t)


      ("PowerNets_List"
	  available=append1(available,(Skill_Programs_Form->curValue))
 	  axlFormListDeleteAll(Skill_Programs_Form,"Available_List")
	  available=sort(available 'alphalessp)
	  foreach(onename available
          axlFormSetField(Skill_Programs_Form,"Available_List",onename)
        ); endforeach
	  axlFormSetField(Skill_Programs_Form,"Available_List",nil)

	  if( powers!=nil then
	    axlFormListDeleteAll(Skill_Programs_Form,"PowerNets_List")
	    powers=remd((Skill_Programs_Form->curValue) powers)
	  )
	  if( powers!=nil then
	    foreach(one powers
            axlFormSetField(Skill_Programs_Form,"PowerNets_List",one)
          ); endforeach
        )
	  axlFormSetField(Skill_Programs_Form,"PowerNets_List",nil)
	t)

      ("Drivers_List"
	  seldri=append1(seldri,Skill_Programs_Form->curValue)
 	  axlFormListDeleteAll(Skill_Programs_Form,"SelectedD_List")
	  foreach(onedri seldri
          axlFormSetField(Skill_Programs_Form,"SelectedD_List",onedri)
        ); endforeach
	  axlFormSetField(Skill_Programs_Form,"SelectedD_List",nil)
		 
	  if( drivers!=nil then
	    axlFormListDeleteAll(Skill_Programs_Form,"Drivers_List")
	    drivers=remd((Skill_Programs_Form->curValue) drivers)
	  )
	  drivers=sort(drivers 'alphalessp)
	  if(  drivers!=nil then
	    foreach(one drivers
          axlFormSetField(Skill_Programs_Form,"Drivers_List",one)
	    ); endforeach
	  )
	  axlFormSetField(Skill_Programs_Form,"Drivers_List",nil)
	t)


      ("SelectedD_List"
	  drivers=append1(drivers,(Skill_Programs_Form->curValue))
 	  axlFormListDeleteAll(Skill_Programs_Form,"Drivers_List")
	  drivers=sort(drivers 'alphalessp)
	  foreach(onename drivers
          axlFormSetField(Skill_Programs_Form,"Drivers_List",onename)
        ); endforeach
	  axlFormSetField(Skill_Programs_Form,"Drivers_List",nil)
	  if( seldri!=nil then
	    axlFormListDeleteAll(Skill_Programs_Form,"SelectedD_List")
	    seldri=remd((Skill_Programs_Form->curValue) seldri)
	  )
	  if( seldri!=nil then
	    foreach(one seldri
            axlFormSetField(Skill_Programs_Form,"SelectedD_List",one)
          ); endforeach
        )
	  axlFormSetField(Skill_Programs_Form,"SelectedD_List",nil)
	t)

      ("create"
	  ;for each(one in the selected
	  ;break it up into CLINES.

	  axlClearSelSet()
	  filename=outfile("detailed.rpt")
	  brief=outfile("brief.rpt")
	  line=nil
  	  fprintf(filename "\n\n")
  	  fprintf(filename "########################################################\n")
	  line="\t length    layer \n"
	  fprintf(filename line)

	  ;get the pins attatched to all the drivers selected
	  foreach(onedr seldri
	    ;select the driver
	    drs=setof(n ashFindAllComps() n->name == onedr)
	    cpins=append(cpins (car(drs)->pins))
	  )

	  shell("rm test.log")
	  foreach(onepin cpins

	   ;if this pin hasn't been visited already (remember that a net from 
	   ;one of the pins on the drivers can always go to the same driver, but
	   ;different pin.  In this case you don't want to calculate the length
	   ;in circular fashion.
	   if(exists(x remvpins x==onepin)==nil then
	    ;declare variables
	    line=""
	    ch=list()
  	    br=list()
	    cpins=list()
	    ch2=list()
  	    conns=list()
	    lens=list()
	    lays=list()
	    remvpins=list()
	    check=(onepin->xy)
	    onenet=onepin->net
	    pinthrough=nil

        ;if(equal(onenet->name "MEM_WE_L0") then
	    ;if the pin has a net name attached to it, and it is not one of the power
	    ;nets(eg. VDD, GND, etc.), then need to find distance from this pin to all
	    ;other pins it's connected to.
	    if(and((strlen(onenet->name)!=0) (exists(x powers x==onenet->name)==nil)) then
		comp=onepin->component
		num=onepin->number	;pin number
		ref=comp->name		;ref des
		line=strcat("\n" ref "." num ", net name: " onenet->name "\n")
		fprintf(filename line)
		fprintf(brief line)
		axlMsgPut("net=%s is not a power net" onenet->name)

		;get the objects (vias, paths, pins, etc.) attached to the net
		br=car(onenet->branches)	
		ch=br->children	;ch contains every allegro object(pin, clines, vias, tees)
					;connected to the net
		ch=remd(onepin ch);you don't want to go from the pin to itself. Therefore, it
					;can be deleted.

		;initialize variables
		alldone=t	;keeps track whether there are still anymore components left to
				;visit
 	      l=nil

		final_dist=0.0	;keeps track of the distance from the driver pin to the
					;component
		found=nil
	      prev_path=nil  ;keeps track whether the previous selection was a path or not
		prev_pin=nil  
		prev_tee=nil
		line=""
		firsttime=t	  ;first time through the loop
		numb=0
	  	while((alldone!=nil)
		  b=outfile("test.log" "a")
		  ;fprintf(b "alldone is not nil\n")
		  oncethrough=nil
		  alldone=nil
              while((oncethrough==nil)  ;after finding a path or pin, and moving location
						    ;to next point, you want to visit the list of
						    ;ch atleast once to find any path or pin at this
						    ;new location. If nothing is found, then check
						    ;will be moved back to previous location to find
						    ;any other paths starting from that location
						    ;(this is done to implement recursion in the
						    ;program
                oncethrough=t

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -