debug.tcl 2.42 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#
# Copyright (C) 2017 Jens Korinth, TU Darmstadt
#
# This file is part of Tapasco (TPC).
#
# Tapasco is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tapasco is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Tapasco.  If not, see <http://www.gnu.org/licenses/>.
#
# @file   mb_shifter.tcl
# @brief  Plugin to insert the MicroBlaze Debug Module (MDM) for all DEBUG ports
#         found in the Architecture.
# @author J. Korinth, TU Darmstadt (jk@esa.cs.tu-darmstadt.de)
#
namespace eval debug {
  proc debug_feature {args} {
    if {[tapasco::is_feature_enabled "Debug"]} {
      # set defaults
      set depth       1024
      set stages      0
      set interfaces  {}

      set debug [tapasco::get_feature "Debug"]
Jens Korinth's avatar
Jens Korinth committed
33
      puts "Debug feature enabled: $debug"
34
35
36
37
38
      dict with debug {
        set num_ifs [llength $interfaces]
        if {$num_ifs > 0} {
          set i 0
          foreach ifs $interfaces {
Jens Korinth's avatar
Jens Korinth committed
39
            puts "   found interface def: $ifs"
40
            if {[llength $ifs] == 3} {
Jens Korinth's avatar
Jens Korinth committed
41
42
              set s_ila [tapasco::ip::create_system_ila "SILA_$i" $num_ifs $depth $stages]
              puts "  create System ILA SILA_$i for $num_ifs interfaces with depth $depth and $stages stages"
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
              set intf [get_bd_intf_pins [lindex $ifs 0]]
              set clk [get_bd_pins [lindex $ifs 1]]
              set rst [get_bd_pins [lindex $ifs 2]]
              puts "  connecting $intf to port #$i, clock to $clk, reset to $rst ..."
              connect_bd_intf_net $intf [get_bd_intf_pins "$s_ila/SLOT_${i}_AXI"]
              connect_bd_net $clk [get_bd_pins -of_objects $s_ila -filter {TYPE == clk && DIR == I}]
              connect_bd_net $rst [get_bd_pins -of_objects $s_ila -filter {TYPE == rst && DIR == I}]
              incr i
            } else {
              error "expected three elements for debugging interface: interface, clock and reset; found: $ifs"
            }
          }
        }
      }
    }
  }
}

Jens Korinth's avatar
Jens Korinth committed
61
tapasco::register_plugin "arch::debug::debug_feature" "pre-wrapper"