40 with self.
ctx.add_values(interfaces=[]):
42 interfaces_tree_node = Tree(
45 for interface
in self.
ctx.interfaces:
46 interface_tree_node = Tree(
48 interface.interface_name,
49 ] + interface.interfaces
51 if interface.interfaces:
52 interfaces_tree_node.children.append(interface_tree_node)
53 if interfaces_tree_node.children:
54 tree.children.insert(0, interfaces_tree_node)
56 for interface
in self.
ctx.interfaces:
57 if interface.interfaces:
101 assert tree.data ==
'portdecltype',
"Expecting portdecltype"
102 new_tree = Tree(
'sigdecltype', tree.children, meta=tree.meta)
103 new_tree.children[0] = Tree(
'sigdecl', [tree.children[0].children[0]])
104 new_tree.meta.direction = tree.direction
108 with self.
ctx.add_values(port_decl_to_remove=[]):
110 if self.
ctx.port_decl_to_remove:
111 tree.children = list(filter(
lambda x: x
not in self.
ctx.port_decl_to_remove, tree.children))
115 for i
in range(len(tree.children) - 1, -1, -1):
116 if tree.children[i].data ==
'sigdecltype':
119 elif tree.children[i].data ==
'portdecltype':
122 new_sig_decls = list(map(self.portdecltype_to_sigdecltype, self.
ctx.port_decl_to_remove))
123 tree.children = tree.children[:insertion_pos + 1] + new_sig_decls + tree.children[insertion_pos + 1:]
139 if self.
ctx.current_port_decl_node
and tree.children[0] ==
'array':
140 if self.
ctx.current_port_decl_node.children[0].data ==
'inportdecl':
141 with self.
ctx.add_values(port_erasure=
True):
143 self.
ctx.current_port_decl_node.direction =
'input'
144 self.
ctx.port_decl_to_remove.append(self.
ctx.current_port_decl_node)
145 elif self.
ctx.current_port_decl_node.children[0].data ==
'outportdecl':
146 self.
ctx.current_port_decl_node.direction =
'output'
148 raise ValueError(
"Unknown port type")
149 elif self.
ctx.port_erasure:
150 if tree.children[0]
in [
'sc_in',
'sc_out']:
151 return tree.children[1]