package   require xilinx::board 1.0
namespace import ::xilinx::board::*
set mii_vlnv      "xilinx.com:interface:mii_rtl:1.0"
set gmii_vlnv     "xilinx.com:interface:gmii_rtl:1.0"
set rgmii_vlnv    "xilinx.com:interface:rgmii_rtl:1.0"
set mdio_vlnv     "xilinx.com:interface:mdio_io:1.0"
set c_family      [get_project_property ARCHITECTURE]
set c_part        [get_project_property PART]
set c_speedgrade  [get_project_property SPEEDGRADE]
set c_device      [get_project_property DEVICE]
set firstIndx     [string first $c_device $c_part ]
set firstIndx     [expr { $firstIndx+[string length $c_device]}]
set lastIndx      [string last $c_speedgrade $c_part ]
set lastIndx      [expr {$lastIndx-1}]
set c_package     [string range $c_part $firstIndx $lastIndx]

proc init_gui { IPINST PARAM_VALUE.Physical_Interface PARAM_VALUE.MAC_Speed} {
  set_property hide_disabled_pins true [ipgui::get_canvasspec -of $IPINST]
  set component_name  [ipgui::add_param  $IPINST -parent $IPINST -name Component_Name ]

  add_board_tab $IPINST -display_name {"ETHERNET_BOARD_INTERFACE" ETHERNET "MDIO_BOARD_INTERFACE" MDIO}

  set Data_Rate_tab [ipgui::add_page $IPINST -name "Data Rate" -parent $IPINST -layout horizontal] 
  set Data_Rate     [ipgui::add_param $IPINST -parent $Data_Rate_tab -name  Data_Rate -layout vertical ]
  ipgui::add_row $IPINST -parent $Data_Rate_tab
  ipgui::add_dynamic_text  $IPINST -name label_data_rate -parent $Data_Rate_tab  -tclproc DT_Data_Rate 

  if (![eval Supports2G5]) {
      set_property visible false $Data_Rate_tab 
  }
  set interface_tab [ipgui::add_page $IPINST -name "Interface" -parent $IPINST -layout horizontal]

  set Physical_Interface_grp [ipgui::add_group $IPINST -parent $interface_tab -name "Physical Interface"]
  set Physical_Interface [ipgui::add_param $IPINST -parent $Physical_Interface_grp -name  Physical_Interface -widget comboBox]
  ipgui::add_dynamic_text  $IPINST -name label_physical_interface -parent $Physical_Interface_grp  -tclproc DT_Physical_Interface
  set MAC_Speed [ipgui::add_param $IPINST -parent $Physical_Interface_grp -name  MAC_Speed -layout horizontal ]
  set MII_IO [ipgui::add_param $IPINST -parent $Physical_Interface_grp -name  MII_IO -layout horizontal ]
  set_property visible false $MII_IO
  ipgui::add_row $IPINST -parent $interface_tab
  set Int_Clk_Src   [ipgui::add_param $IPINST -parent $Physical_Interface_grp -name  Int_Clk_Src    -layout horizontal -widget radioGroup]
  set Int_Mode_Type [ipgui::add_param $IPINST -parent $Physical_Interface_grp -name  Int_Mode_Type  -layout horizontal -widget radioGroup]
  set_property visible false $Int_Mode_Type

  set Management_Interface [ipgui::add_param $IPINST -parent $interface_tab -name  Management_Interface -layout horizontal]
  ipgui::add_row $IPINST -parent $interface_tab 
  set Management_Frequency [ipgui::add_param $IPINST -parent $interface_tab -name  Management_Frequency -layout vertical]
  set_property display_name "  AXI4-Lite Frequency (MHz)" $Management_Frequency 
  ipgui::add_row $IPINST -parent $interface_tab
  set Enable_MDIO [ipgui::add_param $IPINST -parent $interface_tab -name  Enable_MDIO ]
  set Make_MDIO_External [ipgui::add_param $IPINST -parent $interface_tab -name  Make_MDIO_External ]


  set shared_logic_tab [ipgui::add_page $IPINST -name "Shared Logic"]


  set SupportLevel  [ipgui::add_param $IPINST -parent $shared_logic_tab -name SupportLevel -widget radioGroup]
  set sharedLogicString [DT_Support_Level $Physical_Interface PROJECT_PARAM.ARCHITECTURE ]
  set_property Description $sharedLogicString [ipgui::get_guiparamspec SupportLevel -of $IPINST]

  set shared_logic_info_group [ipgui::add_group $IPINST -parent $shared_logic_tab -name "Shared Logic Overview" -layout vertical]
  ipgui::add_dynamic_text $IPINST -name label_shared_logic -parent $shared_logic_info_group  -tclproc DT_Shared_Logic
  ipgui::add_image $IPINST -name PixmapAFix2 -parent $shared_logic_info_group -width 400 -height 400
  set_property load_image "xgui/without_shared_logic.png" [ipgui::get_imagespec PixmapAFix2 -of $IPINST]


  set features_tab [ipgui::add_page $IPINST -name "Features" -parent $IPINST -layout vertical]

  set Options_grp  [ipgui::add_group $IPINST -parent $features_tab -name "MAC Options" -layout vertical]
  set Half_Duplex [ipgui::add_param $IPINST -parent $Options_grp -name  Half_Duplex ]
  ipgui::add_row $IPINST -parent $features_tab

  set AVB_grp  [ipgui::add_group $IPINST -parent $features_tab -name "AVB Options" -layout vertical]
  set Enable_AVB [ipgui::add_param $IPINST -parent $AVB_grp -name  Enable_AVB]
  ipgui::add_static_text  $IPINST -name label_avb -parent $AVB_grp -text "The Ethernet AVB feature requires a separate fee based license and is not available with the MII I/F or 2.5 Gbps ."
  ipgui::add_row $IPINST -parent $features_tab

  set Frame_Filter_grp  [ipgui::add_group $IPINST -parent $features_tab -name "Frame Filter Options" -layout vertical]
  set Frame_Filter [ipgui::add_param $IPINST -parent $Frame_Filter_grp -name  Frame_Filter ]
  set Number_of_Table_Entries [ipgui::add_param $IPINST -parent $Frame_Filter_grp -name  Number_of_Table_Entries ]
  ipgui::add_row $IPINST -parent $features_tab

  set Flow_Control_grp  [ipgui::add_group $IPINST -parent $features_tab -name "Flow Control Options" -layout vertical]
  set Enable_Priority_Flow_Control [ipgui::add_param $IPINST -parent $Flow_Control_grp -name  Enable_Priority_Flow_Control ]

  set Statistics_Counter_panel [ipgui::add_panel  $IPINST -parent $features_tab -name Statistics_Counter_panel -layout horizontal]
  set Statistics_Counter_grp   [ipgui::add_group $IPINST -parent $Statistics_Counter_panel -name "Statistics Counter Options" -layout horizontal -header_param "Statistics_Counters"]
  set Statistics_Width [ipgui::add_param $IPINST -parent $Statistics_Counter_grp -name  Statistics_Width  -widget comboBox]
  set_property display_name "Statistics Width" $Statistics_Width
  ipgui::add_static_text $IPINST  -name internal_prec_text2 -parent $Statistics_Counter_grp -text "      &nbsp;&nbsp;&nbsp;"
  ipgui::add_row $IPINST -parent $Statistics_Counter_grp
  set Statistics_Reset [ipgui::add_param $IPINST -parent $Statistics_Counter_grp -name  Statistics_Reset ]

  set Options_1588_grp  [ipgui::add_group $IPINST -parent $features_tab -name "Network Timing Options" -layout vertical]
  set Enable_1588 [ipgui::add_param $IPINST -parent $Options_1588_grp -name  Enable_1588 ]
  set Enable_1588_1step [ipgui::add_param $IPINST -parent $Options_1588_grp -name  Enable_1588_1step ]
  set Timer_Format [ipgui::add_param $IPINST -parent $Options_1588_grp -name  Timer_Format -layout horizontal ]
  set TX_Inband_CF_Enable [ipgui::add_param $IPINST -parent $Options_1588_grp -name TX_Inband_CF_Enable -layout horizontal ]
  set RX_Inband_TS_Enable [ipgui::add_param $IPINST -parent $Options_1588_grp -name RX_Inband_TS_Enable -layout horizontal ]
  set_property visible false $Options_1588_grp

  set_property tooltip "Configures the MAC Duplex abilities" $Half_Duplex
  # set_property tooltip "Configures the Statistics Counteers abilities" $Statistics_Counters
  set_property tooltip "Configures the Management Interface type" $Management_Interface
  set_property tooltip "Audio Video Bridging support (802.1)" $Enable_AVB
  set_property tooltip "Configures the MAC Frame Filter abilities" $Frame_Filter
  set_property tooltip "The number of Table Entries (0 to 16)" $Number_of_Table_Entries
  set_property tooltip "Configures the MAC Ethernet speed abilities" $Physical_Interface
  set_property tooltip "Configures the Physical Interface" $MAC_Speed
  set_property tooltip "Configures the Statistics Counteers Reset" $Statistics_Reset
  set_property tooltip "Configures the Statistics counters width" $Statistics_Width
  set_property tooltip "Enables the 1588 feature" $Enable_1588
  set_property tooltip "The core will include 1-step 1588 support (2-step support is always included)" $Enable_1588_1step
  set_property tooltip "Send the TX Command Field In-Band or Out-of-Band" $TX_Inband_CF_Enable
  set_property tooltip "Send the RX TimeStamp In-Band or Out-of-Band" $RX_Inband_TS_Enable
  set_property tooltip "Select the location of shareable logic" $SupportLevel
  set_property tooltip "Enables the PFC feature" $Enable_Priority_Flow_Control
  set_property tooltip "Enables the MDIO Interface" $Enable_MDIO
  set_property tooltip "Inserts IO_Buffers for MDIO Interface ports" $Make_MDIO_External
  set_property tooltip "Configures the MAC Data Rate" $Data_Rate
  set_property tooltip "This specifies the frequency (in MHz) of the AXI4-Lite interface.  This is used to provide a default value for synthesis and will be overridden based on connectivity in a system.." $Management_Frequency
}

