altmemddr_phy_ddr_pins.tcl
来自「nios里面用自定义指令集来实现三角函数」· TCL 代码 · 共 968 行 · 第 1/3 页
TCL
968 行
# Description: Given a node, tells whether or not it is a I/O clock divider clk## ---------------------------------------------------------------- set cell_id [get_node_info -cell $node_id] set atom_type [get_cell_info -atom_type $cell_id] if {$atom_type == "IO_CLOCK_DIVIDER"} { set node_name [get_node_info -name $node_id] set fanout_edges [get_node_info -fanout_edges $node_id] if {[string match "*|clkout" $node_name] && [llength $fanout_edges] > 0} { set result 1 } else { set result 0 } } else { set result 0 } return $result}# ----------------------------------------------------------------#proc post_sdc_message {msg_type msg} {## Description: Posts a message in TimeQuest, but not in Fitter# The SDC is read mutliple times during compilation, so we'll wait# until final TimeQuest timing analysis to display messages## ---------------------------------------------------------------- if { $::TimeQuestInfo(nameofexecutable) != "quartus_fit"} { post_message -type $msg_type $msg }}# ----------------------------------------------------------------#proc get_report_column { report_id str} {## Description: Gets the report column index with the given header string## ---------------------------------------------------------------- set target_col [get_report_panel_column_index -id $report_id $str] if {$target_col == -1} { error "Cannot find $str column" } return $target_col}# ----------------------------------------------------------------#proc get_fitter_report_pin_info_from_report {target_pin info_type pin_report_id} {## Description: Gets the report field for the given pin in the given report## ---------------------------------------------------------------- set pin_name_column [get_report_column $pin_report_id "Name"] set info_column [get_report_column $pin_report_id $info_type] set result "" if {$pin_name_column == 0 && 0} { set row_index [get_report_panel_row_index -id $pin_report_id $target_pin] if {$row_index != -1} { set row [get_report_panel_row -id $pin_report_id -row $row_index] set result [lindex $row $info_column] } } else { set report_rows [get_number_of_rows -id $pin_report_id] for {set row_index 1} {$row_index < $report_rows && $result == ""} {incr row_index} { set row [get_report_panel_row -id $pin_report_id -row $row_index] set pin [lindex $row $pin_name_column] if {$pin == $target_pin} { set result [lindex $row $info_column] } } } return $result}# ----------------------------------------------------------------#proc get_fitter_report_pin_info {target_pin info_type preferred_report_id {found_report_id_name ""}} {## Description: Gets the report field for the given pin by searching through the# input, output and bidir pin reports## ---------------------------------------------------------------- if {$found_report_id_name != ""} { upvar 1 $found_report_id_name found_report_id } set found_report_id -1 set result "" if {$preferred_report_id == -1} { set pin_report_list [list "Fitter||Resource Section||Bidir Pins" "Fitter||Resource Section||Input Pins" "Fitter||Resource Section||Output Pins"] for {set pin_report_index 0} {$pin_report_index != [llength $pin_report_list] && $result == ""} {incr pin_report_index} { set pin_report_id [get_report_panel_id [lindex $pin_report_list $pin_report_index]] if {$pin_report_id != -1} { set result [get_fitter_report_pin_info_from_report $target_pin $info_type $pin_report_id] if {$result != ""} { set found_report_id $pin_report_id } } } } else { set result [get_fitter_report_pin_info_from_report $target_pin $info_type $preferred_report_id] if {$result != ""} { set found_report_id $preferred_report_id } } return $result}# ----------------------------------------------------------------#proc get_io_interface_type {pin_list} {## Description: Gets the type of pin that the given pins are placed on# either (HPAD, VPAD, HYBRID, "", or UNKNOWN).# "" is returned if pin_list is empty# UNKNOWN is returned if an error was encountered# This function assumes the fitter has already completed and the# compiler report has been loaded.## ---------------------------------------------------------------- set preferred_report_id -1 set interface_type "" foreach target_pin $pin_list { set io_bank [get_fitter_report_pin_info $target_pin "I/O Bank" $preferred_report_id preferred_report_id] if {[regexp -- {^([0-9]+)[A-Z]*} $io_bank -> io_bank_number]} { if {$io_bank_number == 1 || $io_bank_number == 2 || $io_bank_number == 5 || $io_bank_number == 6} { # Row I/O if {$interface_type == ""} { set interface_type "HPAD" } elseif {$interface_type == "VIO"} { set interface_type "HYBRID" } } elseif {$io_bank_number == 3 || $io_bank_number == 4 || $io_bank_number == 7 || $io_bank_number == 8} { if {$interface_type == ""} { set interface_type "VPAD" } elseif {$interface_type == "HIO"} { set interface_type "HYBRID" } } else { post_message -type critical_warning "Unknown I/O bank $io_bank for pin $target_pin" # Asuume worst case performance (mixed HIO/VIO interface) set interface_type "HYBRID" } } } return $interface_type}# ----------------------------------------------------------------#proc get_io_standard {target_pin} {## Description: Gets the I/O standard of the given memory interface pin# This function assumes the fitter has already completed and the# compiler report has been loaded.## ---------------------------------------------------------------- # Look through the pin report set io_std [get_fitter_report_pin_info $target_pin "I/O Standard" -1] if {$io_std == ""} { return "UNKNOWN" } set result "" switch -exact -- $io_std { "SSTL-2 Class I" {set result "SSTL_2_I"} "Differential 2.5-V SSTL Class I" {set result "DIFF_SSTL_2_I"} "SSTL-2 Class II" {set result "SSTL_2_II"} "Differential 2.5-V SSTL Class II" {set result "DIFF_SSTL_2_II"} "SSTL-18 Class I" {set result "SSTL_18_I"} "Differential 1.8-V SSTL Class I" {set result "DIFF_SSTL_18_I"} "SSTL-18 Class II" {set result "SSTL_18_II"} "Differential 1.8-V SSTL Class II" {set result "DIFF_SSTL_18_II"} "SSTL-15 Class I" {set result "SSTL_15_I"} "Differential 1.5-V SSTL Class I" {set result "DIFF_SSTL_15_I"} "SSTL-15 Class II" {set result "SSTL_15_II"} "Differential 1.5-V SSTL Class II" {set result "DIFF_SSTL_15_II"} "1.8-V HSTL Class I" {set result "HSTL_18_I"} "Differential 1.8-V HSTL Class I" {set result "DIFF_HSTL_18_I"} "1.8-V HSTL Class II" {set result "HSTL_18_II"} "Differential 1.8-V HSTL Class II" {set result "DIFF_HSTL_18_II"} "1.5-V HSTL Class I" {set result "HSTL_15_I"} "Differential 1.5-V HSTL Class I" {set result "DIFF_HSTL_15_I"} "1.5-V HSTL Class II" {set result "HSTL_15_II"} "Differential 1.5-V HSTL Class II" {set result "DIFF_HSTL_15_II"} default { post_message -type error "Found unsupported Memory I/O standard $io_std on pin $target_pin" set result "UNKNOWN" } } return $result}# ----------------------------------------------------------------#proc get_input_oct_termination {target_pin} {## Description: Tells whether or not the given memory interface pin uses OCT# This function assumes the fitter has already completed and the# compiler report has been loaded.## ---------------------------------------------------------------- # Look through the pin reports set pin_report_id [get_report_panel_id "Fitter||Resource Section||Bidir Pins"] # Look through the output and bidir pin reports if {$pin_report_id == -1} { set termination "" } else { set termination [get_fitter_report_pin_info $target_pin "Input Termination" $pin_report_id] } if {$termination == ""} { set pin_report_id [get_report_panel_id "Fitter||Resource Section||Input Pins"] set termination [get_fitter_report_pin_info $target_pin "Termination" $pin_report_id] if {$termination == ""} { return "UNKNOWN" } } set result "OCT_OFF" switch -exact -glob -- $termination { "Off" {set result "OCT_OFF"} "OCT*" {set result "OCT_ON"} "Parallel *" {set result "OCT_ON"} default { post_message -type critical_warning "Found unsupported memory pin input termination $termination on pin $target_pin" set result "UNKNOWN" } } return $result}# ----------------------------------------------------------------#proc get_output_oct_termination {target_pin} {## Description: Tells whether or not the given memory interface pin uses OCT# This function assumes the fitter has already completed and the# compiler report has been loaded.## ---------------------------------------------------------------- set pin_report_id [get_report_panel_id "Fitter||Resource Section||Bidir Pins"] # Look through the output and bidir pin reports if {$pin_report_id == -1} { set termination "" } else { set termination [get_fitter_report_pin_info $target_pin "Output Termination" $pin_report_id] } if {$termination == ""} { set pin_report_id [get_report_panel_id "Fitter||Resource Section||Output Pins"] set termination [get_fitter_report_pin_info $target_pin "Termination" $pin_report_id] if {$termination == ""} { return "UNKNOWN" } } set result "OCT_OFF" switch -exact -glob -- $termination { "Off" {set result "OCT_OFF"} "OCT*" {set result "OCT_ON"} "Series *" {set result "OCT_ON"} default { post_message -type critical_warning "Found unsupported memory pin output termination $termination on pin $target_pin" set result "UNKNOWN" } } return $result}proc get_ddr_pins {instname pins_array_name} {
upvar 1 $pins_array_name pins
set corename "altmemddr_phy"
array unset pins_t
set dqsgroups 2
for {set i 0} {$i < $dqsgroups} {incr i} {
set dqs ${instname}_alt_mem_phy_ciii_inst|dpio|dqs\[$i\].dqs_ddio_out|dataout
set dq ${instname}_alt_mem_phy_ciii_inst|dpio|dqs_group\[$i\].dq\[*\].dq_ddio_out|dataout
set dm ${instname}_alt_mem_phy_ciii_inst|dpio|dm\[$i\].dm_ddio_out|dataout
set dqs_p [map_get_node_name [walk_to_pins fanout [get_pins -compatibility_mode $dqs]]]
set dqsn_p [list]
set dm_p [map_get_node_name [walk_to_pins fanout [get_pins -compatibility_mode $dm]]]
set dq_p [map_get_node_name [walk_to_pins fanout [get_pins -compatibility_mode $dq]]]
if { [llength $dqs_p] != 1} { post_sdc_message critical_warning "Could not find DQS pin number $i" }
if { [llength $dq_p] != 8} { post_sdc_message -type critical_warning "Could not find correct number of DQ pins for DQS pin $i. Found [llength $dq_p] pins. Expecting 8." }
if { [llength $dm_p] != 1} { post_sdc_message critical_warning "Could not find DM pin for DQS pin number $i" }
set dqsgroup [list [lindex $dqs_p 0] $dm_p $dq_p [lindex $dqsn_p 0]]
lappend pins_t(dqsgroup) $dqsgroup
}
set patterns [list]
lappend patterns addrcmd ${instname}_alt_mem_phy_ciii_inst|adc*|addr\[*\].addr_struct|full_rate.addr_pin|auto_generated|ddio_outa\[*\]|dataout
lappend patterns addrcmd ${instname}_alt_mem_phy_ciii_inst|adc*|ba\[*\].ba_struct|full_rate.addr_pin|auto_generated|ddio_outa\[*\]|dataout
lappend patterns addrcmd ${instname}_alt_mem_phy_ciii_inst|adc*|cas_n_struct|full_rate.addr_pin|auto_generated|ddio_outa\[*\]|dataout
lappend patterns addrcmd ${instname}_alt_mem_phy_ciii_inst|adc*|ras_n_struct|full_rate.addr_pin|auto_generated|ddio_outa\[*\]|dataout
lappend patterns addrcmd ${instname}_alt_mem_phy_ciii_inst|adc*|we_n_struct|full_rate.addr_pin|auto_generated|ddio_outa\[*\]|dataout
lappend patterns addrcmd ${instname}_alt_mem_phy_ciii_inst|adc*|cke\[*\].cke_struct|full_rate.addr_pin|auto_generated|ddio_outa\[0\]|dataout
lappend patterns addrcmd ${instname}_alt_mem_phy_ciii_inst|adc*|cs_n\[*\].cs_n_struct|full_rate.addr_pin|auto_generated|ddio_outa\[0\]|dataout
lappend patterns ck_p ${instname}_alt_mem_phy_ciii_inst|clk|DDR_CLK_OUT\[*\].ddr_clk_out_p|auto_generated|ddio_outa\[*\]|dataout
lappend patterns ck_n ${instname}_alt_mem_phy_ciii_inst|clk|DDR_CLK_OUT\[*\].ddr_clk_out_n|auto_generated|ddio_outa\[*\]|dataout
foreach {pin_type pattern} $patterns {
set ports [map_get_node_name [walk_to_pins fanout [get_pins -compatibility_mode $pattern]]]
if {[llength $ports] == 0} {
post_message -type critical_warning "Could not find pin of type $pin_type from pattern $pattern"
} else {
foreach port [lsort -unique $ports] {
lappend pins_t($pin_type) $port
}
}
}
set outputFileName "altmemddr_phy_autodetectedpins.tcl"
set f [open $outputFileName w]
foreach {k v} [array get pins_t] {
foreach vi $v {
ddr_pin $k $vi pins
puts $f "ddr_pin [list $k] [list $vi] pins"
}
}
close $f
}
set altmemddr_phy_use_high_performance_timing 1
if {[namespace which -variable ::override_altmemddr_phy_use_high_performance_timing] != ""} {
set altmemddr_phy_use_high_performance_timing $::override_altmemddr_phy_use_high_performance_timing
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?