Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RTSD
HDL
Commits
b3aa22a5
Commit
b3aa22a5
authored
10 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Added more documentation text. Clarified the used files that are read or written.
parent
181a3a6b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/oneclick/base/hdl_config.py
+4
-1
4 additions, 1 deletion
tools/oneclick/base/hdl_config.py
tools/oneclick/base/modelsim_config.py
+58
-10
58 additions, 10 deletions
tools/oneclick/base/modelsim_config.py
with
62 additions
and
11 deletions
tools/oneclick/base/hdl_config.py
+
4
−
1
View file @
b3aa22a5
...
...
@@ -144,7 +144,10 @@ class HdlConfig:
return
cm
.
unlistify
(
build_dirs
)
def
create_lib_order_files
(
self
,
lib_names
=
None
):
"""
Create the compile order file for all HDL libraries in the specified list of lib_names.
"""
"""
Create the compile order file for all HDL libraries in the specified list of lib_names.
The file is stored in the sim build directory of the HDL library.
"""
if
lib_names
==
None
:
lib_names
=
self
.
lib_names
lib_dicts
=
self
.
libs
.
get_dicts
(
'
hdl_lib_name
'
,
lib_names
)
for
lib_dict
in
cm
.
listify
(
lib_dicts
):
...
...
This diff is collapsed.
Click to expand it.
tools/oneclick/base/modelsim_config.py
+
58
−
10
View file @
b3aa22a5
...
...
@@ -31,12 +31,44 @@ import os.path
class
ModelsimConfig
(
hdl_config
.
HdlConfig
):
def
__init__
(
self
,
libRootDir
,
toolRootDir
,
libFileName
=
'
hdllib.cfg
'
,
toolFileName
=
'
hdltool.cfg
'
):
"""
Get Modelsim tool info from toolRootDir and all HDL library info from libRootDir.
"""
"""
Get Modelsim tool info from toolRootDir and all HDL library info from libRootDir.
Arguments:
- libRootDir : Root directory from where the hdllib.cfg files are searched for.
- toolRootDir : Root directory from where the hdltool.cfg file is searched for.
- libFileName : Default HDL library configuration file name
- toolFileName : Default HDL tools configuration file name
Files:
- hdltool.cfg : HDL tool configuration dictionary file. One central file.
- hdllib.cfg : HDL library configuration dictionary file. One file for each HDL library.
- modelsim_libraries_<technologyName>.txt : Dictionary file with the technology libraries for the FPGA device that
come with the synthesis tool. The keys are the library names and the values are the paths. The file needs to be
created manually and can be read by read_modelsim_technology_libraries_file().
- modelsim_project_files.txt
The modelsim_project_files.txt file is a dictionary file with the list the Modelsim project files for all HDL
libraries that were found in the libRootDir. The keys are the library names and the values are the paths to the
corresponding modelsim project files. The modelsim_project_files.txt file is created by
create_modelsim_project_files_file() and is read by the TCL commands.do file in Modelsim. Creating the file in
Python and then reading this in TCL makes the commands.do much simpler.
- <lib_name>.mpf : Modelsim project file for a certain HDL library based on the hdllib.cfg. The file is created by
create_modelsim_project_file().
- <lib_name>_lib_order.txt
The <lib_name>_lib_order.txt file contains the library compile order for a certain HDL library. The files are
created by create_lib_order_files() in the same build directory as where the Modelsim project file is stored.
The <lib_name>_lib_order.txt files are read by the TCL commands.do file in Modelsim. Creating the files in Python
and then reading them in TCL makes the commands.do much simpler.
"""
hdl_config
.
HdlConfig
.
__init__
(
self
,
libRootDir
,
toolRootDir
,
libFileName
,
toolFileName
)
# Modelsim
def
read_compile_order_from_mpf
(
self
,
mpfPathName
):
"""
Utility to read the compile order of the project files from an existing <mpfPathName>.mpf
and save it into hdl_order.out
.
"""
"""
Utility to read the compile order of the project files from an existing <mpfPathName>.mpf.
"""
# read <mpfPathName>.mpf to find all project files
project_file_indices
=
[]
project_file_names
=
[]
...
...
@@ -63,8 +95,13 @@ class ModelsimConfig(hdl_config.HdlConfig):
compile_order
[
k
]
=
project_file_name
return
compile_order
def
create_modelsim_project_file
(
self
,
technology_name
,
lib_names
=
None
):
"""
Create the Modelsim project file for all HDL libraries in the specified list of lib_names.
"""
def
create_modelsim_project_file
(
self
,
technologyName
,
lib_names
=
None
):
"""
Create the Modelsim project file for all technology libraries and RTL HDL libraries.
Arguments:
- technologyName : refers to the modelsim_libraries_<technologyName>.txt file.
- lib_names : one or more HDL libraries
"""
if
lib_names
==
None
:
lib_names
=
self
.
lib_names
lib_dicts
=
self
.
libs
.
get_dicts
(
'
hdl_lib_name
'
,
lib_names
)
for
lib_dict
in
cm
.
listify
(
lib_dicts
):
...
...
@@ -78,7 +115,7 @@ class ModelsimConfig(hdl_config.HdlConfig):
# Write [Library] section for all used libraries
fp
.
write
(
'
[Library]
\n
'
)
# . vendor technology libs
tech_dict
=
self
.
read_modelsim_technology_libraries_file
(
technology
_n
ame
)
tech_dict
=
self
.
read_modelsim_technology_libraries_file
(
technology
N
ame
)
for
lib_clause
,
lib_work
in
tech_dict
.
iteritems
():
fp
.
write
(
'
%s = %s
\n
'
%
(
lib_clause
,
lib_work
))
# . all used libs for this lib_name
...
...
@@ -152,7 +189,13 @@ class ModelsimConfig(hdl_config.HdlConfig):
fp
.
write
(
'
DefaultRadix = decimal
\n
'
)
def
read_modelsim_technology_libraries_file
(
self
,
technologyName
,
filePath
=
None
):
"""
Read the list of technology libraries from a file.
"""
"""
Read the list of technology libraries from a file.
Arguments:
- technologyName : refers to the modelsim_libraries_<technologyName>.txt file
- filePath : path to modelsim_libraries_<technologyName>.txt, when None then the file is
read in the default toolRootDir
"""
fileName
=
'
modelsim_libraries_
'
+
technologyName
+
'
.txt
'
# use fixed file name format
if
filePath
==
None
:
fileNamePath
=
os
.
path
.
join
(
self
.
toolRootDir
,
'
modelsim
'
,
fileName
)
# default file path
...
...
@@ -162,7 +205,12 @@ class ModelsimConfig(hdl_config.HdlConfig):
return
tech_dict
def
create_modelsim_project_files_file
(
self
,
filePath
=
None
,
lib_names
=
None
):
"""
Create file with list of the Modelsim project files for all HDL libraries in the specified list of lib_names.
"""
"""
Create file with list of the Modelsim project files for all HDL libraries.
Arguments:
- filePath : path to modelsim_project_files.txt, when None then the file is written in the default toolRootDir
- lib_names : one or more HDL libraries
"""
fileName
=
'
modelsim_project_files.txt
'
# use fixed file name
if
filePath
==
None
:
fileNamePath
=
os
.
path
.
join
(
self
.
toolRootDir
,
'
modelsim
'
,
fileName
)
# default file path
...
...
@@ -180,7 +228,7 @@ if __name__ == '__main__':
# Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
libRootDir
=
'
RADIOHDL
'
#libRootDir = 'UNB'
technology
_n
ame
=
'
stratixiv
'
technology
N
ame
=
'
stratixiv
'
msim
=
ModelsimConfig
(
libRootDir
=
os
.
environ
[
libRootDir
],
toolRootDir
=
os
.
path
.
expandvars
(
'
$RADIOHDL/tools
'
),
libFileName
=
'
hdllib.cfg
'
,
toolFileName
=
'
hdltool.cfg
'
)
print
'
#
'
...
...
@@ -208,8 +256,8 @@ if __name__ == '__main__':
msim
.
create_modelsim_project_files_file
()
print
''
print
'
Create modelsim project files for technology %s and all HDL libraries in $%s.
'
%
(
technology
_n
ame
,
libRootDir
)
msim
.
create_modelsim_project_file
(
technology
_n
ame
)
print
'
Create modelsim project files for technology %s and all HDL libraries in $%s.
'
%
(
technology
N
ame
,
libRootDir
)
msim
.
create_modelsim_project_file
(
technology
N
ame
)
# Use save_compile_order_in_mpf = True to avoid having to manually edit the compile order in the hdllib.cfg, because
# the synth_files need to be in hierarchical order. The test_bench_files are typically independent so these may be
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment