systemc-clang
2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
plugins
hdl
parselib
transforms
reorder_mod_init_block.py
Go to the documentation of this file.
1
from
lark
import
Tree, Token
2
3
from
parselib.transforms
import
TopDown
4
from
parselib.utils
import
dprint
5
6
class
ReorderModInitBlock
(
TopDown
):
7
"""
8
reorders the mod init block, so that hmodinitblock (sensitivity list) is available
9
when the processes are being translated
10
"""
11
def
__init__
(self):
12
super().
__init__
()
13
14
def
hmodule
(self, tree):
15
key = {
16
'hmodinitblock'
: 0,
17
'processlist'
: 1
18
}
# only supported elements
19
tree.children = sorted(tree.children, key=
lambda
x: key[x.data]
if
isinstance(x, Tree)
and
x.data
in
key
else
-1)
20
return
tree
parselib.transforms.reorder_mod_init_block.ReorderModInitBlock
Definition
reorder_mod_init_block.py:6
parselib.transforms.reorder_mod_init_block.ReorderModInitBlock.__init__
__init__(self)
Definition
reorder_mod_init_block.py:11
parselib.transforms.reorder_mod_init_block.ReorderModInitBlock.hmodule
hmodule(self, tree)
Definition
reorder_mod_init_block.py:14
parselib.transforms.top_down.TopDown
Definition
top_down.py:24
parselib.transforms
Definition
__init__.py:1
parselib.utils
Definition
utils.py:1
Generated by
1.12.0