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

Subversion Repositories radiohdl

[/] [radiohdl/] [trunk/] [base/] [modelsim_config] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 danv
#! /usr/bin/env python
2
###############################################################################
3
#
4
# Copyright (C) 2014
5
# ASTRON (Netherlands Institute for Radio Astronomy) 
6
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
7
#
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
12
#
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
# GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License
19
# along with this program.  If not, see .
20
#
21
###############################################################################
22
 
23
"""HDL configuration for building Modelsim simulation targets.
24
 
25
   Usage:
26
   > python $RADIOHDL/tools/oneclick/base/modelsim_config.py -t unb1
27
"""
28
 
29
import sys
30
import os.path
31
from os             import listdir
32
from argparse       import ArgumentParser
33
import common as cm
34
import hdl_libraries_wizard
35
 
36
class ModelsimConfig(hdl_config.HdlLibrariesWizard):
37
 
38
    def __init__(self, toolRootDir, buildsetFile, libFileName):
39
        """Get Modelsim tool info from toolRootDir and all HDL library info from libRootDir.
40
 
41
           This class uses the default keys and the keys from the libFileSections in the libFileName config file.
42
 
43
           Arguments:
44
           - toolRootDir     : Root directory from where the hdl_buildset_.cfg file is searched for.
45
           - buildsetFile    : Default HDL tools configuration file name
46
           - libFileName     : Default HDL library configuration file name
47
 
48
           The libRootDir is defined in the hdl_buildset_.cfg file and is the root directory from where the hdllib.cfg
49
           files are searched for.
50
 
51
           Files:
52
           - hdl_buildset_.cfg : HDL tool configuration dictionary file. One central file per buildset.
53
 
54
           - hdllib.cfg : HDL library configuration dictionary file. One file for each HDL library.
55
 
56
           - modelsim_project_files.txt
57
             The modelsim_project_files.txt file is a dictionary file with the list the Modelsim project files for all HDL
58
             libraries that were found in the libRootDir. The keys are the library names and the values are the paths to the
59
             corresponding modelsim project files. The modelsim_project_files.txt file is created by
60
             create_modelsim_project_files_file() and is read by the TCL commands.do file in Modelsim. Creating the file in
61
             Python and then reading this in TCL makes the commands.do much simpler.
62
 
63
           - .mpf : Modelsim project file for a certain HDL library based on the hdllib.cfg. The file is created by
64
             create_modelsim_project_file().
65
 
66
           - _lib_order.txt
67
             The _lib_order.txt file contains the library compile order for a certain HDL library. The files are
68
             created by create_lib_order_files() in the same build directory as where the Modelsim project file is stored.
69
             The _lib_order.txt files are read by the TCL commands.do file in Modelsim. Creating the files in Python
70
             and then reading them in TCL makes the commands.do much simpler.
71
        """
72
        libFileSections=['modelsim_project_file']
73
        hdl_config.HdlLibrariesWizard.__init__(self, toolRootDir, buildsetFile, libFileName, libFileSections)
74
 
75
    def read_compile_order_from_mpf(self, mpfPathName):
76
        """Utility to read the compile order of the project files from an existing .mpf."""
77
        # read .mpf to find all project files
78
        project_file_indices = []
79
        project_file_names = []
80
        with open(mpfPathName, 'r') as fp:
81
            for line in fp:
82
                words = line.split()
83
                if len(words)>0:
84
                    key = words[0]
85
                    if key.find('Project_File_')>=0 and key.find('Project_File_P_')==-1:
86
                        project_file_indices.append(key[len('Project_File_'):])
87
                        project_file_names.append(words[2])
88
        # read .mpf again to find compile order for the project files
89
        compile_order = range(len(project_file_names))
90
        with open(mpfPathName, 'r') as fp:
91
            for line in fp:
92
                words = line.split()
93
                if len(words)>0:
94
                    key = words[0]
95
                    if key.find('Project_File_P_')>=0:
96
                        project_file_index = project_file_indices.index(key[len('Project_File_P_'):])
