38 port_name, port_type = tree.children
39 port_type_meta = port_type.meta
40 if inout ==
'channel':
42 elif inout
in [
'in',
'out']:
43 port_name = port_name.children[0].value
45 data_port = copy.deepcopy(port_type)
46 valid_port = copy.deepcopy(port_type)
47 ready_port = copy.deepcopy(port_type)
59 elif inout ==
'channel':
65 meta = data_port.children[0].meta
67 data_type = data_port.children[0].children[1]
68 data_port.children[0] = data_valid_port_func(data_type, meta)
70 signal_type = Tree(
'htype', [Token(
'TYPESTR',
'sc_uint'), 1])
71 valid_port.children[0] = data_valid_port_func(copy.deepcopy(signal_type), meta)
72 ready_port.children[0] = ready_port_func(copy.deepcopy(signal_type), meta)
76 data_port_decl = copy.copy(tree)
77 valid_port_decl = copy.copy(tree)
78 ready_port_decl = copy.copy(tree)
80 data_port_decl.children = [data_valid_port_decl_func(port_name +
'_data', meta), data_port]
81 valid_port_decl.children = [data_valid_port_decl_func(port_name +
'_valid', meta), valid_port]
82 ready_port_decl.children = [ready_port_decl_func(port_name +
'_ready', meta), ready_port]
83 return [data_port_decl, valid_port_decl, ready_port_decl]
86 _, sub, par = tree.children
89 assert par_type
in [
'sc_rvd',
'sc_rvd_in',
'sc_rvd_out']
90 new_trees = [copy.deepcopy(tree)
for _
in range(3)]
91 sub_fields = [
'data',
'valid',
'ready']
93 for t, f
in zip(new_trees, sub_fields):
94 _, sub, par = t.children
95 sub_v = sub.children[0]
96 par_v = par.children[0]
97 t.children[0 + 1].children[0].value = sub_v +
'_' + f
98 t.children[1 + 1].children[0].value = par_v +
'_' + f