컴파일할 때마다 많은 컴파일과 다양한 설정을 수행할 때는 컴파일에서 컴파일까지의 설정과 결과가 무엇인지 기억하기 어려울 수 있습니다. 프로젝트를 보관하면 컴파일 중에 생성된 파일을 포함하여 전체 복사본을 보존할 수 있습니다. 시스템 명령 프롬프트에서 단일 명령으로 프로젝트를 보관할 수 있지만 Tcl 스크립트를 만들고 자동으로 실행하도록 설정을 추가하면 프로세스가 더 쉬워집니다.
모든 컴파일이 끝날 때 스크립트가 자동으로 실행되도록 하려면 다음 스크립트를 사용하고 프로젝트에 새 할당을 추가하십시오. 할당 이름은 POST_FLOW_SCRIPT_FILE. 이 할당에 대한 자세한 내용은 자동 스크립트 실행 예제 를 참조하십시오. 스크립트가 autoqar.tcl이라고 가정하면 Quartus II 설정 파일(.qsf)에 다음 할당을 추가하십시오.
set_global_assignment -name POST_FLOW_SCRIPT_FILE quartus_sh:autoqar.tcl
스크립트는 현재 날짜와 시간을 기준으로 파일 이름을 만듭니다. 날짜 및 시간 표현 변경에 대한 자세한 내용은 날짜 및 시간 서식 페이지를 참조하십시오.
# Use these options to control what files get archived. # -include_outputs: Includes Quartus II output files, including the # db directory and programming files # -include_libraries: Includes system libraries referenced in your # project set options "-include_outputs" #set options "-include_libraries" #set options "-include_outputs -include_libraries" # Subdirectory to put the automatically created qars into set qar_directory autoqar # Generates a name for the qar based on the name of the revision # and the current time. proc generateQarName { project revision } { # time_format_string controls how the qar is named. # These values give the value month_dd_yyyy-hh.mm.ss. # For example, Jan_28_2004-13.00.05 set time_format_string "%b_%d_%Y-%H_%M_%S" set time_value [clock format [clock seconds] \ -format $time_format_string] # The name of the qar is based on the revision name and the time return $revision-$time_value } global quartus set module_or_flow [lindex $quartus(args) 0] set project [lindex $quartus(args) 1] set revision [lindex $quartus(args) 2] # If a qar is made, set this to 1 and attempt to move it later on set ran_qar 0 # Add any modules or flows to the list in the switch statement # As is, it'll make a qar after each compile, compile and simulate, # and incremental fit. switch -exact -- $module_or_flow { compile - compile_and_simulate - incremental_fitting { if { [catch { project_open -revision $revision $project set qar_name [generateQarName $project $revision] project_archive $options $qar_name project_close } res ] } { post_message -type warning $res } else { set ran_qar 1 } } } # If a qar was made, try to move it to the right directory if { $ran_qar } { if { [catch { file mkdir $qar_directory file copy $qar_name.qar $qar_directory file copy $qar_name.qarlog $qar_directory file delete $qar_name.qar file delete $qar_name.qarlog } res ] } { post_message -type warning $res } else { set qname [file join $qar_directory $qar_name] post_message "Successfully archived your project in $qname.qar" } }