Skip to content
GitLab
Explore
Sign in
Register
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
cb28104f
Commit
cb28104f
authored
9 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Added get_lib_dicts_from_lib_names().
parent
f86e462f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/oneclick/base/hdl_config.py
+35
-4
35 additions, 4 deletions
tools/oneclick/base/hdl_config.py
with
35 additions
and
4 deletions
tools/oneclick/base/hdl_config.py
+
35
−
4
View file @
cb28104f
...
@@ -53,6 +53,7 @@ import sys
...
@@ -53,6 +53,7 @@ import sys
import
os
import
os
import
os.path
import
os.path
import
shutil
import
shutil
import
argparse
class
HdlConfig
:
class
HdlConfig
:
...
@@ -166,7 +167,7 @@ class HdlConfig:
...
@@ -166,7 +167,7 @@ class HdlConfig:
. The lib_names list must include all used libs, so if necessary first call derive_all_use_libs().
. The lib_names list must include all used libs, so if necessary first call derive_all_use_libs().
"""
"""
if
lib_names
==
None
:
lib_names
=
self
.
lib_names
if
lib_names
==
None
:
lib_names
=
self
.
lib_names
lib_dicts
=
self
.
libs
.
get_dicts
(
'
hdl_lib_name
'
,
lib_names
)
lib_dicts
=
self
.
libs
.
get_dicts
(
'
hdl_lib_name
'
,
values
=
lib_names
)
# use list() to take local copy to avoid modifying list order of self.lib_names which matches self.libs.dicts list order
# use list() to take local copy to avoid modifying list order of self.lib_names which matches self.libs.dicts list order
lib_order
=
list
(
lib_names
)
lib_order
=
list
(
lib_names
)
for
lib_dict
in
cm
.
listify
(
lib_dicts
):
for
lib_dict
in
cm
.
listify
(
lib_dicts
):
...
@@ -186,6 +187,20 @@ class HdlConfig:
...
@@ -186,6 +187,20 @@ class HdlConfig:
return
lib_order
return
lib_order
def
get_lib_dicts_from_lib_names
(
self
,
lib_names
=
None
):
"""
Get list the HDL libraries lib_dicts from list of HDL libraries lib_names and preseve the library order.
"""
if
lib_names
==
None
:
lib_names
=
self
.
lib_names
# Cannot use:
#lib_dicts = self.libs.get_dicts('hdl_lib_name', values=lib_names)
# because then the order of self.libs.dicts is used
lib_dicts
=
[]
for
lib_name
in
cm
.
listify
(
lib_names
):
lib_dict
=
self
.
libs
.
dicts
[
self
.
lib_names
.
index
(
lib_name
)]
lib_dicts
.
append
(
lib_dict
)
return
lib_dicts
def
get_tool_build_dir
(
self
,
build_type
):
def
get_tool_build_dir
(
self
,
build_type
):
"""
Get the central tool build directory.
"""
Get the central tool build directory.
...
@@ -239,7 +254,7 @@ class HdlConfig:
...
@@ -239,7 +254,7 @@ class HdlConfig:
The file is read by commands.do in Modelsim to avoid having to derive the library compile order in TCL.
The file is read by commands.do in Modelsim to avoid having to derive the library compile order in TCL.
"""
"""
if
lib_names
==
None
:
lib_names
=
self
.
lib_names
if
lib_names
==
None
:
lib_names
=
self
.
lib_names
lib_dicts
=
self
.
libs
.
get_dicts
(
'
hdl_lib_name
'
,
lib_names
)
lib_dicts
=
self
.
libs
.
get_dicts
(
'
hdl_lib_name
'
,
values
=
lib_names
)
for
lib_dict
in
cm
.
listify
(
lib_dicts
):
for
lib_dict
in
cm
.
listify
(
lib_dicts
):
lib_name
=
lib_dict
[
'
hdl_lib_name
'
]
lib_name
=
lib_dict
[
'
hdl_lib_name
'
]
use_libs
=
self
.
derive_all_use_libs
(
build_type
,
lib_name
)
use_libs
=
self
.
derive_all_use_libs
(
build_type
,
lib_name
)
...
@@ -321,9 +336,25 @@ if __name__ == '__main__':
...
@@ -321,9 +336,25 @@ if __name__ == '__main__':
mode
=
0
mode
=
0
if
mode
==
0
:
if
mode
==
0
:
# Parse command line arguments
toolsetSelect
=
[
'
unb1
'
,
'
unb2
'
]
argparser
=
argparse
.
ArgumentParser
(
description
=
'
Create Modelsim mpf files for all hdllib.cfg
'
)
argparser
.
add_argument
(
'
-t
'
,
'
--toolset
'
,
help
=
'
choose toolset %s (default: %s)
'
%
(
toolsetSelect
,
toolsetSelect
[
0
]),
default
=
toolsetSelect
[
0
],
required
=
False
)
argparser
.
add_argument
(
'
-v
'
,
'
--verbosity
'
,
help
=
'
verbosity >= 0 for more info
'
,
type
=
int
,
default
=
0
,
required
=
False
)
args
=
vars
(
argparser
.
parse_args
())
arg_toolset
=
args
[
'
toolset
'
]
if
arg_toolset
not
in
toolsetSelect
:
print
'
Toolset %s is not supported
'
%
arg_toolset
print
'
Hint: give argument -h for possible options
'
sys
.
exit
(
1
)
toolFileName
=
'
hdltool_
'
+
arg_toolset
+
'
.cfg
'
arg_verbosity
=
args
[
'
verbosity
'
]
# Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
# Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
hdl
=
HdlConfig
(
toolRootDir
=
os
.
path
.
expandvars
(
'
$RADIOHDL/tools
'
),
libFileName
=
'
hdllib.cfg
'
,
toolFileName
=
'
hdltool_<toolset>.cfg
'
)
hdl
=
HdlConfig
(
toolRootDir
=
os
.
path
.
expandvars
(
'
$RADIOHDL/tools
'
),
libFileName
=
'
hdllib.cfg
'
,
toolFileName
=
toolFileName
)
print
'
#
'
print
'
#
'
print
'
# HdlConfig:
'
print
'
# HdlConfig:
'
print
'
#
'
print
'
#
'
...
...
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