1 |
82 |
olivier.gi |
#!/usr/bin/tclsh
|
2 |
|
|
#------------------------------------------------------------------------------
|
3 |
|
|
# Copyright (C) 2001 Authors
|
4 |
|
|
#
|
5 |
|
|
# This source file may be used and distributed without restriction provided
|
6 |
|
|
# that this copyright statement is not removed from the file and that any
|
7 |
|
|
# derivative work contains the original copyright notice and the associated
|
8 |
|
|
# disclaimer.
|
9 |
|
|
#
|
10 |
|
|
# This source file is free software; you can redistribute it and/or modify
|
11 |
|
|
# it under the terms of the GNU Lesser General Public License as published
|
12 |
|
|
# by the Free Software Foundation; either version 2.1 of the License, or
|
13 |
|
|
# (at your option) any later version.
|
14 |
|
|
#
|
15 |
|
|
# This source is distributed in the hope that it will be useful, but WITHOUT
|
16 |
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
18 |
|
|
# License for more details.
|
19 |
|
|
#
|
20 |
|
|
# You should have received a copy of the GNU Lesser General Public License
|
21 |
|
|
# along with this source; if not, write to the Free Software Foundation,
|
22 |
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
23 |
|
|
#
|
24 |
|
|
#------------------------------------------------------------------------------
|
25 |
|
|
#
|
26 |
|
|
# File Name: prepare_implementation.tcl
|
27 |
|
|
#
|
28 |
|
|
# Description: This script will prepare the Synplify and Libero Designer
|
29 |
|
|
# working directories and scripts.
|
30 |
|
|
#
|
31 |
|
|
# 1 - The synthesis can be first started from the "work_synplify"
|
32 |
|
|
# directory by executing the "synplify.tcl" script from Synplify.
|
33 |
|
|
#
|
34 |
|
|
# 2 - The Place & Route step can be then started from the
|
35 |
|
|
# "work_designer" directory by executing the "libero_designer.tcl"
|
36 |
|
|
# script from the Libero Designer program.
|
37 |
|
|
#
|
38 |
|
|
# Author(s):
|
39 |
|
|
# - Olivier Girard, olgirard@gmail.com
|
40 |
|
|
#
|
41 |
|
|
#------------------------------------------------------------------------------
|
42 |
|
|
# $Rev: 17 $
|
43 |
|
|
# $LastChangedBy: olivier.girard $
|
44 |
|
|
# $LastChangedDate: 2009-08-04 23:15:39 +0200 (Tue, 04 Aug 2009) $
|
45 |
|
|
#------------------------------------------------------------------------------
|
46 |
|
|
|
47 |
|
|
###############################################################################
|
48 |
|
|
# SET SOME GLOBAL VARIABLES #
|
49 |
|
|
###############################################################################
|
50 |
|
|
|
51 |
|
|
# Set the FPGA: architecture, model, package_syn package_libero, speed-grade
|
52 |
|
|
set fpgaConfig { ProASIC3L M1A3P1000L FBGA484 "484 FBGA" Std}
|
53 |
|
|
|
54 |
|
|
# RTL Top Level module
|
55 |
|
|
set designTop "openMSP430_fpga"
|
56 |
|
|
|
57 |
|
|
# RTL include files
|
58 |
|
|
set rtlIncludeFiles "../../../rtl/verilog/openmsp430/timescale.v \
|
59 |
|
|
../../../rtl/verilog/openmsp430/openMSP430_defines.v \
|
60 |
|
|
../../../rtl/verilog/openmsp430/openMSP430_undefines.v"
|
61 |
|
|
|
62 |
|
|
###############################################################################
|
63 |
|
|
# CLEANUP #
|
64 |
|
|
###############################################################################
|
65 |
|
|
|
66 |
|
|
# Cleanup
|
67 |
|
|
file delete -force ./work_synplify
|
68 |
|
|
file delete -force ./work_designer
|
69 |
|
|
file mkdir ./work_synplify
|
70 |
|
|
file mkdir ./work_designer
|
71 |
|
|
cd ./work_synplify
|
72 |
|
|
|
73 |
|
|
# Copy RTL include files
|
74 |
|
|
foreach rtlFile $rtlIncludeFiles {
|
75 |
|
|
file copy $rtlFile .
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
###############################################################################
|
79 |
|
|
# GENERATE SYNTHESIS SCRIPT #
|
80 |
|
|
###############################################################################
|
81 |
|
|
|
82 |
|
|
# Copy Synplify tcl command files
|
83 |
|
|
if [catch {open "../synplify.tcl" r} f_synplify_tcl] {
|
84 |
|
|
puts "ERROR: Cannot open Synplify command file file ../synplify.tcl"
|
85 |
|
|
exit 1
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
set synplify_tcl [read $f_synplify_tcl]
|
89 |
|
|
close $f_synplify_tcl
|
90 |
|
|
|
91 |
|
|
regsub -all {<DEVICE_FAMILY>} $synplify_tcl "[string toupper [lindex $fpgaConfig 0]]" synplify_tcl
|
92 |
|
|
regsub -all {<DEVICE_NAME>} $synplify_tcl "[string toupper [lindex $fpgaConfig 1]]" synplify_tcl
|
93 |
|
|
regsub -all {<DEVICE_PACKAGE>} $synplify_tcl "[string toupper [lindex $fpgaConfig 2]]" synplify_tcl
|
94 |
|
|
regsub -all {<SPEED_GRADE>} $synplify_tcl "[string toupper [lindex $fpgaConfig 4]]" synplify_tcl
|
95 |
|
|
regsub -all {<TOP_LEVEL>} $synplify_tcl $designTop synplify_tcl
|
96 |
|
|
|
97 |
|
|
set f_synplify_tcl [open "synplify.tcl" w]
|
98 |
|
|
puts $f_synplify_tcl $synplify_tcl
|
99 |
|
|
close $f_synplify_tcl
|
100 |
|
|
|
101 |
|
|
###############################################################################
|
102 |
|
|
# GENERATE PLACE & ROUTE SCRIPT #
|
103 |
|
|
###############################################################################
|
104 |
|
|
|
105 |
|
|
cd ../work_designer
|
106 |
|
|
|
107 |
|
|
# Copy Libero Designer tcl command files
|
108 |
|
|
if [catch {open "../libero_designer.tcl" r} f_libero_designer_tcl] {
|
109 |
|
|
puts "ERROR: Cannot open Libero Designer command file file ../libero_designer.tcl"
|
110 |
|
|
exit 1
|
111 |
|
|
}
|
112 |
|
|
set libero_designer_tcl [read $f_libero_designer_tcl]
|
113 |
|
|
close $f_libero_designer_tcl
|
114 |
|
|
|
115 |
|
|
regsub -all {<DEVICE_FAMILY>} $libero_designer_tcl "[lindex $fpgaConfig 0]" libero_designer_tcl
|
116 |
|
|
regsub -all {<DEVICE_NAME>} $libero_designer_tcl "[lindex $fpgaConfig 1]" libero_designer_tcl
|
117 |
|
|
regsub -all {<DEVICE_PACKAGE>} $libero_designer_tcl "[lindex $fpgaConfig 3]" libero_designer_tcl
|
118 |
|
|
regsub -all {<SPEED_GRADE>} $libero_designer_tcl "[lindex $fpgaConfig 4]" libero_designer_tcl
|
119 |
|
|
|
120 |
|
|
set f_libero_designer_tcl [open "libero_designer.tcl" w]
|
121 |
|
|
puts $f_libero_designer_tcl $libero_designer_tcl
|
122 |
|
|
close $f_libero_designer_tcl
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
exit 0
|