################################################################################
# Main tcl for the module
################################################################################

# ==============================================================================
proc init {} {

    # Configuration
    # TODO Follow FWK
    # variable quad_name
    # set quad_name X0Y4
}

# ==============================================================================
proc setSources {} {
  variable Vhdl

  # Generate VHDL package with modversion
  genModVerFile VHDL ../hdl/pkg_combpm_version.vhd

  lappend Vhdl ../hdl/combpm_protocol_electron.vhd
  lappend Vhdl ../hdl/top_combpm_electron.vhd
  lappend Vhdl ../hdl/pkg_bpmframe_stream.vhd

}

# ==============================================================================
proc setAddressSpace {} {
    variable AddressSpace
    addAddressSpace AddressSpace "combpm" RDL {} ../rdl/combpm.rdl
}

# ==============================================================================
proc doOnCreate {} {
  variable Vhdl
  addSources Vhdl

  # TODO sould probably get that part number from the project configuration
  set fpga_part "xczu11eg-ffvc1760-2L-e"
  set_property part ${fpga_part} [current_project]
  set_property target_language VHDL [current_project]

  # Create GT wizard IP
  source ../tcl/combpm_gtwizard.tcl
}

# ==============================================================================
proc doOnBuild {} {
}

# ==============================================================================
proc setSim {} {
}