proc init_meta_params {IPINST} {
    add_meta_param $IPINST -name parameter_c_family -type string
}

proc update_parameter_c_family {PARAM_VALUE.Data_Rate PARAM_VALUE.ETHERNET_BOARD_INTERFACE PROJECT_PARAM.ARCHITECTURE} {
  set val [get_metaparam_value parameter_c_family]
  return [incr $val]
}

proc DT_Data_Rate {IPINST PARAM_VALUE.Data_Rate PARAM_VALUE.ETHERNET_BOARD_INTERFACE} { 
  set Data_Rate   [get_property value ${PARAM_VALUE.Data_Rate}]
  set boardIfName [get_property value ${PARAM_VALUE.ETHERNET_BOARD_INTERFACE}]

  if {$Data_Rate == "2.5_Gbps"} {
    set text    "2.5 Gbps is available only in Physical Interface Internal for device which do not belong to Artix-7/Spartan-7 low-speed/low-Voltage families\n"
    append text "AVB feature is not available in 2.5 Gbps\n\n"
  } elseif {$boardIfName != "Custom"} {
    set text "2.5 Gbps is available only when Ethernet Board Interface is set to Custom\n\n"
  } else {
    set text ""
  }
  return $text
}

proc init_params {PARAM_VALUE.Physical_Interface PARAM_VALUE.Data_Rate PROJECT_PARAM.ARCHITECTURE PROJECT_PARAM.PART PROJECT_PARAM.SPEEDGRADE PARAM_VALUE.Management_Interface PARAM_VALUE.MDIO_BOARD_INTERFACE PARAM_VALUE.ETHERNET_BOARD_INTERFACE PROJECT_PARAM.DEVICE MODELPARAM_VALUE.C_PHYSICAL_INTERFACE IPINST } {
  set c_family   [get_project_property ARCHITECTURE]
  set c_device   [get_project_property DEVICE]
  set Management_Interface [get_property value ${PARAM_VALUE.Management_Interface}]
  set c_package [getpackage_name [get_project_property PART] [get_project_property SPEEDGRADE] [get_project_property DEVICE]]
  set Data_Rate [get_property value ${PARAM_VALUE.Data_Rate}]

  set param_range [get_board_interface_param_range $IPINST -name "MDIO_BOARD_INTERFACE"]
  set param_value_range [join [lsort -unique [split $param_range ","]] ","]
  if {[llength [split $param_value_range ","]] > 1} {
      set_property range $param_value_range ${PARAM_VALUE.MDIO_BOARD_INTERFACE}
  }

  set param_range [get_board_interface_param_range $IPINST -name "ETHERNET_BOARD_INTERFACE"]
  set param_value_range [join [lsort -unique [split $param_range ","]] ","]
  if {[llength [split $param_value_range ","]] > 1} {
      set_property range $param_value_range ${PARAM_VALUE.ETHERNET_BOARD_INTERFACE}
  }
}

