Commit 8d6b2d59 authored by Jens Korinth's avatar Jens Korinth
Browse files

VC709: finish Platform refactoring

* VC709 designs should build again
* generalized address mapping, same method should be applicable to other
  Platforms like Zynq, too
* still WIP, need to move a few bits between implementations
parent c4d81df5
......@@ -201,85 +201,48 @@ namespace eval platform {
}
proc get_address_map {{pe_base ""}} {
set max64 [expr "1 << 64"]
if {$pe_base == ""} { set pe_base [get_pe_base_address] }
set peam [::arch::get_address_map $pe_base]
puts "Computing addresses for masters ..."
foreach m [tapasco::get_aximm_interfaces [get_bd_cells -filter {PATH !~ /uArch/*}]] {
set as [get_bd_addr_segs -addressables -of_objects $m]
puts "master: $m, segs: $as"
switch -glob [get_property NAME $m] {
"M_DMA" {
set base 0x00300000
foreach seg [lsort [get_bd_addr_segs -addressables -of_objects $m]] {
puts [format " $seg -> 0x%08x" $base]
set sintf [get_bd_intf_pins -of_objects $seg]
set range [get_property RANGE $seg]
set kind [get_property USAGE $seg]
dict set peam $sintf "interface $sintf offset $base range $range kind $kind"
incr base 0x00010000
}
}
"M_INTC" {
set base 0x00400000
foreach seg [lsort [get_bd_addr_segs -addressables -of_objects $m]] {
puts [format " $seg -> 0x%08x" $base]
set sintf [get_bd_intf_pins -of_objects $seg]
set range [get_property RANGE $seg]
set kind [get_property USAGE $seg]
dict set peam $sintf "interface $sintf offset $base range $range kind $kind"
incr base 0x00010000
}
}
"M_MSIX" {
set base 0x00500000
foreach seg [lsort [get_bd_addr_segs -addressables -of_objects $m]] {
puts [format " $seg -> 0x%08x" $base]
set sintf [get_bd_intf_pins -of_objects $seg]
set range [get_property RANGE $seg]
set kind [get_property USAGE $seg]
dict set peam $sintf "interface $sintf offset $base range $range kind $kind"
incr base 0x00010000
}
}
"M_TAPASCO" {
set base 0x02800000
foreach seg [lsort [get_bd_addr_segs -addressables -of_objects $m]] {
puts [format " $seg -> 0x%08x" $base]
set sintf [get_bd_intf_pins -of_objects $seg]
set range [get_property RANGE $seg]
set kind [get_property USAGE $seg]
dict set peam $sintf "interface $sintf offset $base range $range kind $kind"
incr base $range
}
}
"M_ARCH" {}
default {
puts "unknown master: $m"
set base 0
foreach seg [lsort [get_bd_addr_segs -addressables -of_objects $m]] {
puts [format " $seg -> 0x%08x" $base]
set sintf [get_bd_intf_pins -of_objects $seg]
set range [get_property RANGE $seg]
set kind [get_property USAGE $seg]
dict set peam $sintf "interface $sintf offset $base range $range kind $kind"
incr base $range
}
}
"M_DMA" { foreach {base stride range} [list 0x00300000 0x10000 0 ] {} }
"M_INTC" { foreach {base stride range} [list 0x00400000 0x10000 0 ] {} }
"M_MSIX" { foreach {base stride range} [list 0x00500000 0x10000 $max64] {} }
"M_TAPASCO" { foreach {base stride range} [list 0x02800000 0 0 ] {} }
"M_HOST" { foreach {base stride range} [list 0 0 $max64] {} }
"M_ARCH" { set base "skip" }
default { foreach {base stride range} [list 0 0 0] {} }
}
if {$base != "skip"} { set peam [assign_address $peam $m $base $stride $range] }
}
return $peam
}
proc assign_address {address_map master base {stride 0} {range 0}} {
foreach seg [lsort [get_bd_addr_segs -addressables -of_objects $master]] {
puts [format " $master: $seg -> 0x%08x (range: 0x%08x)" $base $range]
set sintf [get_bd_intf_pins -of_objects $seg]
if {$range <= 0} { set range [get_property RANGE $seg] }
set kind [get_property USAGE $seg]
dict set address_map $sintf "interface $sintf offset $base range $range kind $kind"
if {$stride == 0} { incr base $range } else { incr base $stride }
}
return $address_map
}
proc construct_address_map {{map ""}} {
if {$map == ""} { set map [get_address_map [get_pe_base_address]] }
puts "ADDRESS MAP: $map"
set seg_i 0
foreach space [get_bd_addr_spaces] {
puts "space: $space"
set intfs [get_bd_intf_pins -quiet -of_objects $space]
set intfs [get_bd_intf_pins -quiet -of_objects $space -filter { MODE == Master }]
foreach intf $intfs {
set segs [get_bd_addr_segs -addressables -of_objects $intf]
foreach seg $segs {
puts "seg: $seg"
puts " seg: $seg"
set sintf [get_bd_intf_pins -quiet -of_objects $seg]
if {[catch {dict get $map $intf}]} {
if {[catch {dict get $map $sintf}]} {
......@@ -289,14 +252,17 @@ namespace eval platform {
} else {
set me [dict get $map $intf]
}
puts " address map info: $me]"
puts " address map info: $me]"
set range [dict get $me "range"]
set offset [dict get $me "offset"]
puts " offset: $offset"
puts " range: $range"
puts " range: $range"
puts " offset: $offset"
puts " space: $space"
puts " seg: $seg"
if {[expr "(1 << 64) == $range"]} { set range "16E" }
create_bd_addr_seg \
-range $range \
-offset $offset \
-range $range \
$space \
$seg \
[format "AM_SEG_%03d" $seg_i]
......
......@@ -74,8 +74,8 @@ namespace eval platform {
set num_irqs 132
set num_irqs_threadpools 128
set irq_concat_ss [tapasco::createConcat "interrupt_concat" 8]
set irq_unused [tapasco::createConstant "irq_unused" 1 0]
set irq_concat_ss [tapasco::createConcat "interrupt_concat" 6]
set irq_unused [tapasco::createConstant "irq_unused" 4 0]
# create MSIX interrupt controller
set msix_intr_ctrl [tapasco::createMSIXIntrCtrl "msix_intr_ctrl"]
......@@ -100,8 +100,10 @@ namespace eval platform {
connect_bd_net $dma_irq [get_bd_pin -of_objects $irq_concat_ss -filter {NAME == "In0"}]
puts "Unused Interrupts: 1, 2, 3 are tied to 0"
connect_bd_net [get_bd_pin -of_object $irq_unused -filter {NAME == "dout"}] [get_bd_pin -of_objects $irq_concat_ss -filter {NAME == "In1"}]
connect_bd_net [get_bd_pin -of_object $irq_unused -filter {NAME == "dout"}] [get_bd_pin -of_objects $irq_concat_ss -filter {NAME == "In2"}]
connect_bd_net [get_bd_pin -of_object $irq_unused -filter {NAME == "dout"}] [get_bd_pin -of_objects $irq_concat_ss -filter {NAME == "In3"}]
for {set i 0} {$i < 4} {incr i} {
set port [create_bd_pin -dir I -type intr "irq_$i"]
connect_bd_net $port [get_bd_pin $irq_concat_ss/[format "In%d" [expr "$i + 2"]]]
}
# connect internal clocks
connect_bd_net $aclk [get_bd_pins -of_objects [get_bd_cells -filter {VLNV !~ "*:tapasco:*"}] -filter {TYPE == "clk" && DIR == "I"}]
......@@ -283,25 +285,20 @@ namespace eval platform {
[get_bd_pins -of_objects $out_ic -filter {NAME =~ S0* && TYPE == clk}] \
[get_bd_pins -of_objects $out_ic -filter {NAME =~ M01_* && TYPE == clk}] \
[get_bd_pins -of_objects $out_ic -filter {NAME =~ M03_* && TYPE == clk}] \
[get_bd_pins -of_objects $in_ic -filter {NAME =~ *00* && TYPE == clk}] \
[get_bd_pins -of_objects $in_ic -filter {NAME == ACLK && TYPE == clk}]
[get_bd_pins -of_objects $in_ic -filter {TYPE == clk}]
connect_bd_net [tapasco::subsystem::get_port "design" "clk"] \
[get_bd_pins -of_objects $out_ic -filter {NAME =~ M00_* && TYPE == clk}] \
[get_bd_pins -of_objects $out_ic -filter {NAME =~ M02_* && TYPE == clk}]
connect_bd_net [tapasco::subsystem::get_port "mem" "clk"] \
[get_bd_pins -of_objects $in_ic -filter {NAME =~ S01_* && TYPE == clk}]
connect_bd_net [tapasco::subsystem::get_port "host" "rst" "peripheral" "resetn"] \
[get_bd_pins $out_ic/ARESETN] \
[get_bd_pins -of_objects $out_ic -filter {NAME =~ S0* && TYPE == rst}] \
[get_bd_pins -of_objects $out_ic -filter {NAME =~ M01_* && TYPE == rst}] \
[get_bd_pins -of_objects $out_ic -filter {NAME =~ M03_* && TYPE == rst}] \
[get_bd_pins -of_objects $in_ic -filter {NAME =~ *00* && TYPE == rst}]
[get_bd_pins -of_objects $in_ic -filter {TYPE == rst}]
connect_bd_net [tapasco::subsystem::get_port "design" "rst" "peripheral" "resetn"] \
[get_bd_pins -of_objects $out_ic -filter {NAME =~ M00_* && TYPE == rst}] \
[get_bd_pins -of_objects $out_ic -filter {NAME =~ M02_* && TYPE == rst}]
connect_bd_net [tapasco::subsystem::get_port "mem" "rst" "peripheral" "resetn"] \
[get_bd_pins -of_objects $in_ic -filter {NAME =~ S01_* && TYPE == rst}]
set version [lindex [split [get_property VLNV [get_bd_cells axi_pcie3_0]] :] end]
if {[expr "$version < 3.0"]} {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment