arch.tcl 1.99 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
namespace eval arch {
  namespace export create
  namespace export get_address_map
  
  # Returns the address map of the current composition.
  # Format: <INTF> -> <BASE ADDR> <RANGE> <KIND>
  # Kind is either memory, register or master.
  # Must be implemented by Platforms.
  proc get_address_map {offset} {
    if {$offset == ""} { set offset [platform::get_pe_base_address] }
    set ret [dict create]
    set pes [lsort [get_processing_elements]]
    foreach pe $pes {
14
15
      puts "  processing $pe registers ..."
      set usrs [lsort [get_bd_addr_segs $pe/* -filter { USAGE == register }]]
16
17
18
19
20
21
      for {set i 0} {$i < [llength $usrs]} {incr i; incr offset 0x10000} {
        set seg [lindex $usrs $i]
        set intf [get_bd_intf_pins -of_objects $seg]
        set range [get_property RANGE $seg]
        dict set ret $intf "interface $intf [format "offset 0x%08x range 0x%08x" $offset $range] kind register"
      }
22
      puts "  processing $pe memories ..."
23
24
25
26
27
28
29
30
      set usrs [lsort [get_bd_addr_segs $pe/* -filter { USAGE == memory }]]
      for {set i 0} {$i < [llength $usrs]} {incr i; incr offset 0x10000} {
        set seg [lindex $usrs $i]
        set intf [get_bd_intf_pins -of_objects $seg]
        set range [get_property RANGE $seg]
        dict set ret $intf "interface $intf [format "offset 0x%08x range 0x%08x" $offset $range] kind memory"
      }

31
      puts "  processing $pe masters ..."
32
33
34
      set masters [lsort [tapasco::get_aximm_interfaces $pe]]
      foreach intf $masters {
        set space [get_bd_addr_spaces -of_objects $intf]
35
36
37
38
39
40
41
42
43
        if {$space != {}} {
          set off [get_property OFFSET $space]
          if {$off == ""} { set off 0 }
          set range [get_property RANGE $space]
          if {$range == ""} { error "no range found on $space for $intf!" }
          dict set ret $intf "interface $intf [format "offset 0x%08x range 0x%08x" $off $range] kind master"
        } else {
          puts "  no address spaces found on $intf, continuing ..."
        }
44
45
46
47
48
      }
    }
    return $ret
  }
}