97
                        project_file_name = project_file_names[project_file_index]
98
                        k = words.index('compile_order')
99
                        k = int(words[k+1])
100
                        compile_order[k]=project_file_name
101
        return compile_order
102
 
103
    def read_hdl_libraries_technology_file(self, technologyName, filePath=None):
104
        """Read the list of technology HDL libraries from a file.
105
 
106
           Arguments:
107
           - technologyName : refers to the hdl_libraries_.txt file
108
           - filePath       : path to hdl_libraries_.txt, when None then the file is
109
                              read in the default toolRootDir
110
        """
111
        fileName = 'hdl_libraries_' + technologyName + '.txt'         # use fixed file name format
112
        if filePath==None:
113
            toolDir    = os.path.expandvars('$HDL_BUILD_DIR')
114
            toolSubDir = self.buildset['buildset_name']
115
            fileNamePath=join(toolDir, toolSubDir, fileName)          # default file path
116
        else:
117
            fileNamePath=join(filePath, fileName)                     # specified file path
118
        tech_dict = ConfigFile(fileNamePath).content
119
        return tech_dict
120
 
121
 
122
    def create_modelsim_lib_compile_ip_files(self, lib_names=None):
123
        """
124
        Create the '_lib_compile_ip.txt' file for all HDL libraries in the specified list of lib_names.
125
        The file is stored in the sim build directory of the HDL library.
126
        The file is read by commands.do in Modelsim to know which IP needs to be compiled before the library is compiled.
127
        """
128
        if lib_names==None:
129
            lib_names=self.lib_names
130
 
131
        count     = 0
132
        lib_dicts = self.libs.get_configfiles(key='hdl_lib_name', values=lib_names)
133
        for lib_dict in lib_dicts:
134
            if 'modelsim_compile_ip_files' in lib_dict.content:
135
                count += 1
136
                compile_ip_files = lib_dict['modelsim_compile_ip_files'].split()
137
                lib_name = lib_dict['hdl_lib_name']
138
                file_name = lib_name + '_lib_compile_ip.txt'
139
                file_path = self.get_lib_build_dirs('sim', lib_dicts=lib_dict)
140
                cm.mkdir(file_path)
141
                filePathName = os.path.join(file_path, file_name)
142
                with open(filePathName, 'w') as fp:
143
                    for fpn in compile_ip_files:
144
                        # Write the expanded file path name for _lib_compile_ip.txt so that it can be executed directly from its location in SVN using the Modelsim "do"-command in the commands.do.
145
                        # An alternative would be to write the basename, so only _lib_compile_ip.txt, but that would require copying the basename file to the mpf build directory
146
                        efpn = os.path.expandvars(fpn)
147
                        fp.write('%s ' % efpn)
148
        print "Created {} compile-ip files".format(count)
149
 
150
 
151
    def simulation_configuration(self, list_mode=False):
152
        """Prepare settings for simulation configuration.
153
           The output format is string or list, dependent on list_mode.
154
           Return tuple of project_sim_p_defaults, project_sim_p_search_libraries, project_sim_p_otherargs, project_sim_p_optimization.
155
        """
156
        # project_sim_p_defaults
157
        project_sim_p_defaults = 'Generics {} timing default -std_output {} -nopsl 0 +notimingchecks 0 selected_du {} -hazards 0 -sdf {} ok 1 -0in 0 -nosva 0 +pulse_r {} -absentisempty 0 -multisource_delay {} +pulse_e {} vopt_env 1 -coverage 0 -sdfnoerror 0 +plusarg {} -vital2.2b 0 -t default -memprof 0 is_vopt_flow 0 -noglitch 0 -nofileshare 0 -wlf {} -assertdebug 0 +no_pulse_msg 0 -0in_options {} -assertfile {} -sdfnowarn 0 -Lf {} -std_input {}'
158
 
159
        # project_sim_p_search_libraries
160
        if list_mode:
161
            project_sim_p_search_libraries = self.buildset['modelsim_search_libraries'].split()
