pluto_hdl_adi/projects/scripts/adi_board.tcl

219 lines
7.2 KiB
Tcl
Raw Normal View History

2014-10-03 20:13:34 +00:00
###################################################################################################
###################################################################################################
variable sys_zynq
variable sys_addr_cntrl_space
variable sys_cpu_interconnect_index
variable sys_hp0_interconnect_index
variable sys_hp1_interconnect_index
variable sys_hp2_interconnect_index
variable sys_hp3_interconnect_index
variable sys_mem_interconnect_index
variable sys_interrupts_n
variable sys_interrupts_q
###################################################################################################
###################################################################################################
set sys_cpu_interconnect_index 0
set sys_hp0_interconnect_index 0
set sys_hp1_interconnect_index 0
set sys_hp2_interconnect_index 0
set sys_hp3_interconnect_index 0
set sys_mem_interconnect_index 0
set sys_interrupts_n 0
###################################################################################################
###################################################################################################
proc ad_connect_type {p_name} {
set m_name ""
if {$m_name eq ""} {set m_name [get_bd_nets -quiet $p_name]}
if {$m_name eq ""} {set m_name [get_bd_pins -quiet $p_name]}
if {$m_name eq ""} {set m_name [get_bd_ports -quiet $p_name]}
if {$m_name eq ""} {set m_name [get_bd_intf_nets -quiet $p_name]}
if {$m_name eq ""} {set m_name [get_bd_intf_pins -quiet $p_name]}
if {$m_name eq ""} {set m_name [get_bd_intf_ports -quiet $p_name]}
return $m_name
}
2014-10-03 20:13:34 +00:00
proc ad_connect {p_name_1 p_name_2} {
2014-10-03 20:13:34 +00:00
set m_name_1 [ad_connect_type $p_name_1]
set m_name_2 [ad_connect_type $p_name_2]
2014-10-03 20:13:34 +00:00
if {[get_property CLASS $m_name_1] eq "bd_intf_pin"} {
connect_bd_intf_net $m_name_1 $m_name_2
return
}
2014-10-03 20:13:34 +00:00
if {[get_property CLASS $m_name_1] eq "bd_pin"} {
connect_bd_net $m_name_1 $m_name_2
return
}
2014-10-03 20:13:34 +00:00
if {[get_property CLASS $m_name_1] eq "bd_net"} {
set m_source_1 [filter [get_bd_pins -of_objects [get_bd_nets $m_name_1]] -regexp "DIR == O"]
connect_bd_net -net $m_name_1 $m_name_2 $m_source_1
return
}
}
2014-10-03 20:13:34 +00:00
###################################################################################################
###################################################################################################
2014-10-03 20:13:34 +00:00
proc ad_mem_interconnect {p_sel p_name p_clk} {
2014-10-03 20:13:34 +00:00
set m_clk_source [filter [get_bd_pins -of_objects [get_bd_nets $p_clk]] -regexp "DIR == O"]
2014-10-03 20:13:34 +00:00
if {($p_sel == "HP0") && ($sys_zynq == 1)} {
if {$sys_hp0_interconnect_index == 0} {
}
}
}
2014-10-03 20:13:34 +00:00
###################################################################################################
###################################################################################################
2014-10-03 20:13:34 +00:00
proc ad_cpu_interrupt {p_index p_name} {
2014-10-03 20:13:34 +00:00
global sys_interrupts_n
global sys_interrupts_q
2014-10-03 20:13:34 +00:00
set i_str "In$p_index"
2014-10-03 20:13:34 +00:00
if {$p_index >= $sys_interrupts_n} {
set sys_interrupts_n [expr $p_index + 1]
set_property CONFIG.NUM_PORTS $sys_interrupts_n [get_bd_cells sys_concat_intc]
}
2014-10-03 20:13:34 +00:00
set sys_interrupts_q($p_index) $p_name
set p_intr [filter [get_bd_pins -quiet -of_objects [get_bd_cells $p_name]] \
-regexp "TYPE == intr"]
connect_bd_net -net "${p_name}_intr" \
[get_bd_pins sys_concat_intc/${i_str}] \
[get_bd_pins ${p_intr}]
}
2014-10-03 20:13:34 +00:00
proc ad_cpu_interrupt_update {} {
global sys_zynq
2014-10-03 20:13:34 +00:00
global sys_interrupts_n
global sys_interrupts_q
2014-10-03 20:13:34 +00:00
if {$sys_zynq == 1} {
connect_bd_net -net sys_cpu_interrupt \
[get_bd_pins sys_concat_intc/dout] \
[get_bd_pins sys_ps7/IRQ_F2P]
} else {
2014-10-03 20:13:34 +00:00
connect_bd_net -net sys_cpu_interrupt \
[get_bd_pins sys_concat_intc/dout] \
[get_bd_pins axi_intc/intr]
}
2014-10-03 20:13:34 +00:00
for {set p_index 0} {$p_index < $sys_interrupts_n} {incr p_index} {
if {![info exists sys_interrupts_q($p_index)]} {
set i_str "In$p_index"
set o_str "unc_intr_$p_index"
create_bd_port -dir I ${o_str}
connect_bd_net -net ${o_str} \
[get_bd_pins sys_concat_intc/${i_str}] \
[get_bd_ports ${o_str}]
}
}
}
2014-10-03 20:13:34 +00:00
###################################################################################################
###################################################################################################
2014-10-03 20:13:34 +00:00
proc ad_cpu_interconnect {p_address p_name} {
2014-10-03 20:13:34 +00:00
global sys_zynq
global sys_addr_cntrl_space
global sys_cpu_interconnect_index
2014-10-03 20:13:34 +00:00
set i_str "M$sys_cpu_interconnect_index"
if {$sys_cpu_interconnect_index < 10} {
set i_str "M0$sys_cpu_interconnect_index"
}
2014-10-03 20:13:34 +00:00
set m_clk_source [filter [get_bd_pins -of_objects [get_bd_nets sys_cpu_clk]] -regexp "DIR == O"]
set m_reset_source [filter [get_bd_pins -of_objects [get_bd_nets sys_cpu_resetn]] -regexp "DIR == O"]
2014-10-03 20:13:34 +00:00
if {($sys_cpu_interconnect_index == 0) && ($sys_zynq == 1)} {
2014-10-03 20:13:34 +00:00
connect_bd_net -net sys_cpu_clk \
[get_bd_pins sys_ps7/M_AXI_GP0_ACLK] \
[get_bd_pins axi_cpu_interconnect/ACLK] \
[get_bd_pins axi_cpu_interconnect/S00_ACLK] \
$m_clk_source
2014-10-03 20:13:34 +00:00
connect_bd_net -net sys_cpu_resetn \
[get_bd_pins axi_cpu_interconnect/ARESETN] \
[get_bd_pins axi_cpu_interconnect/S00_ARESETN] \
$m_reset_source
2014-10-03 20:13:34 +00:00
connect_bd_intf_net -intf_net sys_ps7_axi \
[get_bd_intf_pins axi_cpu_interconnect/S00_AXI] \
[get_bd_intf_pins sys_ps7/M_AXI_GP0]
2014-10-03 20:13:34 +00:00
}
2014-10-03 20:13:34 +00:00
if {($sys_cpu_interconnect_index == 0) && ($sys_zynq == 0)} {
2014-10-03 20:13:34 +00:00
connect_bd_net -net sys_cpu_clk \
[get_bd_pins sys_ps7/M_AXI_GP0_ACLK] \
[get_bd_pins axi_cpu_interconnect/ACLK] \
[get_bd_pins axi_cpu_interconnect/S00_ACLK] \
$m_clk_source
connect_bd_net -net sys_cpu_resetn \
[get_bd_pins axi_cpu_interconnect/ARESETN] \
[get_bd_pins axi_cpu_interconnect/S00_ARESETN] \
$m_reset_source
connect_bd_intf_net -intf_net sys_ps7_axi \
[get_bd_intf_pins axi_cpu_interconnect/S00_AXI] \
[get_bd_intf_pins sys_ps7/M_AXI_GP0]
}
2014-10-03 20:13:34 +00:00
set sys_cpu_interconnect_index [expr $sys_cpu_interconnect_index + 1]
set p_seg [get_bd_addr_segs -of_objects [get_bd_cells $p_name]]
set p_seg_range [get_property range $p_seg]
set p_seg_fields [split $p_seg "/"]
lassign $p_seg_fields no_use p_seg_name p_seg_intf p_seg_base
set_property CONFIG.NUM_MI $sys_cpu_interconnect_index [get_bd_cells axi_cpu_interconnect]
set p_clock [filter [get_bd_pins -quiet -of_objects [get_bd_cells $p_name]] \
-regexp "CONFIG.ASSOCIATED_BUSIF == ${p_seg_intf}"]
set p_reset [get_property CONFIG.ASSOCIATED_RESET [get_bd_pins ${p_clock}]]
connect_bd_net -net sys_cpu_clk \
[get_bd_pins "axi_cpu_interconnect/${i_str}_ACLK"] \
[get_bd_pins ${p_clock}] \
$m_clk_source
connect_bd_net -net sys_cpu_resetn \
[get_bd_pins "axi_cpu_interconnect/${i_str}_ARESETN"] \
[get_bd_pins ${p_name}/${p_reset}] \
$m_reset_source
connect_bd_intf_net -intf_net "${p_name}_axi_lite" \
[get_bd_intf_pins "axi_cpu_interconnect/${i_str}_AXI"] \
[get_bd_intf_pins ${p_seg_name}/${p_seg_intf}]
create_bd_addr_seg -range $p_seg_range \
-offset $p_address $sys_addr_cntrl_space \
$p_seg "SEG_data_${p_name}"
}
2014-10-03 20:13:34 +00:00
###################################################################################################
###################################################################################################