2020年8月24日月曜日

[Quartus]Tclスクリプトのサンプル

[Quartus]Tclスクリプトのサンプル

Quartus Primeで使用するTclスクリプトのサンプル

実行環境

  • Quartus Prime
  • Cygwin or コマンドプロンプト

使い方

  1. PATHに下記フォルダパスを追加
    $QUARTUS_INSTALL_DIR/bin64
  2. QPFファイルと同じ階層にスクリプトを保存
  3. プロジェクト名(PROJECT)を環境に合わせる
  4. スクリプトを実行

注意

QPFファイルが複数ある環境では正常に動作しない

Synthesisのレポート抽出

#=============================================================#
# 論理合成レポートを出力するスクリプト                        #
# [実行]quartus_sh -t report_synth.tcl                        #
#       *QPFファイルのあるカレントディレクトリ                #
# [参考]QuartusIIハンドブック Volume2[3.tcl スクリプティング] #
#=============================================================#

# 設定
#================================================#
  set     PROJECT   "FPGA"


# 前処理・後処理
#================================================#
proc  preprocess { PROJECT } {
  load_package report;
  project_open $PROJECT -revision $PROJECT

  # レポートのローディング
  load_report
  
  # 全レポートのパネル名を取得
  set panel_names [get_report_panel_names]
  return  $panel_names
}

proc  postprocess { } {
  unload_report
}

# 個別のレポート生成
#================================================#
proc synth_report { panel_name } {
  set  rpt_head  ""
  set  rpt_name  ""
  set  rpt_file  {}
  
  # レポート名抽出1
  regsub   -all -- {\|.*$}  $panel_name {}  rpt_head
  regsub   -all -- { .*}    $rpt_head   {}  rpt_head
  
  # レポート名抽出2
  regsub   -all -- {^.*\|}  $panel_name {}  rpt_name
  regsub   -all -- {:\/.*}  $rpt_name   {}  rpt_name
  regsub   -all -- {&|"}    $rpt_name   {}  rpt_name
  regsub   -all -- {:| |\/} $rpt_name   {_} rpt_name
  
  # レポート名成形
  lappend  rpt_file "./"
  lappend  rpt_file $rpt_head
  lappend  rpt_file "_"
  lappend  rpt_file $rpt_name
  lappend  rpt_file ".rpt"
  
  set      rpt_file  [join  $rpt_file]
  regsub   -all -- { }      $rpt_file   {}  rpt_file
  
  # レポートファイルのOPEN
  set      rpt_fd    [open  $rpt_file w]

  # レポート名->レポート番号変換
  set      num_rows  [get_number_of_rows -name $panel_name]
  
  # 見出しを含むRowを含めて、レポートファイル内の
  # すべてのRpwを進み、Tab区切りデータを書き出す
  for { set i 0 } { $i < $num_rows } { incr i } {
    set  row_data  [get_report_panel_row -name $panel_name -row $i]
    puts $rpt_fd   [join $row_data "	"]
  }
  close  $rpt_fd
}

# Main
#================================================#
  set  panel_names [preprocess  $PROJECT]
  file mkdir rpt_synth
  cd         rpt_synth
  
  # 全パネルのレポートを出力
  foreach panel_name $panel_names {
   #puts $panel_name; # [Debug]レポートリスト一覧表示
    synth_report $panel_name
  }

  postprocess

STAのレポート出力

#================================================#
# タイミングレポートを出力するスクリプト         #
# [実行]quartus_sta -t report_sta.tcl            #
#       *QPFファイルのあるカレントディレクトリ   #
# [参考]SDC and TimeQuest API Reference Manual   #
#================================================#

# 設定
#================================================#
  set     PROJECT   "FPGA"

# 前処理
#================================================#
proc preprocess { PROJECT } {
  load_package  report;
  project_open  $PROJECT  -revision  $PROJECT
  
  create_timing_netlist
  read_sdc
  update_timing_netlist
}

# 個別のレポート
#================================================#
proc sta_reports { condition upp_rank } {
  set     rpt_name "report_timing_"
  append  rpt_name $condition
  
  # バイオレーションしたタイミング
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  set     rpt_file ""
  lappend rpt_file $rpt_name "_top_failing_paths.rpt"
  qsta_utility::generate_top_failures_per_clock "Top Failing Paths"   $upp_rank -multi_corner -file $rpt_file

  # I/Oのタイミング
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  set     rpt_file ""
  lappend rpt_file $rpt_name "_all_io_timing_reports.rpt"
  qsta_utility::generate_all_io_timing_reports  "Report Timing (I/O)" $upp_rank -multi_corner -file $rpt_file
  
  # InputPort->Registerまでの遅延量
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  set     rpt_file ""
  lappend rpt_file $rpt_name "_input_ports.rpt"
  report_timing -from [get_ports *] -to * -npaths $upp_rank -file $rpt_file
  
  # Register->OutputPortまでの遅延量
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  set     rpt_file ""
  lappend rpt_file $rpt_name "_output_ports.rpt"
  report_timing -from * -to [get_ports *] -npaths $upp_rank -file $rpt_file
  
  # フォルスパスの遅延量
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  set     rpt_file ""
  lappend rpt_file $rpt_name "_false_path.rpt"
  report_timing -false_path -from_clock { * } -to_clock { * } -from * -to * -setup -npaths $upp_rank -detail full_path -panel_name {Report False Path} -multi_corner -file $rpt_file
}

# Main
#================================================#

  preprocess $PROJECT
  file mkdir rpt_sta
  cd         rpt_sta

  # レポート出力(全体)
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  report_advanced_io_timing -file "all_report_advanced_io_timing.rpt"
  report_clock_fmax_summary -file "all_report_clock_fmax_summary.rpt"
  report_clock_transfers    -file "all_report_clock_transfers.rpt"
  report_clocks             -file "all_report_clocks.rpt"
  report_clocks  -tree      -file "all_report_clocks_tree.rpt"
  report_datasheet          -file "all_report_datasheet.rpt"
  report_ddr                -file "all_report_ddr.rpt"
  report_exceptions         -file "all_report_exceptions.rpt"
  report_max_skew           -file "all_report_max_skew.rpt"
  report_metastability      -file "all_report_metastability.rpt"
  report_min_pulse_width    -file "all_report_min_pulse_width.rpt"
  report_ucp                -file "all_report_unconstrained_paths.rpt"
  report_sdc  -ignored      -file "all_report_ignored_sdc.rpt"
  check_timing              -file "all_report_check_timing.rpt"
# report_bottleneck         -file "report_bottleneck.rpt"
# report_net_delay          -file "report_net_delay.rpt"
# report_net_timing         -file "report_net_timing.rpt"
# report_partitions         -file "report_partitions.rpt"
# report_path               -file "report_path.rpt"
# report_rskm               -file "report_rskm.rpt"
# report_skew               -file "report_skew.rpt"
# report_tccs               -file "report_tccs.rpt"
# report_timing             -file "report_timing.rpt"
  
  # レポート出力(単体)
  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  set_operating_conditions  -model slow
  sta_reports "slow" 1000
  
  set_operating_conditions  -model fast
  sta_reports "fast" 1000

1 件のコメント:

匿名 さんのコメント...

The King Casino Archives - Hertzaman
The King Casino Archives, including news, articles, videos, address, 바카라 사이트 gaming deccasino info, The King Casino 메이피로출장마사지 & Hotel in Henderson, herzamanindir.com/ NV is one communitykhabar of the newest hotels and motels on