OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [synthesis/] [actel/] [run_analysis.tcl] - Blame information for rev 64

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 64 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: run_analysis.tcl
27
# 
28
# Author(s):
29
#             - Olivier Girard,    olgirard@gmail.com
30
#
31
#------------------------------------------------------------------------------
32
# $Rev: 17 $
33
# $LastChangedBy: olivier.girard $
34
# $LastChangedDate: 2009-08-04 23:15:39 +0200 (Tue, 04 Aug 2009) $
35
#------------------------------------------------------------------------------
36
package require Tclx
37
 
38
###############################################################################
39
#                         SET SOME GLOBAL VARIABLES                           #
40
###############################################################################
41
 
42
# Set tools
43
set SYNPLICITY      "C:\\\\Actel\\\\Libero_v8.5\\\\Synplify\\\\synplify_96A\\\\bin\\\\synplify.exe"
44
set LIBERO_DESIGNER "C:\\\\Actel\\\\Libero_v8.5\\\\Designer\\\\bin\\\\designer.exe"
45
 
46
# Set the different FPGA architectures & models to be checked (it should have a FBGA484 package)
47
set fpgaConfigs {{"ProASIC3E"   A3PE1500   {Std -1 -2}}
48
                 {"ProASIC3L"   A3P1000L   {Std -1}}
49
                 {"ProASIC3"    A3P1000    {Std -1 -2}}
50
                 {"Fusion"      AFS1500    {Std -1 -2}}
51
                 {"IGLOOE"      AGLE600V5  {Std}}}
52
 
53
 
54
# Set the different RTL configurations to be analysed
55
set rtlDefines  {PMEM_AWIDTH DMEM_AWIDTH  DBG_EN  DBG_HWBRK_0 DBG_HWBRK_1 DBG_HWBRK_2 DBG_HWBRK_3}
56
set rtlConfigs {{    12          10          0         0            0          0            0    }
57
                {    12          10          1         0            0          0            0    }
58
                {    12          10          1         1            0          0            0    }
59
                {    12          10          1         1            1          0            0    }
60
                {    12          10          1         1            1          1            0    }
61
                {    12          10          1         1            1          1            1    }}
62
 
63
 
64
# RTL configuration files
65
set omspConfigFile "../../rtl/verilog/openMSP430_defines.v"
66
set designFiles    {../../rtl/verilog/openMSP430.v
67
                    ../../rtl/verilog/omsp_frontend.v
68
                    ../../rtl/verilog/omsp_execution_unit.v
69
                    ../../rtl/verilog/omsp_register_file.v
70
                    ../../rtl/verilog/omsp_alu.v
71
                    ../../rtl/verilog/omsp_mem_backbone.v
72
                    ../../rtl/verilog/omsp_clock_module.v
73
                    ../../rtl/verilog/omsp_sfr.v
74
                    ../../rtl/verilog/omsp_watchdog.v
75
                    ../../rtl/verilog/omsp_dbg.v
76
                    ../../rtl/verilog/omsp_dbg_uart.v
77
                    ../../rtl/verilog/omsp_dbg_hwbrk.v
78
                                        ../../rtl/verilog/openMSP430_undefines.v
79
                                        ../../rtl/verilog/timescale.v
80
}
81
 
82
###############################################################################
83
#                              PERFORM ANALYSIS                               #
84
###############################################################################
85
proc sleep {time} {
86
      after [expr $time*1000] set end 1
87
      vwait end
88
  }
89
 
90
# Copy design files
91
foreach designFile $designFiles {
92
        file copy -force $designFile "./src/"
93
}
94
 
95
# Create log file
96
file delete "./run_analysis.log"
97
set f_logFile [open "./run_analysis.log" w]
98
 
