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 |
136 |
olivier.gi |
set rtlIncludeFiles "../../../rtl/verilog/openmsp430/openMSP430_defines.v \
|
59 |
107 |
olivier.gi |
../../../rtl/verilog/openmsp430/openMSP430_undefines.v \
|
60 |
|
|
../../../rtl/verilog/openmsp430/periph/omsp_timerA_defines.v \
|
61 |
|
|
../../../rtl/verilog/openmsp430/periph/omsp_timerA_undefines.v"
|
62 |
82 |
olivier.gi |
|
63 |
|
|
###############################################################################
|
64 |
|
|
# CLEANUP #
|
65 |
|
|
###############################################################################
|
66 |
|
|
|
67 |
|
|
# Cleanup
|
68 |
|
|
file delete -force ./work_synplify
|
69 |
|
|
file delete -force ./work_designer
|
70 |
|
|
file mkdir ./work_synplify
|
71 |
|
|
file mkdir ./work_designer
|
72 |
|
|
cd ./work_synplify
|
73 |
|
|
|
74 |
|
|
# Copy RTL include files
|
75 |
|
|
foreach rtlFile $rtlIncludeFiles {
|
76 |
|
|
file copy $rtlFile .
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
###############################################################################
|
80 |
|
|
# GENERATE SYNTHESIS SCRIPT #
|
81 |
|
|
###############################################################################
|
82 |
|
|
|
83 |
|
|
# Copy Synplify tcl command files
|
84 |
|
|
if [catch {open "../synplify.tcl" r} f_synplify_tcl] {
|
85 |
|
|
puts "ERROR: Cannot open Synplify command file file ../synplify.tcl"
|
86 |
|
|
exit 1
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
set synplify_tcl [read $f_synplify_tcl]
|
90 |
|
|
close $f_synplify_tcl
|
91 |
|
|
|
92 |
|
|
regsub -all {<DEVICE_FAMILY>} $synplify_tcl "[string toupper [lindex $fpgaConfig 0]]" synplify_tcl
|
93 |
|
|
regsub -all {<DEVICE_NAME>} $synplify_tcl "[string toupper [lindex $fpgaConfig 1]]" synplify_tcl
|
94 |
|
|
regsub -all {<DEVICE_PACKAGE>} $synplify_tcl "[string toupper [lindex $fpgaConfig 2]]" synplify_tcl
|
95 |
|
|
regsub -all {<SPEED_GRADE>} $synplify_tcl "[string toupper [lindex $fpgaConfig 4]]" synplify_tcl
|
96 |
|
|
regsub -all {<TOP_LEVEL>} $synplify_tcl $designTop synplify_tcl
|
97 |
|
|
|
98 |
|
|
set f_synplify_tcl [open "synplify.tcl" w]
|
99 |
|
|
puts $f_synplify_tcl $synplify_tcl
|
100 |
|
|
close $f_synplify_tcl
|
101 |
|
|
|
102 |
|
|
###############################################################################
|
103 |
|
|
# GENERATE PLACE & ROUTE SCRIPT #
|
104 |
|
|
###############################################################################
|
105 |
|
|
|
106 |
|
|
cd ../work_designer
|
107 |
|
|
|
108 |
|
|
# Copy Libero Designer tcl command files
|
109 |
|
|
if [catch {open "../libero_designer.tcl" r} f_libero_designer_tcl] {
|
110 |
|
|
puts "ERROR: Cannot open Libero Designer command file file ../libero_designer.tcl"
|
111 |
|
|
exit 1
|
112 |
|
|
}
|
113 |
|
|
set libero_designer_tcl [read $f_libero_designer_tcl]
|
114 |
|
|
close $f_libero_designer_tcl
|
115 |
|
|
|
116 |
|
|
regsub -all {<DEVICE_FAMILY>} $libero_designer_tcl "[lindex $fpgaConfig 0]" libero_designer_tcl
|
117 |
|
|
regsub -all {<DEVICE_NAME>} $libero_designer_tcl "[lindex $fpgaConfig 1]" libero_designer_tcl
|
118 |
|
|
regsub -all {<DEVICE_PACKAGE>} $libero_designer_tcl "[lindex $fpgaConfig 3]" libero_designer_tcl
|
119 |
|
|
regsub -all {<SPEED_GRADE>} $libero_designer_tcl "[lindex $fpgaConfig 4]" libero_designer_tcl
|
120 |
|
|
|
121 |
|
|
set f_libero_designer_tcl [open "libero_designer.tcl" w]
|
122 |
|
|
puts $f_libero_designer_tcl $libero_designer_tcl
|
123 |
|
|
close $f_libero_designer_tcl
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
exit 0
|