proc Supports2G5 {} {
  set c_family      [get_project_property ARCHITECTURE]
  set c_part        [get_project_property PART]
  set c_speedgrade  [get_project_property SPEEDGRADE]
  set c_device      [get_project_property DEVICE]
  set firstIndx     [string first $c_device $c_part ]
  set firstIndx     [expr { $firstIndx+[string length $c_device] } ]
  set lastIndx      [string last $c_speedgrade $c_part ]
  set lastIndx      [expr {$lastIndx-1}]
  set c_package     [string range $c_part $firstIndx $lastIndx]

  # Check if VIVADO_PROJECT_FAMILY is Zynq; UltraScale+ is not checked because as of now it has only Kintex UltraScale fabric
  set c_is_zynq   [expr {( [string equal -nocase $c_family "zynq"] || [string equal -nocase $c_family "azynq"] || [string equal -nocase $c_family "qzynq"] )?true:false}]
  # Amongst Zynq devices check which all have A7 Fabric
  set c_is_zynqa  [expr {( $c_is_zynq&&(( [string first "z010" $c_device 0]!= -1) ||( [string first "z015" $c_device 0]!= -1) ||( [string first "z020" $c_device 0]!= -1) ) )?true:false}] 
  # Finally all the devices which are A7 and also those which have A7 fabric
  set c_is_artix7 [expr {( [string equal -nocase $c_family "aartix7"]|| [string equal -nocase $c_family "artix7"]|| [string equal -nocase $c_family "qartix7"]|| [string equal -nocase $c_family "artix7l"]|| $c_is_zynqa )?true:false}]
  # Check for Spartan-7
  set c_is_spartan7 [expr {( [string equal -nocase $c_family "spartan7"] )?true:false}]

  # Check if devices belong to low-speed grade familes in A7: -1 (and all the variants), -2L and -2I 
  set c_is_low_speedgrade [expr {( [regexp -nocase -- "-1" $c_speedgrade] || [regexp -nocase -- "-2I" $c_speedgrade]) ? true:false}]

  if {($c_is_artix7 || $c_is_spartan7) && $c_is_low_speedgrade} {
    return false
  } else {
    return true
  }
}

proc DT_Physical_Interface {IPINST PARAM_VALUE.Physical_Interface} {
  variable c_family
  variable c_package
  variable c_device
  set Physical_Interface [get_property value ${PARAM_VALUE.Physical_Interface} ]
  switch -- $c_family {
    "virtex7" -
    "qvirtex7" {
        if {$Physical_Interface == "GMII"} {
          set text "WARNING: The selected Part/Package has 1.8V IO only and does not natively support GMII"
        } elseif {$Physical_Interface == "RGMII"} {
          set text "RGMII v2.0 is supported at 1.8V, please check PHY compatibility"
        } elseif {$Physical_Interface == "Internal"} {
          set text "The Example Design will not implement a Physical Interface"
        } else {
          set text "WARNING: The selected Part/Package has 1.8V IO only and does not natively support MII"
        }
        if { [regexp -nocase -- {.*ffg1761.*} $c_package] == 1} {
          if { [regexp -nocase -- {.+(vx330|v585).+} $c_device] == 1} {
            if {$Physical_Interface == "GMII"} {
              set text "A subset of IO supports 2.5V/3.3V GMII in the selected Part/Package"
            } elseif {$Physical_Interface == "RGMII"} {
              set text "RGMII v2.0 is supported at 1.8V, please check PHY compatibility"
            } elseif {$Physical_Interface == "Internal"} {
              set text "The Example Design will not implement a Physical Interface"
            } else {
              set text "A subset of IO supports 2.5V/3.3V MII in the selected Part/Package"
            }
          }
        }
    }
    default {
      if {$Physical_Interface == "GMII"} {
        set text "The Example Design will implement a GMII Interface"
      } elseif {$Physical_Interface == "RGMII"} {
        set text "The Example Design will implement a RGMII (Version 2.0) Interface"
      } elseif {$Physical_Interface == "Internal"} {
        set text "The Example Design will not implement a Physical Interface"
      } else {
        set text "The Example Design will implement a MII Interface"
      }
    }
  }
  return $text
}

proc DT_Support_Level { PARAM_VALUE.Physical_Interface PROJECT_PARAM.ARCHITECTURE } {
  set Physical_Interface [get_property value ${PARAM_VALUE.Physical_Interface}] 
  if {$Physical_Interface == "GMII"} {
    set text "For GMII, select whether the IDELAYCTRL is included in the core itself or in the example design."
  } elseif {$Physical_Interface == "RGMII"} {
    set text "For RGMII, select  whether the IDELAYCTRL (and the Tx MMCM with its associated clock buffers for\nArtix-7 or Kintex-7 or Spartan-7 devices) are included in the core itself or in the example design."
  } elseif {$Physical_Interface == "MII"} {
    set text "There is no shareable logic for MII."
  } elseif {$Physical_Interface == "Internal"} {
    set text "There is no shareable logic for the Internal interface."
  } else {
    set text ""
  }
  return $text
}

proc DT_Shared_Logic {IPINST PARAM_VALUE.SupportLevel} {
  set SupportLevel [get_property value ${PARAM_VALUE.SupportLevel}]
  
  if {$SupportLevel == 1} {
    set    text "Include Shared Logic in core\n"
    append text "- For users who want a complete single solution.\n"
    append text "- For users who want one core with shared logic to drive multiple cores without shared logic.\n\n\n"
    set_property load_image "xgui/with_shared_logic.png" [ipgui::get_imagespec PixmapAFix2 -of $IPINST]
  } else {
    set    text "Include Shared Logic in example design\n"
    append text "- For users who want the Shared Logic outside the core.\n"
    append text "- For users who want to edit the shared logic or use their own.\n"
    append text "- For users who want one core with shared logic to drive multiple cores without shared logic.\n\n"
    set_property load_image "xgui/without_shared_logic.png" [ipgui::get_imagespec PixmapAFix2 -of $IPINST]
  }
  return $text
}

proc update_PARAM_VALUE.Data_Rate { PARAM_VALUE.Data_Rate PARAM_VALUE.ETHERNET_BOARD_INTERFACE PROJECT_PARAM.ARCHITECTURE} {
  set boardIfName [ get_property value ${PARAM_VALUE.ETHERNET_BOARD_INTERFACE} ]
  if {$boardIfName ne "Custom" } {
    set_property enabled false    ${PARAM_VALUE.Data_Rate}
    set_property value   "1_Gbps" ${PARAM_VALUE.Data_Rate}
  } else {
    if ([Supports2G5]) {
      set_property enabled true  ${PARAM_VALUE.Data_Rate}
    } else {
      set_property enabled false    ${PARAM_VALUE.Data_Rate}
    }
  }
}

proc SupportsGMII {} {
  set c_family [get_project_property ARCHITECTURE] 
  set c_part        [get_project_property PART]
  set c_device      [get_project_property DEVICE]
  set c_speedgrade  [get_project_property SPEEDGRADE]
  set firstIndx     [string first $c_device $c_part ]
  set firstIndx     [expr { $firstIndx+[string length $c_device] } ]
  set lastIndx      [string last $c_speedgrade $c_part ]
  set lastIndx      [expr {$lastIndx-1}]
  set c_package     [string range $c_part $firstIndx $lastIndx]

  switch -- $c_family {
   "virtex7"   {
      if { [regexp -nocase -- {.*ffg1761.*} $c_package] == 1} {
        if { [regexp -nocase -- {.+(vx330|v585).+} $c_device] == 1} {
           return true
        } else {
           return false
        }
      } else {
        return false
      }
   }
   default { return true }
  }
}


