systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
reorder_mod_init_block.py
Go to the documentation of this file.
1from lark import Tree, Token
2
3from parselib.transforms import TopDown
4from parselib.utils import dprint
5
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