proc init { cellpath otherinfo } {
  ifx_puts "----------------------------------------------------------------------"
  ifx_puts "[info level [info level]]"
}

proc post_config_ip { cellpath  otherinfo } { 
  ifx_puts "----------------------------------------------------------------------"
  ifx_puts "[info level [info level]]"

  set pcie_versal [get_bd_cells $cellpath ] 
  
  set Frequency [get_property CONFIG.axisten_freq $pcie_versal]
  
  set New_Freq [ expr int([expr $Frequency * 1000000 ])]
  
  set_property CONFIG.FREQ_HZ $New_Freq [get_bd_pins $pcie_versal/user_clk]

  if { [get_property CONFIG.sys_reset_polarity $pcie_versal] == "ACTIVE_LOW" } {
    set_property CONFIG.POLARITY "ACTIVE_LOW" [get_bd_pins $pcie_versal/sys_reset]
  } else {
    set_property CONFIG.POLARITY "ACTIVE_HIGH" [get_bd_pins $pcie_versal/sys_reset]
  }
}

proc ifx_puts { s } {
  global env;
  if {[info exists env(XIL_IFX_DEBUG)]} {
    debug::send_message -severity INFO -msg "ifx: $s"
  }
}