proc update_PARAM_VALUE.Physical_Interface { PARAM_VALUE.Physical_Interface PROJECT_PARAM.SPEEDGRADE PROJECT_PARAM.PART PROJECT_PARAM.DEVICE PARAM_VALUE.Data_Rate PARAM_VALUE.ETHERNET_BOARD_INTERFACE PROJECT_PARAM.ARCHITECTURE IPINST} {
  set mii_vlnv            "xilinx.com:interface:mii_rtl:1.0"
  set gmii_vlnv           "xilinx.com:interface:gmii_rtl:1.0"
  set rgmii_vlnv          "xilinx.com:interface:rgmii_rtl:1.0"
  set c_family            [get_project_property ARCHITECTURE]
  set parameter_c_family  [get_metaparam_value parameter_c_family]


  if {$parameter_c_family == "1"} {
    if ([SupportsGMII]) {
        set_property  range_value GMII,RGMII,GMII,MII,Internal ${PARAM_VALUE.Physical_Interface}
    } else {
        set_property  range_value RGMII,RGMII,GMII,MII,Internal ${PARAM_VALUE.Physical_Interface}
    }
  }

  set boardIfName [ get_property value ${PARAM_VALUE.ETHERNET_BOARD_INTERFACE} ]
  if {$boardIfName ne "Custom" } {
    set_property enabled false  ${PARAM_VALUE.Physical_Interface}
    set vlnv [get_property VLNV [get_board_part_interfaces $boardIfName] ]
    if {$vlnv == $mii_vlnv } {
      set_property value   "MII"   ${PARAM_VALUE.Physical_Interface}
    } elseif { $vlnv == $gmii_vlnv } {
      set_property value   "GMII"  ${PARAM_VALUE.Physical_Interface}
    } elseif { $vlnv == $rgmii_vlnv } {
      set_property value   "RGMII" ${PARAM_VALUE.Physical_Interface}
    }
  } else {
    if ([Supports2G5]) {
      set_property enabled true  ${PARAM_VALUE.Physical_Interface}
    }
    set Data_Rate [get_property value ${PARAM_VALUE.Data_Rate}]
    if {$Data_Rate == "2.5_Gbps"} {
      set_property enabled false        ${PARAM_VALUE.Physical_Interface}
      set_property value   "Internal"   ${PARAM_VALUE.Physical_Interface}
    } else {
      set_property enabled true ${PARAM_VALUE.Physical_Interface}
    }  

  }
}

proc update_PARAM_VALUE.Int_Mode_Type {PARAM_VALUE.Int_Mode_Type PARAM_VALUE.ETHERNET_BOARD_INTERFACE PARAM_VALUE.Physical_Interface} {
   set boardIfName [ get_property value ${PARAM_VALUE.ETHERNET_BOARD_INTERFACE} ]
  if {$boardIfName ne "Custom" } {

  } else {
    set Physical_Interface  [get_property value ${PARAM_VALUE.Physical_Interface}]  
    set Int_Mode_Type       [get_property value ${PARAM_VALUE.Int_Mode_Type}]  
    if {$Physical_Interface != "Internal"} {
      set_property value  "BASEX" ${PARAM_VALUE.Int_Mode_Type}
    }
  } 
}

proc update_PARAM_VALUE.MAC_Speed { PARAM_VALUE.MAC_Speed PARAM_VALUE.Physical_Interface PARAM_VALUE.Data_Rate } {
      set Data_Rate           [get_property value ${PARAM_VALUE.Data_Rate} ]
      set Physical_Interface  [get_property value ${PARAM_VALUE.Physical_Interface} ]
      set MAC_Speed           ${PARAM_VALUE.MAC_Speed}

      if {$Physical_Interface  == "MII"} {
        set_property enabled false $MAC_Speed
        set_property range_value 10_100_Mbps,10_100_Mbps $MAC_Speed
      } elseif {$Physical_Interface  == "Internal"} {
        if {$Data_Rate == "2.5_Gbps"} {
          set_property enabled false $MAC_Speed
          set_property range_value 2500_Mbps,2500_Mbps $MAC_Speed
        } else {    
          set_property enabled true $MAC_Speed
          set_property range_value Tri_speed,Tri_speed,1000_Mbps $MAC_Speed
          if { [get_property value ${PARAM_VALUE.MAC_Speed}] == "10_100_Mbps"} {
            set_property value "Tri_speed" $MAC_Speed
          }
        }
      } elseif {$Physical_Interface  == "GMII"} {
        set_property enabled true $MAC_Speed
        set_property range_value Tri_speed,Tri_speed,1000_Mbps $MAC_Speed
        if { [get_property value ${PARAM_VALUE.MAC_Speed}] == "10_100_Mbps"} {
          set_property value "Tri_speed" $MAC_Speed
        }
      } elseif {$Physical_Interface  == "RGMII"} {
        set_property enabled true $MAC_Speed
        set_property range_value Tri_speed,Tri_speed,1000_Mbps $MAC_Speed
        if { [get_property value ${PARAM_VALUE.MAC_Speed}] == "10_100_Mbps"} {
          set_property value "Tri_speed" $MAC_Speed
        }
      } else {
        set_property enabled true $MAC_Speed
        set_property default_value "Tri_speed" $MAC_Speed
        if { [get_property value ${PARAM_VALUE.MAC_Speed}] == "10_100_Mbps"} {
          set_property value "Tri_speed" $MAC_Speed
        }
        set_property range Tri_speed,1000_Mbps $MAC_Speed
      }

}

proc update_gui_for_PARAM_VALUE.MAC_Speed { PARAM_VALUE.MAC_Speed PARAM_VALUE.Physical_Interface PARAM_VALUE.Data_Rate IPINST} {
  set Int_Clk_Src [ipgui::get_guiparamspec Int_Clk_Src -of $IPINST]
  if {[get_property value ${PARAM_VALUE.Physical_Interface}] == "Internal" && [get_property value ${PARAM_VALUE.MAC_Speed}] != "2500_Mbps"} { 
    set_property visible true $Int_Clk_Src
  } else {
    set_property visible false $Int_Clk_Src
  }
}

proc update_PARAM_VALUE.Half_Duplex { PARAM_VALUE.Half_Duplex PARAM_VALUE.Physical_Interface} {
  set Physical_Interface  [get_property value ${PARAM_VALUE.Physical_Interface}]
  set Half_Duplex         ${PARAM_VALUE.Half_Duplex}

  if {$Physical_Interface  == "Internal"} {
    set_property  enabled false $Half_Duplex
    set_property  value  false $Half_Duplex
  } else {
    set_property  enabled true $Half_Duplex
  }
}

