############################################################################### ## ## (c) Copyright 2012 Xilinx, Inc. All rights reserved. ## ## This file contains confidential and proprietary information ## of Xilinx, Inc. and is protected under U.S. and ## international copyright and other intellectual property ## laws. ## ## DISCLAIMER ## This disclaimer is not a license and does not grant any ## rights to the materials distributed herewith. Except as ## otherwise provided in a valid license issued to you by ## Xilinx, and to the maximum extent permitted by applicable ## law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND ## WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES ## AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING ## BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- ## INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and ## (2) Xilinx shall not be liable (whether in contract or tort, ## including negligence, or under any other theory of ## liability) for any loss or damage of any kind or nature ## related to, arising under or in connection with these ## materials, including for any direct, or any indirect, ## special, incidental, or consequential loss or damage ## (including loss of data, profits, goodwill, or any type of ## loss or damage suffered as a result of any action brought ## by a third party) even if such damage or loss was ## reasonably foreseeable or Xilinx had been advised of the ## possibility of the same. ## ## CRITICAL APPLICATIONS ## Xilinx products are not designed or intended to be fail- ## safe, or for use in any application requiring fail-safe ## performance, such as life-support or safety devices or ## systems, Class III medical devices, nuclear facilities, ## applications related to the deployment of airbags, or any ## other applications that could lead to death, personal ## injury, or severe property or environmental damage ## (individually and collectively, "Critical ## Applications"). Customer assumes the sole risk and ## liability of any use of Xilinx products in Critical ## Applications, subject only to applicable laws and ## regulations governing limitations on product liability. ## ## THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS ## PART OF THIS FILE AT ALL TIMES. ## ############################################################################### ## ## microblaze_mcs_setup.tcl ## ############################################################################### # # This script should be sourced after CORE Generator has been used to generate # a MicroBlaze MCS instance, either when creating a new or changing an existing # instance. # # Run the script in the PlanAhead Tcl Console by typically using: # # source -notrace \ # project_1.srcs/sources_1/ip/microblaze_mcs_v1_4_0/microblaze_mcs_setup.tcl # # Run the script in the Project Navigator Tcl Console by typically using: # # Command> source ipcore_dir/microblaze_mcs_setup.tcl # # Use the menu command "View -> Panels -> Tcl Console" to show the Tcl Console # in the Project Navigator, if it is not visible. # ############################################################################### # # This script contains two exported Tcl procedures: # # o The first, "microblaze_mcs_setup", is used to create a merged BMM file, # which defines the local memory of all MicroBlaze MCS instances in the # project (if more than one instance), and set Translate process properties # to add the "-bm" option indicating the used BMM file. # # The procedure is automatically invoked when sourcing this script, but # can also subsequently be invoked with "microblaze_mcs_setup". # # The procedure should be invoked before running implementation, but after # the MicroBlaze MCS instance has been generated. # # o The second, "microblaze_mcs_data2mem", is used to update the bit stream # with one or more ELF files (software programs) given as arguments, generate # corresponding MEM files for simulation, and set Bitgen process properties # to add the "-bd" option indicating the ELF files. # # If no argument is given, the bit stream is updated with the microblaze # boot loop ELF file, which ensures that the processor executes an infinite # loop. # # The procedure should be invoked after the system has been implemented. It # must also be invoked again when an ELF file name is changed, or when the # content of an ELF file is changed. If the system is reimplemented without # changing the software, the procedure need not be invoked again, due to the # Bitgen "-bd" option. # ############################################################################### namespace eval microblaze_mcs { # Determine if using planAhead or Project Navigator proc mcs_using_planahead {} { return [expr [string first "planAhead" [info nameofexecutable]] != -1] } # Find all MicroBlaze MCS instances in the project # Return a list of lists with instance name and file name proc mcs_find_instances {} { set mcs_instances {} set xco_filenames {} if {[mcs_using_planahead]} { set found [get_files -quiet -filter {IS_ENABLED==1} "*.xci"] if {$found == ""} { set found [get_files -quiet -filter {IS_ENABLED==1} "*.xco"] if {[string first ".xco" $found] + 4 == [string length $found]} { lappend xco_filenames "$found" } else { set xco_filenames $found } } elseif {[string first ".xci" $found] + 4 == [string length $found]} { lappend xco_filenames [string map {.xci .xco} $found] } else { foreach item $found { lappend xco_filenames [string map {.xci .xco} $item] } } } else { set found [search "*.xco"] collection foreach item $found { lappend xco_filenames [object name $item] } } for {set index 0} {$index < [llength $xco_filenames]} {incr index} { set xco_filename [lindex $xco_filenames $index] # Check if the xco file is a MicroBlaze MCS IP Core set xco_file [open $xco_filename "r"] set xco_data [read $xco_file] close $xco_file if {[regexp {microblaze_mcs} $xco_data]} { regexp {CSET component_name=([A-Za-z0-9_]*)} $xco_data match inst lappend mcs_instances [list $xco_filename $inst] } } return $mcs_instances } # Get current options proc mcs_get_options {step} { if {[mcs_using_planahead]} { set dir [get_property directory [current_project]] set name [get_property name [current_project]] set run [current_run -quiet] set psg_filename "[file join ${dir} ${name}.data runs ${run}.psg]" if {[file exist $psg_filename]} { set psg_file [open $psg_filename "r"] set psg_data [read $psg_file] close $psg_file set search "" append search {[\n\t ]*