Quartus® II Tcl の例: タイムグループ内のノードの詳細説明

author-image

投稿者:

タイムグループは、タイミングのを行うための効率的な方法です。ワイルドカードを指定して、パターンに一致するノードをグループに含めたり、パターンに一致するノードをグループから除外したりできます。正しいワイルドカード・パターンを指定したかどうかを確認するために、タイムグループ内のすべてのノードのリストを表示する必要があるかもしれません。

これらのスクリプトは、デザイン内のタイムグループのノードの詳細に説明します。このスクリプトは、デザイン内のすべてのタイミングノードを反復処理し、タイミングノードの名前を各タイムグループの内包パターン、次に各タイムグループの除外パターンと比較します。

このスクリプトには制限があり、ネストされたタイムグループを扱うことはできません。あるタイムグループを別のタイムグループの要素として含めたり除外したりすることは有効ですが、このスクリプトではサポートされていません。

バスのすべてのビットをタイムグループに含めるには、Quartus II ソフトウェアのバージョン 4.2 以降では、バス名の後にアスタリスクを付けます。バージョン 5.0 からは、アスタリスクを付けずにバス名を指定できます。このスクリプトには、ソフトウェアのバージョン・ナンバーに基づいて、この動作をチェックする機能が含まれています。

global quartus
load_package advanced_timing
load_package project

# スクリプトが 4.2 以前、または 5.0 以降で実行されているかどうかを
# 判定します。5.0 and later recognizes <bus name> as 
# 4.2 以前では、<バス名>* が有効な
# タイムグループ・エントリーとして必要です。
regexp {^Version (\d)} $quartus(version) match qver
if { $qver < 5 } {
    set need_asterisk 1
} else {
    set need_asterisk 0
}

project_open [lindex $quartus(args) 0]

create_timing_netlist

set tg_name [lindex $quartus(args) 1]

post_message "The following nodes are members of the timegroup $tg_name:"

set tg_name [escape_brackets $tg_name]
set tg_members [timegroup -get_members $tg_name]
set tg_exceptions [timegroup -get_exceptions $tg_name]

# このループは、デザイン内のすべてのタイミングノードをウォークスルーします 
foreach_in_collection node_id [get_timing_nodes -type all] {

    set node_name [get_timing_node_info -info name $node_id]

    # ノード名がバス内にない場合は、bus_name をクリアします。
    # それ以外の場合は設定します。
    if { ! [regexp {(.*?)\[\d+\]} $node_name match bus_name] } {
        set bus_name ""
    }
    
    # Now that we have the node name, check to see whether it matches  
    # any patterns in the specified timegroup  
    set matches 0  
    foreach_in_collection member $tg_members {

        set esc_name [escape_brackets [lindex $member 2]]
        if { [string match $esc_name $node_name] } {
            set matches 1
        } elseif { ! $need_asterisk && \
            [string match $esc_name $bus_name] } {
            set matches 1
        }
    }

    # ここで $matches が 1 の場合、タイミングノードは  
    # タイムグループ内のメンバー名とマッチしました。ただし、例外もマッチする可能性もあります。  
    # ここでそれをチェックします。
    if { $matches } {
        
        foreach_in_collection exception $tg_exceptions {
            
            set esc_name [escape_brackets [lindex $exception 2]]
            if { [string match $esc_name $node_name] } {
                set matches 0
            } elseif { ! $need_asterisk && \
                [string match $esc_name $bus_name] } {
                set matches 0
            }
        }
    }

    # すべての例外を調べました。それでも $matches が 1 の場合は、
    # ノード名がメンバー・パターンにマッチし、
    # 例外パターンにはマッチしなかったので、ノード名を出力します。
    if { $matches } {
        post_message $node_name
    }
}

project_close