proc update_PARAM_VALUE.Management_Frequency { PARAM_VALUE.Management_Frequency PARAM_VALUE.Management_Interface } {
  set Management_Interface [get_property value ${PARAM_VALUE.Management_Interface}]
  set Management_Frequency ${PARAM_VALUE.Management_Frequency}

  if {$Management_Interface == false} {
    set_property enabled false $Management_Frequency
  } else {
    set_property enabled true $Management_Frequency
  }

}

proc update_PARAM_VALUE.Management_Interface { PARAM_VALUE.Management_Interface PARAM_VALUE.MDIO_BOARD_INTERFACE PROJECT_PARAM.ARCHITECTURE} {
  set Management_Interface [get_property value ${PARAM_VALUE.Management_Interface}]
  set Management_Interface ${PARAM_VALUE.Management_Interface}
  set parameter_c_family [get_metaparam_value parameter_c_family]
  if {$parameter_c_family == "1"} {
    set boardIfName [ get_property value ${PARAM_VALUE.MDIO_BOARD_INTERFACE} ]
    if {$boardIfName ne "Custom" } {
      set_property enabled false  ${PARAM_VALUE.Management_Interface} 
      set_property value   true   ${PARAM_VALUE.Management_Interface} 
    } else {
      set_property enabled true   ${PARAM_VALUE.Management_Interface} 
    }
  }
}

proc update_PARAM_VALUE.Enable_MDIO { PARAM_VALUE.Enable_MDIO PARAM_VALUE.MDIO_BOARD_INTERFACE PARAM_VALUE.Management_Interface } {
    set boardIfName          [get_property value ${PARAM_VALUE.MDIO_BOARD_INTERFACE}]
    set Management_Interface [get_property value ${PARAM_VALUE.Management_Interface}]
    set Enable_MDIO          ${PARAM_VALUE.Enable_MDIO}

    if { $Management_Interface == false } {
      set_property enabled false $Enable_MDIO
      set_property value   false $Enable_MDIO 
    } else {
      set_property value   true   $Enable_MDIO
      if { $boardIfName ne "Custom" } {
        set_property enabled false $Enable_MDIO 
      } else {
        set_property enabled true $Enable_MDIO 
      }
    }
}

proc update_PARAM_VALUE.Make_MDIO_External { PARAM_VALUE.Make_MDIO_External PARAM_VALUE.Enable_MDIO PARAM_VALUE.MDIO_BOARD_INTERFACE PARAM_VALUE.Management_Interface PARAM_VALUE.Physical_Interface PROJECT_PARAM.ARCHITECTURE IPINST } {
    set boardIfName          [get_property value ${PARAM_VALUE.MDIO_BOARD_INTERFACE}]
    set Management_Interface [get_property value ${PARAM_VALUE.Management_Interface}]
    set EnableMDIO           [get_property value ${PARAM_VALUE.Enable_MDIO}]
    set Physical_Interface   [get_property value ${PARAM_VALUE.Physical_Interface}]
    set Make_MDIO_External   ${PARAM_VALUE.Make_MDIO_External}

    if {$Management_Interface == false || $EnableMDIO == false} {
      set_property enabled false  $Make_MDIO_External
      set_property value   false  $Make_MDIO_External 
    } elseif {$boardIfName ne "Custom"} {
      set_property enabled false  $Make_MDIO_External 
      set mdio_vlnv   "xilinx.com:interface:mdio_io:1.0"
      set mdio_r_vlnv "xilinx.com:interface:mdio_rtl:1.0"
      set vlnv [get_property VLNV [get_board_part_interfaces $boardIfName] ]
      if {$vlnv == $mdio_vlnv} {
        set_property value   true   $Make_MDIO_External 
      } elseif {$vlnv == $mdio_r_vlnv} {
        set_property value   false   $Make_MDIO_External
      }
    } else {
      set_property enabled true   $Make_MDIO_External 
      if { $Physical_Interface == "Internal"} {
        set_property value   false  $Make_MDIO_External 
      } else {
        set_property value   true   $Make_MDIO_External 
      }
    }    
}

proc update_PARAM_VALUE.Number_of_Table_Entries { PARAM_VALUE.Number_of_Table_Entries PARAM_VALUE.Management_Interface PARAM_VALUE.Frame_Filter IPINST} {
  set Management_Interface    [get_property value ${PARAM_VALUE.Management_Interface}]
  set Frame_Filter            [get_property value ${PARAM_VALUE.Frame_Filter}]
  set Number_of_Table_Entries ${PARAM_VALUE.Number_of_Table_Entries}

  if {$Management_Interface  == false || $Frame_Filter == false} {
    set_property  enabled false $Number_of_Table_Entries
    set_property  value 0 $Number_of_Table_Entries
  } else {
    set_property  enabled true $Number_of_Table_Entries
    set_property  value 4 $Number_of_Table_Entries
  }

}

proc update_PARAM_VALUE.Statistics_Counters { PARAM_VALUE.Statistics_Counters PARAM_VALUE.Data_Rate PARAM_VALUE.Management_Interface IPINST} {
  set Management_Interface  [get_property value ${PARAM_VALUE.Management_Interface} ]
  set Statistics_Counters   ${PARAM_VALUE.Statistics_Counters}

  if {$Management_Interface == false} {
    set_property  enabled false $Statistics_Counters
    set_property  value   false $Statistics_Counters
  } else {
    set_property  enabled true $Statistics_Counters
    set_property  value   true $Statistics_Counters
  }
}

proc update_PARAM_VALUE.Statistics_Reset { PARAM_VALUE.Statistics_Reset PARAM_VALUE.Data_Rate PARAM_VALUE.Management_Interface PARAM_VALUE.Statistics_Counters IPINST} {
  set Statistics_Reset ${PARAM_VALUE.Statistics_Reset}

  if { [get_property value ${PARAM_VALUE.Statistics_Counters}] == false || [get_property value ${PARAM_VALUE.Management_Interface}] == false} {
    set_property enabled false $Statistics_Reset
  } else {
    set_property enabled true $Statistics_Reset
  }
}

proc update_PARAM_VALUE.Statistics_Width { PARAM_VALUE.Statistics_Width PARAM_VALUE.Data_Rate PARAM_VALUE.Management_Interface PARAM_VALUE.Statistics_Counters IPINST} {
  set Management_Interface  [get_property value ${PARAM_VALUE.Management_Interface} ]
  set Statistics_Width      ${PARAM_VALUE.Statistics_Width}

  if { [get_property value ${PARAM_VALUE.Statistics_Counters}] == false || $Management_Interface == false} {
    set_property  enabled false $Statistics_Width
    set_property  enabled false $Statistics_Width
  } else {
    set_property  enabled true $Statistics_Width
    set_property  enabled true $Statistics_Width
  }
}

