Quartus® II Tcl 내보내기 보고서 데이터를 CSV 파일로 내보내기

author-image

기준

많은 디자이너가 FPGA 디자인의 일부 단계에서 Excel을 사용합니다. Quartus II 보고서 패널에서 Excel에서 열 수 있는 CSV 파일로 데이터를 쉽게 내보낼 수 있습니다.

이 간단한 절차는 지정된 보고서 패널에서 데이터를 내보내고 파일에 기록합니다. 이 절차를 호출할 때는 프로젝트를 열어야 합니다. 스크립트에서 사용하는 방법의 예는 다음과 같습니다.

proc panel_to_csv { panel_name csv_file } {

    set fh [open $csv_file w]
    load_report
    set num_rows [get_number_of_rows -name $panel_name]

    # Go through all the rows in the report file, including the
    # row with headings, and write out the comma-separated data
    for { set i 0 } { $i < $num_rows } { incr i } {
        set row_data [get_report_panel_row -name $panel_name -row $i]
        puts $fh [join $row_data ","]
    }

    unload_report
    close $fh
}

 

절차를 사용하는 스크립트는 다음과 같습니다. 아래 명령과 함께 시스템 명령 프롬프트에서 이 작업을 실행합니다.

load_package report
package require cmdline

proc panel_to_csv { panel_name csv_file } {

    set fh [open $csv_file w]
    load_report
    set num_rows [get_number_of_rows -name $panel_name]

    # Go through all the rows in the report file, including the
    # row with headings, and write out the comma-separated data
    for { set i 0 } { $i < $num_rows } { incr i } {
        set row_data [get_report_panel_row -name $panel_name -row $i]
        puts $fh [join $row_data ","]
    }

    unload_report
    close $fh
}

set options {\
    { "project.arg" "" "Project name" } \
    { "revision.arg" "" "Revision name" } \
    { "panel.arg" "" "Panel name" } \
    { "file.arg" "" "Output file name"} \
}
array set opts [::cmdline::getoptions quartus(args) $options]

project_open $opts(project) -revision $opts(revision)

panel_to_csv $opts(panel) $opts(file)

unload_report

다음 명령을 사용하여 명령 프롬프트에서 이 스크립트를 실행할 수 있습니다.

quartus_sh -t script.tcl -project <project name> -revision <revision name> -panel <panel name> -file <file name>

시스템 명령 프롬프트에 입력하면 패널 이름 인수를 올바르게 인용해야 합니다. 수직 막대(|)와 같은 특정 문자는 명령 쉘에 특별한 의미를 가짐.

이 페이지의 콘텐츠는 원본 영어 콘텐츠에 대한 사람 번역 및 컴퓨터 번역의 조합으로 완성되었습니다. 이 콘텐츠는 편의와 일반적인 정보 제공을 위해서만 제공되었으며, 완전하거나 정확한 것으로 간주되어선 안 됩니다. 이 페이지의 영어 버전과 번역 간 모순이 있는 경우, 영어 버전이 우선적으로 적용됩니다. 이 페이지의 영어 버전을 확인하십시오.