162
        else:
163
            project_sim_p_search_libraries = '-L {}'
164
            if 'modelsim_search_libraries' in self.buildset:
165
                project_sim_p_search_libraries = '-L {'
166
                for sl in self.buildset['modelsim_search_libraries'].split():
167
                    project_sim_p_search_libraries += sl
168
                    project_sim_p_search_libraries += ' '
169
                project_sim_p_search_libraries += '}'
170
 
171
        # project_sim_p_otherargs
172
        # Note:
173
        #   E.g. the vsim-8684 load warning does not occur when the simulation is loaded via double click, but it
174
        #   does occur when the simulation is relaoded via the command line, because in the command line history
175
        #   the +nowarn8684 is then for some reason not preserved by Modelsim.
176
        otherargs = ''
177
        otherargs = '+nowarn8684 +nowarn8683 -quiet'
178
        otherargs = '+nowarn8684 +nowarn8683'
179
        otherargs = '+nowarn8684 +nowarn8683 +nowarnTFMPC +nowarnPCDPC'  # nowarn on verilog IP connection mismatch warnings
180
        if list_mode:
181
            project_sim_p_otherargs = otherargs.split()
182
        else:
183
            project_sim_p_otherargs = 'OtherArgs {' + otherargs + '}'
184
 
185
        # project_sim_p_optimization
186
        project_sim_p_optimization = 'is_vopt_opt_used 2'  # = when 'Enable optimization' is not selected in GUI
187
        project_sim_p_optimization = 'is_vopt_opt_used 1 voptargs {OtherVoptArgs {} timing default VoptOutFile {} -vopt_keep_delta 0 -0in 0 -fvopt {} VoptOptimize:method 1 -vopt_00 2 +vopt_notimingcheck 0 -Lfvopt {} VoptOptimize:list .vopt_opt.nb.canvas.notebook.cs.page1.cs.g.spec.listbox -Lvopt {} +vopt_acc {} VoptOptimize .vopt_opt.nb.canvas.notebook.cs.page1.cs -vopt_hazards 0 VoptOptimize:Buttons .vopt_opt.nb.canvas.notebook.cs.page1.cs.g.spec.bf 0InOptionsWgt .vopt_opt.nb.canvas.notebook.cs.page3.cs.zf.ze -0in_options {}}' # = when 'Enable optimization' is selected in GUI for full visibility
188
 
189
        return project_sim_p_defaults, project_sim_p_search_libraries, project_sim_p_otherargs, project_sim_p_optimization
190
 
191
 
192
    def create_modelsim_project_file(self, lib_names=None):
193
        """
194
        Create the Modelsim project file for all technology libraries and RTL HDL libraries.
195
 
196
        Arguments:
197
        - lib_names       : one or more HDL libraries
198
 
199
        Library mapping:
200
        - Technology libraries that are available, but not used are mapped to work.
201
        - Unavailable libraries are also mapped to work. The default library clause name is 
202
          with postfix '_lib'. This is a best effort guess, because it is impossible to know the library clause name
203
          for an unavailable library. If the best effort guess is not suitable, then the workaround is to create a
204
          place holder directory with hdllib.cfg that defines the actual library clause name as it appears in the
205
          VHDL for the unavailable HDL library. unavailable library names occur when e.g. a technology IP library
206
          is not available in the toolRootDir because it is not needed, or it may indicate a spelling error.
207
        """
208
        if lib_names==None:
209
            lib_names=self.lib_names
210
 
211
        lib_dicts = self.libs.get_configfiles(key='hdl_lib_name', values=lib_names)
212
        print "SELF.BUILDSET=", self.buildset
213
        for lib_dict in lib_dicts:
214
            # Open mpf
215
            lib_name = lib_dict['hdl_lib_name']
216
            mpf_name = lib_name + '.mpf'
217
            mpf_path = self.get_lib_build_dirs('sim', lib_dicts=lib_dict)
218
            cm.mkdir(mpf_path)
219
            mpfPathName = os.path.join(mpf_path, mpf_name)
220
            with open(mpfPathName, 'w') as fp:
221
                # Write [Library] section for all used libraries
222
                fp.write('[Library]\n')
223
 
224
                # . map used vendor technology libs to their target directory
225
                for technologyName in self.technologyNames:
226
                    tech_dict = self.read_hdl_libraries_technology_file(technologyName)
227
                    for lib_clause, lib_work in tech_dict.iteritems():
228
                        fp.write('%s = %s\n' % (lib_clause, lib_work))
229
 
230
                # . not used vendor technology libs are not compiled but are mapped to work to avoid compile error when mentioned in the LIBRARY clause
231
                for removed_lib in sorted(self.removed_libs):
232
                    fp.write('%s = work\n' % self.removed_libs[removed_lib]['hdl_library_clause_name'])
233
 
234
                # . unavailable used libs are not compiled but are mapped to work to avoid compile error when mentioned in the LIBRARY clause
235
                for unavailable_use_name in sorted(self.unavailable_use_libs):
236
                    # if the unavailable library is not in the dictionary of disclosed unavailable library clause names, then assume that the library clause
237
                    # name has the default postfix '_lib'.
238
                    if unavailable_use_name in self.disclosed_library_clause_names:
239
                        fp.write('%s = work\n' % self.disclosed_library_clause_names[unavailable_use_name])
240
                    else:
241
                        fp.write('%s_lib = work\n' % unavailable_use_name)
242
 
243
                # . all used libs for this lib_name
244
                use_lib_names          = self.derive_all_use_libs('sim', lib_name)
245
                use_lib_dicts          = self.libs.get_configfiles(key='hdl_lib_name', values=use_lib_names)
246
                use_lib_build_sim_dirs = self.get_lib_build_dirs('sim', lib_dicts=use_lib_dicts)
247
                use_lib_clause_names   = self.libs.get_key_values('hdl_library_clause_name', use_lib_dicts)
248
                for lib_clause, lib_dir in zip(use_lib_clause_names, cm.listify(use_lib_build_sim_dirs)):
249
                    lib_work = os.path.join(lib_dir, 'work')
250
                    fp.write('%s = %s\n' % (lib_clause, lib_work))
251
 
252
                # . work
253
                fp.write('work = work\n')
254
 
255
                # . others modelsim default libs
256
                model_tech_dir = os.path.expandvars(self.buildset['modelsim_dir'])
257
                fp.write('others = %s\n' % os.path.join(model_tech_dir, 'modelsim.ini'))
258
 
259
                # Write [Project] section for all used libraries
260
                fp.write('[Project]\n')
261
                fp.write('Project_Version = 6\n')  # must be >= 6 to fit all
262
                fp.write('Project_DefaultLib = work\n')
263
                fp.write('Project_SortMethod = unused\n')
264
 
265
                # - project files
266
                synth_files      = lib_dict['synth_files'].split()
267
                test_bench_files = lib_dict['test_bench_files'].split()
268
                project_files    = synth_files + test_bench_files
269
                if 'modelsim_compile_ip_files' in lib_dict.content:
270
                    compile_ip_files = lib_dict['modelsim_compile_ip_files'].split()
271
                    project_files += compile_ip_files
272
                fp.write('Project_Files_Count = %d\n' % len(project_files))
273
                for i, fn in enumerate(project_files):
274
                    filePathName = cm.expand_file_path_name(fn, lib_dict.location)
275
                    fp.write('Project_File_%d = %s\n' % (i, filePathName))
276
 
