[Ample/All] 특정 디렉터리 하부에 있는 모든 파일 수집 (recursive)

Document created by nick_hong on Aug 2, 2013Last modified by nick_hong on Aug 2, 2013
Version 3Show Document
  • View in full screen mode

Ample에서 제공하는 $$get_container_contents() 함수와 $file_exist() 함수를 응용하여 사용자에게 입력받은 디렉터리 아래를 모두 scan하도록 작성된 예제입니다.

 

기본 함수만 사용하였으므로, Board Station의 어느 application에서도 실행될 수 있습니다.

특히, 이 예제에서는 재귀함수(recursive function)를 사용하여 함수를 계속 반복 호출하면서 결과값을 누적시키는 방법이 사용되었습니다.

 

$$get_container_contents() 함수는 dme_ref.pdf 에, $file_exist() 함수는 ample_ref.pdf 에 자세한 사용방법이 수록되어 있습니다.

 

Board Station의 아무 Application이나 실행된 상태에서 F11키를 눌러 "dofile <파일의 위치>"를 실행하여 나타나는 입력창에 임의의 디렉터리(full_path)를 입력하면 transcript에 해당 디렉터리 하위의 모든 파일을 출력합니다.

 

 

실행 예)

//  Note: Found 18 files & objects in directory /cygdrive/c/WDIR/mydesign/pcb.

//  catalogs (object:Pcb_catalogs) - /cygdrive/c/WDIR/mydesign/pcb/catalogs

//  comps (object:Pcb_comps) - /cygdrive/c/WDIR/mydesign/pcb/comps

//  gates (object:Pcb_gates) - /cygdrive/c/WDIR/mydesign/pcb/gates

//  geoms (object:Pcb_geoms) - /cygdrive/c/WDIR/mydesign/pcb/geoms

//  layers (object:Pcb_layers) - /cygdrive/c/WDIR/mydesign/pcb/layers

//  nets (object:Pcb_nets) - /cygdrive/c/WDIR/mydesign/pcb/nets

//  notes (object:Pcb_notes) - /cygdrive/c/WDIR/mydesign/pcb/notes

//  pins (object:Pcb_pins) - /cygdrive/c/WDIR/mydesign/pcb/pins

//  pkgconf (object:Pcb_pkgconf) - /cygdrive/c/WDIR/mydesign/pcb/pkgconf

//  pkginst (object:Pcb_pkginst) - /cygdrive/c/WDIR/mydesign/pcb/pkginst

//  pkgs (object:Pcb_pkgs) - /cygdrive/c/WDIR/mydesign/pcb/pkgs

//  spares (object:Pcb_spares) - /cygdrive/c/WDIR/mydesign/pcb/spares

//  tech (object:Pcb_tech) - /cygdrive/c/WDIR/mydesign/pcb/tech

//  testpoints (object:Pcb_testpoints) - /cygdrive/c/WDIR/mydesign/pcb/testpoints

//  traces (object:Pcb_traces) - /cygdrive/c/WDIR/mydesign/pcb/traces

//  check_report (file) - /cygdrive/c/WDIR/mydesign/pcb/check/check_report

//  bill_of_materials (file) - /cygdrive/c/WDIR/mydesign/pcb/mfg/bill_of_materials

//  net_report (file) - /cygdrive/c/WDIR/mydesign/pcb/mfg/net_report

 

 

//==========================================================================

// DISCLAIMER OF WARRANTY:  Unless otherwise agreed in writing,

// Mentor Graphics software and associated files are provided "as is"

// and without warranty.  Mentor Graphics has no obligation to support

// or otherwise maintain software.  Mentor Graphics makes no warranties,

// express or implied with respect to software including any warranty

// of merchantability or fitness for a particular purpose.

//

// LIMITATION OF LIABILITY: Mentor Graphics is not liable for any property

// damage, personal injury, loss of profits, interruption of business, or for

// any other special, consequential or incidental damages, however caused,

// whether for breach of warranty, contract, tort (including negligence),

// strict liability or otherwise. In no event shall Mentor Graphics'

// liability exceed the amount paid for the product giving rise to the claim.

//==========================================================================

Outcomes