39 port_name, port_type = tree.children
40 port_type_meta = port_type.meta
41 if inout ==
'channel':
43 elif inout
in [
'in',
'out']:
44 port_name = port_name.children[0].value
46 data_port = copy.deepcopy(port_type)
47 valid_port = copy.deepcopy(port_type)
48 ready_port = copy.deepcopy(port_type)
60 elif inout ==
'channel':
66 meta = data_port.children[0].meta
68 data_type = data_port.children[0].children[1]
69 data_port.children[0] = data_valid_port_func(data_type, meta)
71 signal_type = Tree(
'htype', [Token(
'TYPESTR',
'sc_uint'), 1])
72 valid_port.children[0] = data_valid_port_func(copy.deepcopy(signal_type), meta)
73 ready_port.children[0] = ready_port_func(copy.deepcopy(signal_type), meta)
77 data_port_decl = copy.copy(tree)
78 valid_port_decl = copy.copy(tree)
79 ready_port_decl = copy.copy(tree)
81 data_port_decl.children = [data_valid_port_decl_func(port_name +
'_data', meta), data_port]
82 valid_port_decl.children = [data_valid_port_decl_func(port_name +
'_valid', meta), valid_port]
83 ready_port_decl.children = [ready_port_decl_func(port_name +
'_ready', meta), ready_port]
84 return [data_port_decl, valid_port_decl, ready_port_decl]
87 _, sub, par = tree.children
90 assert par_type
in [
'sc_rvd',
'sc_rvd_in',
'sc_rvd_out']
91 new_trees = [copy.deepcopy(tree)
for _
in range(3)]
92 sub_fields = [
'data',
'valid',
'ready']
94 for t, f
in zip(new_trees, sub_fields):
95 _, sub, par = t.children
96 sub_v = sub.children[0]
97 par_v = par.children[0]
100 t.children[0 + 1].children[0] = Token(
'ID', sub_v +
'_' + f)
101 t.children[1 + 1].children[0] = Token(
'ID', par_v +
'_' + f)