proc update_PARAM_VALUE.Enable_AVB { PARAM_VALUE.Enable_AVB PARAM_VALUE.Half_Duplex PARAM_VALUE.Data_Rate PARAM_VALUE.Physical_Interface PARAM_VALUE.Management_Interface } {
  set Data_Rate             [get_property value ${PARAM_VALUE.Data_Rate}]
  set Physical_Interface             [get_property value ${PARAM_VALUE.Physical_Interface}]
  set Management_Interface  [get_property value ${PARAM_VALUE.Management_Interface}]
  set Half_Duplex           [get_property value ${PARAM_VALUE.Half_Duplex}]
  set Enable_AVB            ${PARAM_VALUE.Enable_AVB}

  if {$Data_Rate == "2.5_Gbps" || $Management_Interface  == false || $Half_Duplex == true || $Physical_Interface == "MII"} {
    set_property  enabled false $Enable_AVB
    set_property  value false $Enable_AVB
  } else {
     set_property  enabled true $Enable_AVB
  }
}

proc update_PARAM_VALUE.Enable_1588 { PARAM_VALUE.Enable_1588 PARAM_VALUE.Enable_AVB IPINST} {
  set Enable_AVB  [get_property value ${PARAM_VALUE.Enable_AVB}]
  set Enable_1588 ${PARAM_VALUE.Enable_1588}

  if {$Enable_AVB  == true } {
    set_property  enabled false $Enable_1588
    set_property  value   true  $Enable_1588
  } else {
    set_property  enabled true  $Enable_1588
    set_property  value   false $Enable_1588
  }
}

proc update_PARAM_VALUE.MII_IO {PARAM_VALUE.MII_IO PARAM_VALUE.SupportLevel PARAM_VALUE.Physical_Interface IPINST} {

  set MII_IO ${PARAM_VALUE.MII_IO}
  set Physical_Interface     [get_property value ${PARAM_VALUE.Physical_Interface} ]
  if {$Physical_Interface == "MII"  } {
    set_property  enabled true $MII_IO
  } else {
    set_property  enabled false  $MII_IO
}}

proc update_PARAM_VALUE.Enable_1588_1step { PARAM_VALUE.Enable_1588_1step PARAM_VALUE.Enable_1588 PARAM_VALUE.Enable_AVB IPINST} {
  set Enable_AVB          [get_property value ${PARAM_VALUE.Enable_AVB}]
  set Enable_1588         [get_property value ${PARAM_VALUE.Enable_1588}]
  set Enable_1588_1step   ${PARAM_VALUE.Enable_1588_1step}

  if {$Enable_AVB == true} {
    set_property enabled false $Enable_1588_1step
    set_property value   false $Enable_1588_1step
  } else {
    if {$Enable_1588  == false } {
      set_property enabled false $Enable_1588_1step
      set_property value   false $Enable_1588_1step
    } else {
      set_property  enabled true $Enable_1588_1step
      set_property  value   true $Enable_1588_1step
    }
  }
}

proc update_PARAM_VALUE.Timer_Format { PARAM_VALUE.Timer_Format PARAM_VALUE.Enable_1588 PARAM_VALUE.Enable_AVB} {
  set Enable_AVB  [ get_property value ${PARAM_VALUE.Enable_AVB} ]
  set Enable_1588 [ get_property value ${PARAM_VALUE.Enable_1588} ]
  set Timer_Format  ${PARAM_VALUE.Timer_Format} 
  if {$Enable_AVB == true} {
      set_property  enabled false $Timer_Format
      set_property  value "Time_of_day" $Timer_Format
  } else {
      if {$Enable_1588  == false } {
          set_property  enabled false $Timer_Format
          set_property  value "Time_of_day" $Timer_Format
      } else {
          set_property  enabled true $Timer_Format
          set_property  value "Time_of_day" $Timer_Format
      }
  }
}

proc update_PARAM_VALUE.SupportLevel { PARAM_VALUE.SupportLevel PARAM_VALUE.Physical_Interface PROJECT_PARAM.ARCHITECTURE IPINST} {
  set Physical_Interface     [get_property value ${PARAM_VALUE.Physical_Interface} ]
  set c_family               [get_project_property ARCHITECTURE ]
  set SupportLevel           ${PARAM_VALUE.SupportLevel}

  if {$Physical_Interface  == "Internal" || $Physical_Interface == "MII" || $c_family == "kintex8" || $c_family == "virtex8" } {
    set_property  enabled false $SupportLevel
    set_property  value 0       $SupportLevel
  } else {
    set_property  enabled true  $SupportLevel
  }
}

proc update_gui_for_PARAM_VALUE.Physical_Interface {PARAM_VALUE.SupportLevel PARAM_VALUE.MAC_Speed PARAM_VALUE.Physical_Interface PROJECT_PARAM.ARCHITECTURE IPINST } {
  set Physical_Interface    [get_property value  ${PARAM_VALUE.Physical_Interface}]
  set c_family               [get_project_property ARCHITECTURE]
  set shared_logic_info_pane [ipgui::get_groupspec "Shared Logic Overview" -of $IPINST]

  set Int_Clk_Src [ipgui::get_guiparamspec Int_Clk_Src -of $IPINST]
  if {[get_property value ${PARAM_VALUE.Physical_Interface}] == "Internal" && [get_property value ${PARAM_VALUE.MAC_Speed}] != "2500_Mbps"} { 
    set_property visible true $Int_Clk_Src
  } else {
    set_property visible false $Int_Clk_Src
  }

  if {$Physical_Interface  == "Internal" || $Physical_Interface == "MII"  || $c_family == "kintex8" || $c_family == "virtex8" } {
     set_property visible false  $shared_logic_info_pane
  } else {
    set_property visible true   $shared_logic_info_pane
  }
  set sharedLogicString [ DT_Support_Level ${PARAM_VALUE.Physical_Interface} [get_project_property ARCHITECTURE] ]
  set_property Description $sharedLogicString  [ipgui::get_guiparamspec SupportLevel -of $IPINST]
}

proc update_PARAM_VALUE.TX_Inband_CF_Enable { PARAM_VALUE.TX_Inband_CF_Enable PARAM_VALUE.Enable_1588 IPINST} {
  set Enable_1588         [get_property value ${PARAM_VALUE.Enable_1588}]
  set TX_Inband_CF_Enable ${PARAM_VALUE.TX_Inband_CF_Enable}

  if {$Enable_1588  == false } {
    set_property enabled false $TX_Inband_CF_Enable
    set_property value   false $TX_Inband_CF_Enable
  } else {
    set_property  enabled true  $TX_Inband_CF_Enable
    set_property  value   false $TX_Inband_CF_Enable
  }
}

