Commit 1e8758be authored by Carsten Heinz's avatar Carsten Heinz

Add microblaze debugging feature and 2x clk plugin

parent 2122677a
Pipeline #808 passed with stage
in 12 minutes and 52 seconds
#
# Copyright (C) 2018 Carsten Heinz, 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/>.
#
namespace eval clk2x {
proc wrap_clk_2x {inst {args}} {
# check for clk_2x
set inst [get_bd_cells $inst]
set clock_ports2x [get_bd_pins -of_objects $inst -filter {DIR == I && (NAME =~ *clk* || NAME =~ *CLK* || NAME =~ clock) && (NAME =~ *2x* || NAME =~ *2X*)}]
if {[llength $clock_ports2x] > 0} {
puts " IP has a 2x clk, will add a PLL"
set clock_ports [get_bd_pins -of_objects $inst -filter {DIR == I && (NAME =~ *clk* || NAME =~ *CLK* || NAME =~ clock) && NAME !~ *2x* && NAME !~ *2X*}]
set clock_in [lindex $clock_ports 0]
set freq [tapasco::get_design_frequency]
set freq2x [expr $freq*2]
puts " Frequency is $freq MHz, doubling to $freq2x MHz"
# add a PLL
set pll "clk_2x_pll"
if {[llength [get_bd_cells $pll]] > 0} {
puts " re-use existing pll"
} else {
::tapasco::ip::create_clk_wiz $pll
set_property -dict [list CONFIG.PRIMITIVE {PLL} CONFIG.USE_LOCKED {false} \
CONFIG.USE_RESET {false} CONFIG.USE_POWER_DOWN {false} CONFIG.PRIM_SOURCE {Global_buffer} \
CONFIG.PRIM_IN_FREQ $freq CONFIG.CLKOUT1_REQUESTED_OUT_FREQ $freq2x] \
[get_bd_cells $pll]
set_property CONFIG.PRIM_IN_FREQ.VALUE_SRC PROPAGATED [get_bd_cells $pll]
}
connect_bd_net [get_bd_pins $pll/clk_out1] $clock_ports2x
}
return [list $inst $args]
}
}
tapasco::register_plugin "arch::clk2x::wrap_clk_2x" "post-pe-create"
#
# 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 mb_mdm {
set mb_debug_vlnv "xilinx.com:interface:mbdebug_rtl:3.0"
set mdm_vlnv "xilinx.com:ip:mdm:3.2"
proc mdm_microblaze {args} {
variable mb_debug_vlnv
variable mdm_vlnv
puts "MicroBlaze: plugin started ..."
# check if debug module is enabled
set debug_enabled false
set fs [tapasco::get_features]
set fi [lsearch -nocase $fs "microblaze"]
if {$fi != -1} {
set f [tapasco::get_feature [lindex $fs $fi]]
puts " found MicroBlaze feature: $f"
if {[dict exists $f "debug"]} {
set debug_enabled [dict get $f "debug"]
puts " MicroBlaze Debug Module (MDM) activated in feature: $debug_enabled"
}
}
puts " build MDM: $debug_enabled"
save_bd_design
if {$debug_enabled} {
puts " searching for unconnected MicroBlaze debug ports ..."
set pins [list]
foreach p [get_bd_intf_pins -hier -filter "VLNV == $mb_debug_vlnv && MODE == Slave"] {
if {[llength [get_bd_intf_nets -of_objects $p]] == 0} {
puts " found unconnected MicroBlaze debug port: $p"
lappend pins $p
}
}
set oldInst [current_bd_instance .]
current_bd_instance [::tapasco::subsystem::get arch]
set pc [llength $pins]
if {$pc > 0} {
puts " found $pc unconnected MicroBlaze ports, building MDM..."
set mdm [create_bd_cell -type ip -vlnv $mdm_vlnv mdm]
set_property -dict [list \
CONFIG.C_MB_DBG_PORTS $pc \
CONFIG.C_DBG_REG_ACCESS {1}
] $mdm
for {set i 0} {$i < $pc} {incr i} {
connect_bd_intf_net [get_bd_intf_pins $mdm/MBDEBUG_$i] [get_bd_intf_pins [lindex $pins $i]]
}
connect_bd_net [::tapasco::subsystem::get_port "design" "clk"] [get_bd_pins $mdm/S_AXI_ACLK]
connect_bd_net [::tapasco::subsystem::get_port "design" "rst" "peripheral" "resetn"] [get_bd_pins $mdm/S_AXI_ARESETN]
} else {
puts " found no unconnected MicroBlaze debug ports."
}
set clk_pin [get_bd_pins -hier -filter { NAME == design_aclk && DIR == O }]
set rst_pin [get_bd_pins -hier -filter { NAME == design_peripheral_aresetn && DIR == O }]
# TODO connect to bus, clk and reset
current_bd_instance $oldInst
}
return $args
}
}
tapasco::register_plugin "arch::mb_mdm::mdm_microblaze" "post-platform"
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