1 |
154 |
arniml |
###############################################################################
|
2 |
|
|
#
|
3 |
179 |
arniml |
# $Id: gen_ise_project.tcl 179 2009-04-01 19:48:38Z arniml $
|
4 |
154 |
arniml |
#
|
5 |
|
|
# Based on
|
6 |
|
|
# Created by Phil Hays, Xilinx
|
7 |
|
|
# Setup Xilinx environment, then run from Unix with "xtclsh dice.tcl"
|
8 |
|
|
#
|
9 |
|
|
# This Tcl script will implement a design and load it in the S3E FPGA on
|
10 |
|
|
# the Spartan 3E Starter Kit Board
|
11 |
|
|
#
|
12 |
|
|
# There are two ucf files, one for pins and one for timing
|
13 |
|
|
#
|
14 |
|
|
###############################################################################
|
15 |
|
|
# Contact : e-mail hotline@xilinx.com
|
16 |
|
|
# phone + 1 800 255 7778
|
17 |
|
|
#
|
18 |
|
|
# Disclaimer: LIMITED WARRANTY AND DISCLAMER. These designs are
|
19 |
|
|
# provided to you "as is". Xilinx and its licensors make and you
|
20 |
|
|
# receive no warranties or conditions, express, implied,
|
21 |
|
|
# statutory or otherwise, and Xilinx specifically disclaims any
|
22 |
|
|
# implied warranties of merchantability, non-infringement, or
|
23 |
|
|
# fitness for a particular purpose. Xilinx does not warrant that
|
24 |
|
|
# the functions contained in these designs will meet your
|
25 |
|
|
# requirements, or that the operation of these designs will be
|
26 |
|
|
# uninterrupted or error free, or that defects in the Designs
|
27 |
|
|
# will be corrected. Furthermore, Xilinx does not warrant or
|
28 |
|
|
# make any representations regarding use or the results of the
|
29 |
|
|
# use of the designs in terms of correctness, accuracy,
|
30 |
|
|
# reliability, or otherwise.
|
31 |
|
|
#
|
32 |
|
|
# LIMITATION OF LIABILITY. In no event will Xilinx or its
|
33 |
|
|
# licensors be liable for any loss of data, lost profits, cost
|
34 |
|
|
# or procurement of substitute goods or services, or for any
|
35 |
|
|
# special, incidental, consequential, or indirect damages
|
36 |
|
|
# arising from the use or operation of the designs or
|
37 |
|
|
# accompanying documentation, however caused and on any theory
|
38 |
|
|
# of liability. This limitation will apply even if Xilinx
|
39 |
|
|
# has been advised of the possibility of such damage. This
|
40 |
|
|
# limitation shall apply not-withstanding the failure of the
|
41 |
|
|
# essential purpose of any limited remedies herein.
|
42 |
|
|
#
|
43 |
|
|
# Copyright (c) 2006 Xilinx, Inc.
|
44 |
|
|
# All rights reserved
|
45 |
|
|
#
|
46 |
|
|
###############################################################################
|
47 |
|
|
# Version 1.0 - 19-Oct-2006
|
48 |
|
|
# Initial version
|
49 |
|
|
###############################################################################
|
50 |
|
|
|
51 |
|
|
###############################################################################
|
52 |
|
|
# MAIN
|
53 |
|
|
###############################################################################
|
54 |
|
|
# Modify the project settings for the specific design
|
55 |
|
|
#
|
56 |
|
|
# Make sure there are no files in the build directory that you may want to
|
57 |
|
|
# keep, as this TCL script cleans that directory by default!
|
58 |
|
|
###############################################################################
|
59 |
|
|
|
60 |
|
|
# mandatory environment variable for project name: $MODULE
|
61 |
|
|
if {[info exists env(MODULE)]} {
|
62 |
|
|
set PROJECT $env(MODULE)
|
63 |
|
|
puts "Info: Setting project name from \$MODULE: $PROJECT"
|
64 |
|
|
} else {
|
65 |
|
|
puts "Error: Environment variable MODULE not set."
|
66 |
|
|
exit 1
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
# optional environment variable for build directory: $BLD
|
70 |
|
|
# default is 'bld'
|
71 |
|
|
puts -nonewline "Info: "
|
72 |
|
|
if {[info exists env(BLD)]} {
|
73 |
|
|
set bld $env(BLD)
|
74 |
|
|
puts -nonewline "Setting build directory from \$BLD"
|
75 |
|
|
} else {
|
76 |
|
|
set bld bld
|
77 |
|
|
puts -nonewline "Setting build directory to default"
|
78 |
|
|
}
|
79 |
|
|
puts ": $bld"
|
80 |
|
|
|
81 |
|
|
# optional environment variable for source file compile list: $COMPILE_LIST
|
82 |
|
|
# default is 'compile_list'
|
83 |
|
|
puts -nonewline "Info: "
|
84 |
|
|
if {[info exists env(COMPILE_LIST)]} {
|
85 |
|
|
set compile_list $env(COMPILE_LIST)
|
86 |
|
|
puts -nonewline "Setting source file compile list from \$COMPILE_LIST"
|
87 |
|
|
} else {
|
88 |
|
|
set compile_list compile_list
|
89 |
|
|
puts -nonewline "Setting source file compile list to default"
|
90 |
|
|
}
|
91 |
|
|
puts ": $compile_list"
|
92 |
|
|
|
93 |
|
|
if {[file exists $bld]} {
|
94 |
|
|
puts "Deleting all existing project files in '$bld'"
|
95 |
|
|
# Perhaps ask ok here??
|
96 |
|
|
# Or perhaps skip project creation if project exists??
|
97 |
|
|
file delete -force $bld
|
98 |
|
|
}
|
99 |
|
|
puts "Creating new project directory in '$bld'..."
|
100 |
|
|
file mkdir $bld
|
101 |
|
|
|
102 |
|
|
###############################################################################
|
103 |
|
|
# Put two ucf file into one.
|
104 |
|
|
# This could be made as complex as required, however for demonstration it is
|
105 |
|
|
# just a simple copy.
|
106 |
|
|
###############################################################################
|
107 |
|
|
|
108 |
|
|
puts "Creating new UCF file..."
|
109 |
|
|
|
110 |
|
|
set tempucf [file join $bld temp.ucf]
|
111 |
|
|
set outfile [open $tempucf "w"]
|
112 |
|
|
set infile [open "timing.ucf" "r"]
|
113 |
|
|
while {![eof $infile]} {
|
114 |
|
|
puts $outfile [gets $infile]
|
115 |
|
|
}
|
116 |
|
|
close $infile
|
117 |
|
|
close $outfile
|
118 |
|
|
#
|
119 |
|
|
puts "Creating new ISE project..."
|
120 |
|
|
cd $bld
|
121 |
|
|
project new $PROJECT.ise
|
122 |
|
|
project set family spartan3
|
123 |
|
|
project set device xc3s1000
|
124 |
|
|
project set package fg456
|
125 |
|
|
project set speed -4
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
###############################################################################
|
129 |
|
|
# Modify the xfile add argument for the source files in the design
|
130 |
|
|
###############################################################################
|
131 |
|
|
|
132 |
|
|
puts "Adding source files..."
|
133 |
|
|
set infile [open "../compile_list" "r"]
|
134 |
|
|
while {![eof $infile]} {
|
135 |
|
|
xfile add "../[gets $infile]"
|
136 |
|
|
}
|
137 |
|
|
xfile add temp.ucf
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
###############################################################################
|
141 |
|
|
# Set optional implementation options here. There is a problem with setting
|
142 |
|
|
# project properties that at least one source must be added to the project
|
143 |
|
|
# first. Therefore, the "project set" commands are after the "xfile add"
|
144 |
|
|
# commands.
|
145 |
|
|
###############################################################################
|
146 |
|
|
|
147 |
|
|
puts "Setting project properties..."
|
148 |
|
|
|
149 |
|
|
project set {Optimization Goal} Area -process {Synthesize - XST}
|
150 |
|
|
project set {Optimization Effort} Normal -process {Synthesize - XST}
|
151 |
|
|
#project set "Map Effort Level" High
|
152 |
|
|
#project set {Perform Timing-Driven Packing and Placement} 1
|
153 |
|
|
project set {Place & Route Effort Level (Overall)} Standard
|
154 |
|
|
#project set "Other Place & Route Command Line Options" "-intsyle xflow"
|
155 |
|
|
project set {Generate Post-Place & Route Static Timing Report} true
|
156 |
|
|
project set {Report Unconstrained Paths} 10 -process {Generate Post-Place & Route Static Timing}
|
157 |
|
|
project set {Report Type} {Verbose Report} -process {Generate Post-Place & Route Static Timing}
|
158 |
|
|
project set {Create Binary Configuration File} 1 -process {Generate Programming File}
|
159 |
|
|
|
160 |
|
|
project close
|