99
# Perform analysis
100
foreach rtlConfig $rtlConfigs {
101
 
102
    #-------------------------------------------------------------------------#
103
    #                        Generate RTL configuration                       #
104
    #-------------------------------------------------------------------------#
105
 
106
    # Read original define file
107
    if [catch {open $omspConfigFile r} f_omspConfigFile] {
108
        puts $f_logFile "ERROR: Cannot open file $omspConfigFile"
109
        close $f_logFile
110
        exit 1
111
    }
112
    set configFile [read $f_omspConfigFile]
113
    close $f_omspConfigFile
114
 
115
 
116
    # Update defines
117
    set idx 0
118
    foreach rtlDefine $rtlDefines {
119
 
120
        if {[regsub "`define\\s+$rtlDefine\\s+\\d+" $configFile "`define $rtlDefine [lindex $rtlConfig $idx]" configFile]} {
121
        } else {
122
            if {[lindex $rtlConfig $idx]==0} {
123
                regsub "\\n`define\\s+$rtlDefine" $configFile "\n//`define $rtlDefine" configFile
124
            }
125
        }
126
        set idx [expr $idx+1]
127
    }
128
 
129
 
130
    # Write the new file
131
    set f_configFile [open "./src/[file tail $omspConfigFile]" w]
132
    puts $f_configFile $configFile
133
    close $f_configFile
134
 
135
    #-------------------------------------------------------------------------#
136
    #                      Perform analysis for each FPGA                     #
137
    #-------------------------------------------------------------------------#
138
    foreach fpgaConfig $fpgaConfigs {
139
        foreach speedGrade [lindex $fpgaConfig 2] {
140
 
141
            # Cleanup
142
            file delete -force ./WORK
143
        file mkdir ./WORK
144
        cd ./WORK
145
 
146
            # Copy Synplify tcl command files
147
            if [catch {open "../synplify.tcl" r} f_synplify_tcl] {
148
                puts $f_logFile "ERROR: Cannot open Synplify command file file ../synplify.tcl"
149
                close $f_logFile
150
                exit 1
151
            }
152
            set synplify_tcl [read $f_synplify_tcl]
153
            close $f_synplify_tcl
154
 
155
            regsub -all {<DEVICE_NAME>}   $synplify_tcl "[string toupper [lindex $fpgaConfig 1]]" synplify_tcl
156
            regsub -all {<DEVICE_FAMILY>} $synplify_tcl "[string toupper [lindex $fpgaConfig 0]]" synplify_tcl
157
            regsub -all {<SPEED_GRADE>}   $synplify_tcl "$speedGrade"                             synplify_tcl
158
 
159
            set f_synplify_tcl [open "synplify.tcl" w]
160
            puts $f_synplify_tcl $synplify_tcl
161
            close $f_synplify_tcl
162
 
163
                # Copy Libero Designer tcl command files
164
            if [catch {open "../libero_designer.tcl" r} f_libero_designer_tcl] {
165
                puts $f_logFile "ERROR: Cannot open Libero Designer command file file ../libero_designer.tcl"
166
                close $f_logFile
167
                exit 1
168
            }
169
            set libero_designer_tcl [read $f_libero_designer_tcl]
170
            close $f_libero_designer_tcl
171
 
172
            regsub -all {<DEVICE_NAME>}   $libero_designer_tcl "[lindex $fpgaConfig 1]" libero_designer_tcl
173
            regsub -all {<DEVICE_FAMILY>} $libero_designer_tcl "[lindex $fpgaConfig 0]" libero_designer_tcl
174
            regsub -all {<SPEED_GRADE>}   $libero_designer_tcl "$speedGrade"            libero_designer_tcl
175
 
176
            set f_libero_designer_tcl [open "libero_designer.tcl" w]
177
            puts $f_libero_designer_tcl $libero_designer_tcl
178
            close $f_libero_designer_tcl
179
 
180
            # Run synthesis
181
            puts $f_logFile "#####################################################################################"
182
            puts $f_logFile "#                            START SYNTHESIS"
183
            puts $f_logFile "#===================================================================================="
184
            puts $f_logFile "# [lindex $fpgaConfig 0] ([lindex $fpgaConfig 1]), speedgrade: $speedGrade"
185
            puts $f_logFile "#===================================================================================="
186
            puts $f_logFile "# $rtlDefines"
187
            puts $f_logFile "# $rtlConfig"
188
            puts $f_logFile "#===================================================================================="
189
                flush $f_logFile
190
 
191
                # Run synthesis
192
                set synplify_done 0
193
                while {[string eq $synplify_done 0]} {
194
 
195
                        sleep 10
196
                        eval exec $SYNPLICITY synplify.tcl
197
                        sleep 30
198
 
199
                        # Wait until EDIF file is generated
200
                        set synplify_timeout 0
201
 
202
#                       puts  $f_logFile "START LOOP: $synplify_timeout ($synplify_done)"
203
#                       flush $f_logFile
204
 
205
                        while {!([file exists "./rev_1/design_files.edn"] | ($synplify_timeout==100))} {
206
                                sleep 6
207
#                               puts  $f_logFile "YOPYOP: $synplify_timeout"
208
#                               flush $f_logFile
209
                                set synplify_timeout [expr $synplify_timeout+1]
210
                        }
211
                        if ($synplify_timeout<100) {
212
                           set synplify_done 1
213
                        }
214
#                       puts  $f_logFile "DONE: $synplify_timeout ($synplify_done)"
215
#                       flush $f_logFile
216
 
217
                        # Kill the Synplify task with taskkill since it can't be properly closed with the synplify.tcl script
218
                        sleep 10
219
                        eval exec taskkill /IM synplify.exe
220
                        sleep 20
221
                        if {[string eq $synplify_done 0]} {
222
                                sleep 180
223
                        }
224
                }
225
#               puts  $f_logFile "SYNPLIFY DONE: $synplify_timeout ($synplify_done)"
226
#               flush $f_logFile
227
 
228
                # Run place & route
229
                eval exec $LIBERO_DESIGNER script:libero_designer.tcl logfile:libero_designer.log
230
 
231
 
232
                # Extract timing information
233
            if [catch {open "report_timing_max.txt" r} f_timing] {
234
                    puts $f_logFile "ERROR: Cannot open timing file"
235
                        close $f_logFile
236
                    exit 1
237
            }
238
            set timingFile [read $f_timing]
239
            close $f_timing
240
                regexp {SUMMARY(.*)END SUMMARY} $timingFile whole_match timing
241
            puts $f_logFile $timing
242
            puts $f_logFile "===================================================================================="
243
 
244
            # Extract size information
245
            if [catch {open "report_status.txt" r} f_area] {
246
                puts $f_logFile "ERROR: Cannot open status file: report_status.txt"
247
                close $f_logFile
248
                exit 1
249
            }
250
            set areaFile [read $f_area]
251
            close $f_area
252
            regexp {(Compile report:.*?)Total:} $areaFile whole_match area1
253
            regexp {(Core Information:.*?)I/O Function:} $areaFile whole_match area2
254
            puts $f_logFile $area1
255
            puts $f_logFile $area2
256
            puts $f_logFile "===================================================================================="
257
 
258
            puts $f_logFile "#                            SYNTHESIS DONE"
259
            puts $f_logFile "#####################################################################################"
260
            puts $f_logFile ""
261
                flush $f_logFile
262
            cd ../
263
                sleep 3
264
        }
265
    }
266
 
267
}
268
puts $f_logFile ""
269
puts $f_logFile "#####################################################################################"
270
puts $f_logFile "#                            ANALYSIS DONE"
271
puts $f_logFile "#####################################################################################"
272
puts $f_logFile ""
273
close $f_logFile
274
exit 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.