proc update_PARAM_VALUE.RX_Inband_TS_Enable { PARAM_VALUE.RX_Inband_TS_Enable PARAM_VALUE.Enable_1588 IPINST} {
    set Enable_1588         [get_property value ${PARAM_VALUE.Enable_1588}]
    set RX_Inband_TS_Enable ${PARAM_VALUE.RX_Inband_TS_Enable}

    if {$Enable_1588  == false } {
      set_property enabled false $RX_Inband_TS_Enable
      set_property value   false $RX_Inband_TS_Enable
    } else {
      set_property  enabled true  $RX_Inband_TS_Enable
      set_property  value   false $RX_Inband_TS_Enable
    }
}

#proc update_PARAM_VALUE.Int_Clk_Src {PARAM_VALUE.Data_Rate PARAM_VALUE.Int_Clk_Src IPINST} {
#    set Data_Rate           [get_property value ${PARAM_VALUE.Data_Rate}]
#    set Int_Clk_Src         [get_property value ${PARAM_VALUE.Int_Clk_Src}]
#
#    if {$Data_Rate == "2.5_Gbps"} {
#      set_property value "User_Clk2" ${PARAM_VALUE.Int_Clk_Src} 
#    }
#}

proc update_MODELPARAM_VALUE.C_PHYSICAL_INTERFACE { MODELPARAM_VALUE.C_PHYSICAL_INTERFACE PARAM_VALUE.Physical_Interface PROJECT_PARAM.ARCHITECTURE IPINST} {
  if { [get_property value ${PARAM_VALUE.Physical_Interface} ] == "GMII"} {
    set value "GMII"
  } elseif { [get_property value ${PARAM_VALUE.Physical_Interface} ] == "RGMII"} {
    set value "RGMII"
  } elseif { [get_property value ${PARAM_VALUE.Physical_Interface} ] == "MII"} {
    set value "MII"
  } elseif { [get_property value ${PARAM_VALUE.Physical_Interface} ] == "Internal"} {
    set value "INTERNAL"
  } else {
    set value "NULL"
  }
  set_property value  $value  ${MODELPARAM_VALUE.C_PHYSICAL_INTERFACE}
}

proc update_MODELPARAM_VALUE.C_HALF_DUPLEX { MODELPARAM_VALUE.C_HALF_DUPLEX PARAM_VALUE.Half_Duplex IPINST} {
  set_property value [get_property value ${PARAM_VALUE.Half_Duplex}] ${MODELPARAM_VALUE.C_HALF_DUPLEX}
}

proc update_MODELPARAM_VALUE.C_HAS_HOST { MODELPARAM_VALUE.C_HAS_HOST PARAM_VALUE.Management_Interface IPINST} {
  set_property value [get_property value ${PARAM_VALUE.Management_Interface}] ${MODELPARAM_VALUE.C_HAS_HOST}

}

proc update_MODELPARAM_VALUE.C_HAS_MDIO { MODELPARAM_VALUE.C_HAS_MDIO PARAM_VALUE.Enable_MDIO IPINST} {
  set_property value [get_property value ${PARAM_VALUE.Enable_MDIO}] ${MODELPARAM_VALUE.C_HAS_MDIO}

}

proc update_MODELPARAM_VALUE.C_MDIO_EXTERNAL { MODELPARAM_VALUE.C_MDIO_EXTERNAL PARAM_VALUE.Make_MDIO_External IPINST } {
  set_property value [get_property value ${PARAM_VALUE.Make_MDIO_External}] ${MODELPARAM_VALUE.C_MDIO_EXTERNAL}

}

proc update_MODELPARAM_VALUE.C_AXILITE_FREQ { MODELPARAM_VALUE.C_AXILITE_FREQ PARAM_VALUE.Management_Frequency PROJECT_PARAM.ARCHITECTURE IPINST  } {
  set_property value [get_property value ${PARAM_VALUE.Management_Frequency} ] ${MODELPARAM_VALUE.C_AXILITE_FREQ}
}
proc update_MODELPARAM_VALUE.C_ADD_FILTER { MODELPARAM_VALUE.C_ADD_FILTER PARAM_VALUE.Frame_Filter IPINST} {
  set_property value [get_property value ${PARAM_VALUE.Frame_Filter}] ${MODELPARAM_VALUE.C_ADD_FILTER}
}

proc update_MODELPARAM_VALUE.C_AT_ENTRIES { MODELPARAM_VALUE.C_AT_ENTRIES PARAM_VALUE.Number_of_Table_Entries IPINST} {
  set_property value [get_property value ${PARAM_VALUE.Number_of_Table_Entries}] ${MODELPARAM_VALUE.C_AT_ENTRIES}
}

proc update_MODELPARAM_VALUE.C_MAC_SPEED { MODELPARAM_VALUE.C_MAC_SPEED PARAM_VALUE.MAC_Speed IPINST } {
  if { [get_property value ${PARAM_VALUE.MAC_Speed} ] == "10_100_Mbps"} {
    set value "SPEED_10_100_MBPS"
  } elseif { [get_property value ${PARAM_VALUE.MAC_Speed} ] == "1000_Mbps" || [get_property value ${PARAM_VALUE.MAC_Speed} ] == "2500_Mbps"} {
    set value "SPEED_1000_MBPS"
  } elseif { [get_property value ${PARAM_VALUE.MAC_Speed} ] == "Tri_speed"} {
    set value "TRI_SPEED"
  } else {
    set value "NULL"
  }
  set_property value  $value  ${MODELPARAM_VALUE.C_MAC_SPEED}
}

proc update_MODELPARAM_VALUE.C_HAS_STATS { MODELPARAM_VALUE.C_HAS_STATS PARAM_VALUE.Statistics_Counters IPINST} {
  set_property value [get_property value ${PARAM_VALUE.Statistics_Counters}] ${MODELPARAM_VALUE.C_HAS_STATS}
}

proc update_MODELPARAM_VALUE.C_NUM_STATS { MODELPARAM_VALUE.C_NUM_STATS PROJECT_PARAM.ARCHITECTURE PARAM_VALUE.Enable_Priority_Flow_Control PARAM_VALUE.Half_Duplex IPINST} {
  if { [get_property value ${PARAM_VALUE.Enable_Priority_Flow_Control}] == true} {
  set value 43
  } else {
    if { [get_property value ${PARAM_VALUE.Half_Duplex}] == true} {
      set value 41
    } else {
      set value 34
    }
  }
  set_property value $value ${MODELPARAM_VALUE.C_NUM_STATS}
}

proc update_MODELPARAM_VALUE.C_CNTR_RST { MODELPARAM_VALUE.C_CNTR_RST PARAM_VALUE.Statistics_Reset IPINST} {
set_property value [get_property value ${PARAM_VALUE.Statistics_Reset}] ${MODELPARAM_VALUE.C_CNTR_RST}
}

proc update_MODELPARAM_VALUE.C_STATS_WIDTH { MODELPARAM_VALUE.C_STATS_WIDTH PARAM_VALUE.Statistics_Width IPINST} {
  if { [get_property value ${PARAM_VALUE.Statistics_Width}  ] == "64bit"} {
    set value 64
  } else {
    set value 32
  }
  set_property value $value ${MODELPARAM_VALUE.C_STATS_WIDTH}
}