277
                project_file_p_defaults_hdl     = 'vhdl_novitalcheck 0 group_id 0 cover_nofec 0 vhdl_nodebug 0 vhdl_1164 1 vhdl_noload 0 vhdl_synth 0 vhdl_enable0In 0 vlog_1995compat 0 last_compile 0 vhdl_disableopt 0 cover_excludedefault 0 vhdl_vital 0 vhdl_warn1 1 vhdl_warn2 1 vhdl_explicit 1 vhdl_showsource 0 cover_covercells 0 vhdl_0InOptions {} vhdl_warn3 1 vlog_vopt {} cover_optlevel 3 voptflow 1 vhdl_options {} vhdl_warn4 1 toggle - ood 0 vhdl_warn5 1 cover_noshort 0 compile_to work cover_nosub 0 dont_compile 0 vhdl_use93 2002 cover_stmt 1'
278
                project_file_p_defaults_vhdl    = 'file_type vhdl'
279
                project_file_p_defaults_verilog = 'file_type verilog'
280
                project_file_p_defaults_tcl     = 'last_compile 0 compile_order -1 file_type tcl group_id 0 dont_compile 1 ood 1'
281
 
282
                project_folders = []
283
                offset = 0
284
 
285
                nof_synth_files = len(synth_files)
286
                if nof_synth_files>0:
287
                    project_folders.append('synth_files')
288
                    for i in range(nof_synth_files):
289
 
290
                        # Add file type specific settings
291
                        file_ext = synth_files[i].split('.')[-1]
292
                        if file_ext=='vhd' or file_ext=='vhdl':
293
                            project_file_p_defaults_file_specific = project_file_p_defaults_vhdl
294
                        elif file_ext=='v':
295
                             project_file_p_defaults_file_specific = project_file_p_defaults_verilog
296
                        else:
297
                             print '\nERROR - Undefined file extension in synth_files:', lib_name, synth_files[i]
298
                             sys.exit()
299
 
300
                        fp.write('Project_File_P_%d = folder %s compile_order %d %s\n' % (offset+i, project_folders[-1], offset+i, project_file_p_defaults_hdl+' '+project_file_p_defaults_file_specific))
301
                offset = nof_synth_files
302
 
303
                nof_test_bench_files = len(test_bench_files)
304
                if nof_test_bench_files>0:
305
                    project_folders.append('test_bench_files')
306
                    for i in range(nof_test_bench_files):
307
 
308
                        # Add file type specific settings
309
                        file_ext = test_bench_files[i].split('.')[-1]
310
                        if file_ext=='vhd' or file_ext=='vho' or file_ext=='vhdl':
311
                            project_file_p_defaults_file_specific = project_file_p_defaults_vhdl
312
                        elif file_ext=='v':
313
                            project_file_p_defaults_file_specific = project_file_p_defaults_verilog
314
                        else:
315
                            print '\nERROR - Undefined file extension in test_bench_files:', lib_name, test_bench_files[i]
316
                            sys.exit()
317
 
318
                        fp.write('Project_File_P_%d = folder %s compile_order %d %s\n' % (offset+i, project_folders[-1], offset+i, project_file_p_defaults_hdl+' '+project_file_p_defaults_file_specific))
319
                offset += nof_test_bench_files
320
 
321
                if 'modelsim_compile_ip_files' in lib_dict.content:
322
                    nof_compile_ip_files = len(compile_ip_files)
323
                    if nof_compile_ip_files>0:
324
                        project_folders.append('compile_ip_files')
325
                        for i in range(nof_compile_ip_files):
326
                            fp.write('Project_File_P_%d = folder %s compile_order %d %s\n' % (offset+i, project_folders[-1], offset+i, project_file_p_defaults_tcl))
327
                    offset += nof_compile_ip_files
328
 
329
                # - project folders
330
                fp.write('Project_Folder_Count = %d\n' % len(project_folders))
331
                for i, fd in enumerate(project_folders):
332
                    fp.write('Project_Folder_%d = %s\n' % (i, fd))
333
                    fp.write('Project_Folder_P_%d = folder {Top Level}\n' % i)
334
 
335
                # - simulation configurations
336
                fp.write('Project_Sim_Count = %d\n' % len(test_bench_files))
337
                project_sim_p_defaults, project_sim_p_search_libraries, project_sim_p_otherargs, project_sim_p_optimization = self.simulation_configuration()
