mirror of
https://github.com/alexforencich/verilog-ethernet.git
synced 2025-01-28 07:03:08 +08:00
77 lines
3.0 KiB
Tcl
77 lines
3.0 KiB
Tcl
# Copyright (c) 2021 Alex Forencich
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
# in the Software without restriction, including without limitation the rights
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
# THE SOFTWARE.
|
|
|
|
set base_name {eth_xcvr_gt}
|
|
|
|
set preset {GTY-10GBASE-R}
|
|
|
|
set freerun_freq {125}
|
|
set line_rate {10.3125}
|
|
set refclk_freq {161.1328125}
|
|
set qpll_fracn [expr {int(fmod($line_rate*1000/2 / $refclk_freq, 1)*pow(2, 24))}]
|
|
set user_data_width {64}
|
|
set int_data_width $user_data_width
|
|
set extra_ports [list]
|
|
set extra_pll_ports [list {qpll0lock_out}]
|
|
|
|
set config [dict create]
|
|
|
|
dict set config TX_LINE_RATE $line_rate
|
|
dict set config TX_REFCLK_FREQUENCY $refclk_freq
|
|
dict set config TX_QPLL_FRACN_NUMERATOR $qpll_fracn
|
|
dict set config TX_USER_DATA_WIDTH $user_data_width
|
|
dict set config TX_INT_DATA_WIDTH $int_data_width
|
|
dict set config RX_LINE_RATE $line_rate
|
|
dict set config RX_REFCLK_FREQUENCY $refclk_freq
|
|
dict set config RX_QPLL_FRACN_NUMERATOR $qpll_fracn
|
|
dict set config RX_USER_DATA_WIDTH $user_data_width
|
|
dict set config RX_INT_DATA_WIDTH $int_data_width
|
|
dict set config ENABLE_OPTIONAL_PORTS $extra_ports
|
|
dict set config LOCATE_COMMON {CORE}
|
|
dict set config LOCATE_RESET_CONTROLLER {CORE}
|
|
dict set config LOCATE_TX_USER_CLOCKING {CORE}
|
|
dict set config LOCATE_RX_USER_CLOCKING {CORE}
|
|
dict set config LOCATE_USER_DATA_WIDTH_SIZING {CORE}
|
|
dict set config FREERUN_FREQUENCY $freerun_freq
|
|
dict set config DISABLE_LOC_XDC {1}
|
|
|
|
proc create_gtwizard_ip {name preset config} {
|
|
create_ip -name gtwizard_ultrascale -vendor xilinx.com -library ip -module_name $name
|
|
set ip [get_ips $name]
|
|
set_property CONFIG.preset $preset $ip
|
|
set config_list {}
|
|
dict for {name value} $config {
|
|
lappend config_list "CONFIG.${name}" $value
|
|
}
|
|
set_property -dict $config_list $ip
|
|
}
|
|
|
|
# variant with channel and common
|
|
dict set config ENABLE_OPTIONAL_PORTS [concat $extra_pll_ports $extra_ports]
|
|
dict set config LOCATE_COMMON {CORE}
|
|
|
|
create_gtwizard_ip "${base_name}_full" $preset $config
|
|
|
|
# variant with channel only
|
|
dict set config ENABLE_OPTIONAL_PORTS $extra_ports
|
|
dict set config LOCATE_COMMON {EXAMPLE_DESIGN}
|
|
|
|
create_gtwizard_ip "${base_name}_channel" $preset $config
|