Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Trigger Distribution
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Trigger Distribution
Commits
aa6fd4fd
Commit
aa6fd4fd
authored
Nov 09, 2018
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrtd: WIP for builder script
parent
1d53a5a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
wrtd_builder.py
builder/wrtd_builder.py
+87
-0
No files found.
builder/wrtd_builder.py
0 → 100644
View file @
aa6fd4fd
import
yaml
import
argparse
import
sys
def
error
(
msg
):
sys
.
stderr
.
write
(
msg
+
'
\n
'
)
sys
.
exit
(
1
)
def
parse
(
filename
):
d
=
yaml
.
load
(
open
(
filename
))
if
'wrtd-board'
not
in
d
:
error
(
'YAML file must have the wrtd-board key'
)
return
d
[
'wrtd-board'
]
def
build_mt_config
(
desc
):
appid
=
desc
[
'appid'
]
cpus
=
desc
[
'cpus'
]
ncpus
=
len
([
x
for
x
in
cpus
if
isinstance
(
x
,
int
)
])
res
=
"""
constant c_mt_config : t_mt_config :=
(
app_id => x"{:08x}",
cpu_count => {},
cpu_config => ("""
.
format
(
appid
,
ncpus
)
# Be sure that cpus are defined from 0 to N-1.
for
i
in
range
(
ncpus
):
cpu
=
desc
[
'cpus'
]
.
get
(
i
,
None
)
if
cpu
==
None
:
error
(
'No definition for cpu {}'
.
format
(
i
))
res
+=
"""
{} => (
memsize => {},
hmq_config => ("""
.
format
(
i
,
cpu
[
'memsize'
]
*
1024
//
4
)
hmq
=
cpu
.
get
(
'hmq'
,
None
)
if
hmq
is
not
None
:
res
+=
"""
slot_count => 1,
slot_config => (
0 => (
entries_bits => {},
width_bits => 7,
header_bits => 2,
endpoint_id => x"0000_0000",
enable_config_space => FALSE),"""
.
format
(
hmq
[
'log_entries'
])
res
+=
"""
others => c_DUMMY_MT_MQUEUE_SLOT)),
rmq_config => ("""
rmq
=
cpu
.
get
(
'rmq'
,
None
)
if
rmq
is
not
None
:
res
+=
"""
slot_count => 1,
slot_config => (
0 => (
entries_bits => {},
width_bits => 7,
header_bits => 4,
endpoint_id => x"0000_0000",
enable_config_space => TRUE),"""
.
format
(
rmq
[
'log_entries'
])
res
+=
"""
others => c_DUMMY_MT_MQUEUE_SLOT))),"""
res
+=
"""
others => (
0, c_MT_DEFAULT_MQUEUE_CONFIG, c_MT_DEFAULT_MQUEUE_CONFIG)),
shared_mem_size => {}
);"""
.
format
(
cpus
[
'shared_memsize'
]
*
1024
//
4
)
return
res
def
main
():
aparser
=
argparse
.
ArgumentParser
(
description
=
'wrtd config generator'
)
aparser
.
add_argument
(
'filename'
,
help
=
'YAML description file'
)
args
=
aparser
.
parse_args
()
desc
=
parse
(
args
.
filename
)
mt_config
=
build_mt_config
(
desc
)
print
(
mt_config
)
if
__name__
==
'__main__'
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment