set module_name "combpm_gtwizard"

# Create IP
create_ip -name gtwizard_ultrascale -vendor xilinx.com -library ip -version 1.7 -module_name ${module_name}

# Configure the IP
set_property -dict [list \
    CONFIG.CHANNEL_ENABLE {X0Y4} \
    CONFIG.TX_MASTER_CHANNEL {X0Y4} \
    CONFIG.RX_MASTER_CHANNEL {X0Y4} \
    CONFIG.TX_LINE_RATE {2.12} \
    CONFIG.TX_PLL_TYPE {QPLL1} \
    CONFIG.TX_REFCLK_FREQUENCY {156.2500001} \
    CONFIG.TX_DATA_ENCODING {8B10B} \
    CONFIG.TX_USER_DATA_WIDTH {16} \
    CONFIG.TX_INT_DATA_WIDTH {20} \
    CONFIG.TX_QPLL_FRACN_NUMERATOR {4563402} \
    CONFIG.RX_LINE_RATE {2.12} \
    CONFIG.RX_PLL_TYPE {QPLL1} \
    CONFIG.RX_REFCLK_FREQUENCY {156.2500001} \
    CONFIG.RX_DATA_DECODING {8B10B} \
    CONFIG.RX_USER_DATA_WIDTH {16} \
    CONFIG.RX_INT_DATA_WIDTH {20} \
    CONFIG.RX_QPLL_FRACN_NUMERATOR {4563402} \
    CONFIG.RX_JTOL_FC {1.2717457} \
    CONFIG.RX_COMMA_P_ENABLE {true} \
    CONFIG.RX_COMMA_M_ENABLE {true} \
    CONFIG.RX_COMMA_MASK {1111111111} \
    CONFIG.RX_COMMA_ALIGN_WORD {2} \
    CONFIG.RX_COMMA_SHOW_REALIGN_ENABLE {false} \
    CONFIG.RX_CC_NUM_SEQ {1} \
    CONFIG.RX_CC_LEN_SEQ {2} \
    CONFIG.RX_CC_VAL {00000000000000000000000000000000000000000000000000000000000000100101010010111100} \
    CONFIG.RX_CC_VAL_0_0 {10111100} \
    CONFIG.RX_CC_K_0_0 {true} \
    CONFIG.RX_CC_VAL_0_1 {10010101} \
    CONFIG.RX_CC_K_0_1 {true} \
    CONFIG.ENABLE_OPTIONAL_PORTS {rxcdrlock_out} \
    CONFIG.RX_REFCLK_SOURCE {X0Y4 clk1} \
    CONFIG.TX_REFCLK_SOURCE {X0Y4 clk1} \
    CONFIG.LOCATE_TX_USER_CLOCKING {CORE} \
    CONFIG.LOCATE_RX_USER_CLOCKING {CORE} \
    CONFIG.LOCATE_COMMON {EXAMPLE_DESIGN} \
    CONFIG.LOCATE_RESET_CONTROLLER {CORE} \
    CONFIG.LOCATE_USER_DATA_WIDTH_SIZING {CORE} \
    CONFIG.TXPROGDIV_FREQ_SOURCE {QPLL1} \
    CONFIG.TXPROGDIV_FREQ_VAL {106} \
    CONFIG.FREERUN_FREQUENCY {100} \
    CONFIG.SECONDARY_QPLL_ENABLE {true} \
    CONFIG.SECONDARY_QPLL_REFCLK_FREQUENCY {156.25} \
    ] [get_ips ${module_name}]

# If using 2 ports
# CONFIG.CHANNEL_ENABLE {X0Y4 X0Y5}
# CONFIG.RX_REFCLK_SOURCE {X0Y5 clk1 X0Y4 clk1}
# CONFIG.TX_REFCLK_SOURCE {X0Y5 clk1 X0Y4 clk1}


# Generate output products
generate_target all [get_ips ${module_name}]