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
ae04ee82
Commit
ae04ee82
authored
10 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Support absolute and local build_dir. Added create_lib_order_files().
parent
a0265ba8
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
+37
-7
37 additions, 7 deletions
tools/oneclick/base/hdl_config.py
with
37 additions
and
7 deletions
tools/oneclick/base/hdl_config.py
+
37
−
7
View file @
ae04ee82
...
...
@@ -55,8 +55,10 @@ import os.path
class
HdlConfig
:
def
__init__
(
self
,
libRootDir
,
toolRootDir
=
''
,
libFileName
=
'
hdllib.cfg
'
,
toolFileName
=
'
hdltool.cfg
'
):
def
__init__
(
self
,
libRootDir
,
toolRootDir
,
libFileName
=
'
hdllib.cfg
'
,
toolFileName
=
'
hdltool.cfg
'
):
"""
Get tool dictionary info from toolRootDir and all HDL library dictionary info from libRootDir.
"""
self
.
libRootDir
=
libRootDir
self
.
toolRootDir
=
toolRootDir
# HDL tool config file
self
.
tool
=
common_dict_file
.
CommonDictFile
(
toolRootDir
,
toolFileName
)
# tool dict file
if
self
.
tool
.
nof_dicts
==
0
:
sys
.
exit
(
'
Error : No HDL tool config file found
'
)
...
...
@@ -86,7 +88,7 @@ class HdlConfig:
if
lib_names
==
None
:
lib_names
=
self
.
lib_names
lib_dicts
=
self
.
libs
.
get_dicts
(
'
hdl_lib_name
'
,
lib_names
)
lib_order
=
[]
for
lib_dict
in
lib_dicts
:
for
lib_dict
in
cm
.
listify
(
lib_dicts
)
:
lib_name
=
lib_dict
[
'
hdl_lib_name
'
]
if
not
lib_name
in
lib_order
:
lib_order
.
append
(
lib_name
)
# append this lib
...
...
@@ -102,22 +104,46 @@ class HdlConfig:
return
lib_order
def
get_lib_build_sim_dirs
(
self
,
lib_dicts
=
None
):
"""
Get the simulation build directory for all HDL libraries in the specified list of lib_dicts.
"""
"""
Get the simulation build directory for all HDL libraries in the specified list of lib_dicts.
If key
'
build_dir
'
in HDL library config file is
''
then
define build dir by
'
sim_tool_name
'
local to current HDL library directory.
else
define build dir by
'
sim_tool_name
'
local to
'
build_dir
'
directory.
"""
if
lib_dicts
==
None
:
lib_dicts
=
self
.
libs
.
dicts
sim_dirs
=
[]
for
lib_dict
in
cm
.
listify
(
lib_dicts
):
lib_path
=
self
.
libs
.
get_filePath
(
lib_dict
)
build_dir
=
self
.
libs
.
get_key_values
(
'
build_dir
'
,
lib_dict
)
sim_tool
=
self
.
tool
.
get_key_values
(
'
sim_tool
'
)
sim_dirs
.
append
(
os
.
path
.
join
(
lib_path
,
build_dir
,
sim_tool
))
build_dir
=
os
.
path
.
expandvars
(
self
.
libs
.
get_key_values
(
'
build_dir
'
,
lib_dict
))
sim_tool_name
=
self
.
tool
.
get_key_values
(
'
sim_tool_name
'
)
if
build_dir
==
''
:
sim_dirs
.
append
(
os
.
path
.
join
(
lib_path
,
build_dir
,
sim_tool_name
))
else
:
sim_dirs
.
append
(
os
.
path
.
join
(
lib_path
,
build_dir
,
sim_tool_name
))
return
cm
.
unlistify
(
sim_dirs
)
def
create_lib_order_files
(
self
,
lib_names
=
None
):
"""
Create the Modelsim project file for all HDL libraries in the specified list of lib_names.
"""
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
):
lib_name
=
lib_dict
[
'
hdl_lib_name
'
]
use_libs
=
self
.
derive_all_use_libs
(
lib_name
)
lib_order
=
self
.
derive_lib_order
(
use_libs
)
file_name
=
'
hdllib_order.txt
'
file_path
=
self
.
get_lib_build_sim_dirs
(
lib_dict
)
cm
.
mkdir
(
file_path
)
filePathName
=
os
.
path
.
join
(
file_path
,
file_name
)
with
open
(
filePathName
,
'
w
'
)
as
fp
:
for
lib
in
lib_order
:
fp
.
write
(
'
%s
\n
'
%
lib
)
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'
hdl
=
HdlConfig
(
libRootDir
=
os
.
environ
[
libRootDir
],
toolRootDir
=
os
.
environ
[
'
UNB
'
]
,
libFileName
=
'
hdllib.cfg
'
,
toolFileName
=
'
hdltool.cfg
'
)
hdl
=
HdlConfig
(
libRootDir
=
os
.
environ
[
libRootDir
],
toolRootDir
=
os
.
path
.
expandvars
(
'
$RADIOHDL/tools
'
)
,
libFileName
=
'
hdllib.cfg
'
,
toolFileName
=
'
hdltool.cfg
'
)
print
'
#
'
print
'
# HdlConfig:
'
...
...
@@ -151,6 +177,10 @@ if __name__ == '__main__':
for
sim_dir
in
hdl
.
get_lib_build_sim_dirs
():
print
'
'
,
sim_dir
print
''
print
'
create_lib_order_files
'
hdl
.
create_lib_order_files
()
print
''
if
libRootDir
==
'
RADIOHDL
'
:
print
'
derive_all_use_libs =
'
,
hdl
.
derive_lib_order
(
hdl
.
derive_all_use_libs
(
'
technology_memory
'
))
...
...
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