systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
passes.py
Go to the documentation of this file.
1"""Different pass of the translation"""
2from .alias_translation import AliasTranslation
3from .literal_expansion import LiteralExpansion
4from .node_merge import NodeMergePass
5from .sort_var_decl import SortVarDecl
6from .typedef_expansion import TypedefExpansion
7from .typedef_filter import TypeDefFilter, TypeDefCleanup
8from .verilog_tranlation import VerilogTranslationPass
9from .port_expansion import PortExpansion
10from .slice_merge import SliceMerge
11from .node_movement import NodeMovement
12from .function_param_marker import FunctionParamMarker
13from .reorder_mod_init_block import ReorderModInitBlock
14from .function_info_pass import FunctionInfoPass, FunctionInfoPass2
15from .function_transformation_pass import FunctionTransformationPass
16from .comma_transformation import CommaTransformation
17from .structure_collector import StructureCollector
18
19from ..utils import dprint
20
21
23 """Translate hcode to verilog"""
24 @staticmethod
25 def translate(tree):
26 # we need some form of `level' of the tree, lower level meaning it is loosing more information, but more lenient
27 # to hardware language
28 prev = tree
29 prev = ReorderModInitBlock().visit(prev)
30 prev = NodeMovement().visit(prev)
31 prev = SortVarDecl().visit(prev)
32 prev = AliasTranslation().visit(prev)
34 sc.visit(prev)
35 prev = LiteralExpansion(structure=sc.hier).visit(prev)
36 prev = SliceMerge().visit(prev)
37 # prev = CommaTransformation().visit(prev)
38 # dprint(prev.pretty())
39 f = TypeDefFilter()
40 prev = f.visit(prev)
41 prev = NodeMergePass().visit(prev)
42 prev = PortExpansion().visit(prev)
43 # note typedef should be after port expansion to prevent duplicate valid/ready
44 prev = TypedefExpansion(f.types).visit(prev)
45 prev = FunctionInfoPass().visit(prev)
46 prev = FunctionInfoPass2().visit(prev)
47 prev = FunctionParamMarker().visit(prev)
48 prev = FunctionTransformationPass().visit(prev)
49 prev = TypeDefCleanup().visit(prev)
50 prev = VerilogTranslationPass().visit(prev)
51 return prev
52