338
                for i, fn in enumerate(test_bench_files):
339
                    fName = os.path.basename(fn)
340
                    tbName = os.path.splitext(fName)[0]
341
                    fp.write('Project_Sim_%d = %s\n' % (i, tbName))
342
                for i, fn in enumerate(test_bench_files):
343
                    fName = os.path.basename(fn)
344
                    tbName = os.path.splitext(fName)[0]
345
                    fp.write('Project_Sim_P_%d = folder {Top Level} additional_dus work.%s %s %s %s %s\n' % (i, tbName, project_sim_p_defaults, project_sim_p_search_libraries, project_sim_p_otherargs, project_sim_p_optimization))
346
 
347
                # Write [vsim] section
348
                fp.write('[vsim]\n')
349
                fp.write('RunLength = 0 ps\n')
350
                fp.write('resolution = 1fs\n')
351
                fp.write('IterationLimit = 5000\n')       # According to 'verror 3601' the default is 5000, typically 100 is enough, but e.g. the ip_stratixiv_phy_xaui_0 requires more.
352
                fp.write('DefaultRadix = decimal\n')
353
        print "Created {} project files".format(len(lib_dicts))
354
 
355
    def create_modelsim_project_files_file(self, lib_names=None):
356
        """Create file with list of the Modelsim project files for all HDL libraries.
357
 
358
           Arguments:
359
           - lib_names  : one or more HDL libraries
360
        """
361
        fileName = 'modelsim_project_files.txt'                                              # use fixed file name
362
        build_maindir, build_buildsetdir, build_tooldir, project_deeper_subdir = self.get_tool_build_dir('sim')
363
        fileNamePath=os.path.join(build_maindir, build_buildsetdir, build_tooldir, fileName)  # and use too build dir for file path
364
        if lib_names==None:
365
            lib_names=self.lib_names
366
        with open(fileNamePath, 'w') as fp:
367
            lib_dicts = self.libs.get_configfiles(key='hdl_lib_name', values=lib_names)
368
            mpf_paths = self.get_lib_build_dirs('sim', lib_dicts=lib_dicts)
369
            for lib_name, mpf_path in zip(cm.listify(lib_names),cm.listify(mpf_paths)):
370
                fp.write('%s = %s\n' % (lib_name, mpf_path))
371
        print "Created project file {}".format(fileNamePath)
372
 
373
 
374
if __name__ == '__main__':
375
    # Mode
376
    # 0 = Create Modelsim mpf files for all hdllib.cfg
377
    # 1 = Read compile order from mpf for a single  and write itinto the hdllib.cfg.
378
    #     This is useful to avoid having to manually edit the compile order for an existing $UNB .mpf into the hdllib.cfg.
379
    #     The compile order is important for the synth_files that need to be in hierarchical order. The test_bench_files are typically
380
    #     independent so these may be put in alphabetical order. The compile order is read from the .mpf and saved in the
381
    #     hdllib.cfg. The hdllib.cfg still does need some manual editing to set the proper key and paths.
382
    mode = 0
383
 
384
    buildsetSelect = sorted([cfgfile[13:-4] for cfgfile in listdir(os.path.expandvars('$HDL_CONFIG_DIR'))
385
                                                if cfgfile.startswith("hdl_buildset_") and cfgfile.endswith(".cfg")])
386
    # Parse command line arguments
387
    argparser = ArgumentParser(description='Modelsim creates/updates all your modelsim environment(s).')
388
    argparser.add_argument('buildset',         help='choose buildset %s' % (buildsetSelect))
389
    argparser.add_argument('-v','--verbosity', required=False, type=int, default=0, help='verbosity >= 0 for more info')
390
    args = argparser.parse_args()
391
 
392
    # check arguments
393
    if args.buildset not in buildsetSelect:
394
        print 'buildset %s is not supported' % args.buildset
395
        print "Supported buildset are:", buildsetSelect
396
        sys.exit(1)
397
    args.buildsetFile = 'hdl_buildset_' + args.buildset + '.cfg'