proc update_MODELPARAM_VALUE.C_AVB { MODELPARAM_VALUE.C_AVB PARAM_VALUE.Enable_AVB IPINST} {
set_property value [get_property value ${PARAM_VALUE.Enable_AVB}] ${MODELPARAM_VALUE.C_AVB}
}

proc update_MODELPARAM_VALUE.C_1588 { MODELPARAM_VALUE.C_1588 PARAM_VALUE.Enable_1588 PARAM_VALUE.Enable_1588_1step PARAM_VALUE.Timer_Format IPINST} {
  if {[get_property value ${PARAM_VALUE.Enable_1588}] == true} {
    if {[get_property value ${PARAM_VALUE.Enable_1588_1step}] == true} {
      if {[get_property value ${PARAM_VALUE.Timer_Format}] == "Time_of_day"} {
        set_property value  1  ${MODELPARAM_VALUE.C_1588}
      } else {
        set_property value  3  ${MODELPARAM_VALUE.C_1588}
      }
    } else {
      if {[get_property value ${PARAM_VALUE.Timer_Format}] == "Time_of_day"} {
        set_property value  2  ${MODELPARAM_VALUE.C_1588}
      } else {
        set_property value  4  ${MODELPARAM_VALUE.C_1588}
      }
    }
  } else {
    set_property value  0  ${MODELPARAM_VALUE.C_1588}
  }
}

proc update_MODELPARAM_VALUE.C_FAMILY { MODELPARAM_VALUE.c_family PROJECT_PARAM.ARCHITECTURE IPINST} {
  set c_family [get_project_property ARCHITECTURE]
  set_property value $c_family ${MODELPARAM_VALUE.c_family}
}

proc update_MODELPARAM_VALUE.c_tx_inband_cf_enable { MODELPARAM_VALUE.c_tx_inband_cf_enable PARAM_VALUE.TX_Inband_CF_Enable IPINST} {
  set_property value [get_property value ${PARAM_VALUE.TX_Inband_CF_Enable}] ${MODELPARAM_VALUE.c_tx_inband_cf_enable}
}

proc update_MODELPARAM_VALUE.c_rx_inband_ts_enable { MODELPARAM_VALUE.c_rx_inband_ts_enable PARAM_VALUE.RX_Inband_TS_Enable IPINST} {
  set_property value [get_property value ${PARAM_VALUE.RX_Inband_TS_Enable}] ${MODELPARAM_VALUE.c_rx_inband_ts_enable}
}

proc update_MODELPARAM_VALUE.c_tx_tuser_width { MODELPARAM_VALUE.c_tx_tuser_width PARAM_VALUE.Enable_1588 PARAM_VALUE.Enable_AVB} {
  if {[ get_property value ${PARAM_VALUE.Enable_1588} ] == true  && [ get_property value ${PARAM_VALUE.Enable_AVB} ] == false} {
        set_property value  128   ${MODELPARAM_VALUE.c_tx_tuser_width} 
  } else {
        set_property value  1     ${MODELPARAM_VALUE.c_tx_tuser_width} 
  }
}

proc update_MODELPARAM_VALUE.C_RX_VEC_WIDTH { MODELPARAM_VALUE.C_RX_VEC_WIDTH PARAM_VALUE.Enable_Priority_Flow_Control IPINST} {
  if {[get_property value ${PARAM_VALUE.Enable_Priority_Flow_Control}] == true} {
    set_property value 95 ${MODELPARAM_VALUE.C_RX_VEC_WIDTH}
  } else {
    set_property value 79 ${MODELPARAM_VALUE.C_RX_VEC_WIDTH}
  }
}

proc update_MODELPARAM_VALUE.C_TX_VEC_WIDTH { MODELPARAM_VALUE.C_TX_VEC_WIDTH PARAM_VALUE.Enable_Priority_Flow_Control IPINST} {
  if {[get_property value ${PARAM_VALUE.Enable_Priority_Flow_Control}] == true} {
      set_property value 367 ${MODELPARAM_VALUE.C_TX_VEC_WIDTH}
  } else {
      set_property value 79  ${MODELPARAM_VALUE.C_TX_VEC_WIDTH}
  }
}

proc update_MODELPARAM_VALUE.C_ADDR_WIDTH { MODELPARAM_VALUE.C_ADDR_WIDTH PARAM_VALUE.Enable_AVB IPINST} {
  if {[get_property value ${PARAM_VALUE.Enable_AVB}] == true} {
      set_property value  17  ${MODELPARAM_VALUE.C_ADDR_WIDTH}
    } else {
      set_property value  12   ${MODELPARAM_VALUE.C_ADDR_WIDTH}
    }
}

proc update_MODELPARAM_VALUE.c_int_clk_src { MODELPARAM_VALUE.c_int_clk_src PARAM_VALUE.Int_Clk_Src IPINST} {
  if {[get_property value ${PARAM_VALUE.Int_Clk_Src}] == "rx_user_clk2"} {
      set_property value  "RX_User_Clk2" ${MODELPARAM_VALUE.c_int_clk_src}
  } else {
      set_property value  "User_Clk2" ${MODELPARAM_VALUE.c_int_clk_src}
  }
}

proc update_MODELPARAM_VALUE.c_int_mode_type { MODELPARAM_VALUE.c_int_mode_type PARAM_VALUE.Int_Mode_Type IPINST} {
  if {[get_property value ${PARAM_VALUE.Int_Mode_Type}] == "SGMII"} {
      set_property value  "SGMII" ${MODELPARAM_VALUE.c_int_mode_type}
  } else {
      set_property value  "BASEX" ${MODELPARAM_VALUE.c_int_mode_type}
  }
}

proc update_MODELPARAM_VALUE.C_PFC { MODELPARAM_VALUE.C_PFC PARAM_VALUE.Enable_Priority_Flow_Control IPINST} {
  set_property value [get_property value ${PARAM_VALUE.Enable_Priority_Flow_Control}] ${MODELPARAM_VALUE.C_PFC}
}
proc update_MODELPARAM_VALUE.C_MII_IO { MODELPARAM_VALUE.C_MII_IO PARAM_VALUE.MII_IO IPINST} {
  set_property value [get_property value ${PARAM_VALUE.MII_IO}] ${MODELPARAM_VALUE.C_MII_IO}
}

proc update_MODELPARAM_VALUE.C_DATA_RATE { MODELPARAM_VALUE.C_DATA_RATE PARAM_VALUE.Data_Rate PROJECT_PARAM.ARCHITECTURE IPINST} {
  if { [get_property value ${PARAM_VALUE.Data_Rate}] == "2.5_Gbps"} {
    set value "2.5_Gbps"
  } else {
     set value "1_Gbps"
  }
  set_property value $value ${MODELPARAM_VALUE.C_DATA_RATE}
}