398
 
399
    # Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
400
    msim = ModelsimConfig(toolRootDir  = os.path.expandvars('$HDL_CONFIG_DIR'),
401
                          buildsetFile = args.buildsetFile,
402
                          libFileName  = 'hdllib.cfg')
403
 
404
    if mode==0:
405
        # Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
406
        if args.verbosity>=2:
407
            print '#'
408
            print '# ModelsimConfig:'
409
            print '#'
410
            print ''
411
            print 'HDL library paths that are found in %s:' % msim.libRootDirs
412
            for lib in sorted(msim.libs.configfiles.values()):
413
                print '    ', lib.location
414
 
415
        if args.verbosity>=2:
416
            print ''
417
            print 'Build directories for simulation:'
418
            for sim_dir in msim.get_lib_build_dirs('sim'):
419
                print '    ', sim_dir
420
 
421
        print ''
422
        print 'Create library compile order files for simulation...'
423
        msim.create_lib_order_files('sim')
424
        sys.exit(0)
425
 
426
        print ''
427
        print 'Create library compile ip files...'
428
        msim.create_modelsim_lib_compile_ip_files()
429
 
430
        print ''
431
        print 'Create modelsim projects list file...'
432
        msim.create_modelsim_project_files_file()
433
 
434
        print ''
435
        print 'Create sub directory in project dir for all HDL libraries that are found in %s...' % msim.libRootDirs
436
        msim.create_sub_directory_in_build_lib_dir('sim', 'mmfiles')    # should match c_mmf_local_dir_path in mm_file_pkg.vhd
437
 
438
        print ''
439
        print 'Copy directories and files from HDL library source tree to project dir for all HDL libraries that are found in %s...' % msim.libRootDirs
440
        msim.copy_files('sim')
441
 
442
        print ''
443
        print 'Create Modelsim Project Files for technology %s and all HDL libraries in %s...' % (msim.technologyNames, msim.libRootDirs)
444
        msim.create_modelsim_project_file()
445
 
446
    if mode==1:
447
        #for lib_name in ['ado','ap','bf','bist','blp','bp','cdo','cim','cir','cp','cr','dc','eth','fmf','i2c','lvds','pfs','pft2','rcuh','ri','rsp','rsr','rsu','sens','serdes','si','st','tbbi','tdsh']:
448
        for lib_name in ['tst']:
449
            # Read compile order from existing .mpf
450
            # First manually create rudimentary hdllib.cfg file for the library with lib name and clause filled in. Then run this script to get
451
            # the ordered list of src and tb files. Then manualy edit the hdllib.cfg to put the files at the synth or sim key.
452
            #mpfPathName = os.path.expandvars('$UNB/Firmware/designs/%s/build/synth/quartus/sopc_%s_sim/%s.mpf' % (lib_name, lib_name, lib_name))
453
            #mpfPathName = os.path.expandvars('$UNB/Firmware/modules/Lofar/%s/build/sim/modelsim/%s.mpf' % (lib_name, lib_name))
454
            #mpfPathName = os.path.expandvars('$UNB/Firmware/modules/%s/build/sim/modelsim/%s.mpf' % (lib_name, lib_name))
455
            mpfPathName = os.path.expandvars('$RSP/%s/build/sim/modelsim/%s.mpf' % (lib_name, lib_name))
456
            compile_order = msim.read_compile_order_from_mpf(mpfPathName)
457
            # Append the compile_order list to the lib_name dictionary hdllib.cfg file
458
            lib_dict = msim.libs.get_configfiles(key='hdl_lib_name', values=lib_name)
459
            lib_path = msim.libs.get_filePath(lib_dict)
460
            filePathName = os.path.join(lib_path, 'hdllib.cfg')
461
            print ''
462
            print 'Save modelsim compile order for', lib_name, 'in HDL library config file', filePathName
463
            msim.libs.append_key_to_dict_file(filePathName, 'files', compile_order)
464
 

powered by: WebSVN 2.1.0

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