Add (* abc_flop_q *) to brams_bb.v
[yosys.git] / techlibs / common / cellhelp.py
1 #!/usr/bin/env python3
2
3 import fileinput
4 import json
5
6 current_help_msg = []
7 current_module_code = []
8 current_module_name = None
9 current_module_signature = None
10
11 def print_current_cell():
12 print("cell_help[\"%s\"] = %s;" % (current_module_name, "\n".join([json.dumps(line) for line in current_help_msg])))
13 print("cell_code[\"%s+\"] = %s;" % (current_module_name, "\n".join([json.dumps(line) for line in current_module_code])))
14
15 for line in fileinput.input():
16 if line.startswith("//-"):
17 current_help_msg.append(line[4:] if len(line) > 4 else "\n")
18 if line.startswith("module "):
19 current_module_name = line.split()[1].strip("\\")
20 current_module_signature = " ".join(line.replace("\\", "").replace(";", "").split()[1:])
21 current_module_code = []
22 elif not line.startswith("endmodule"):
23 line = " " + line
24 current_module_code.append(line.replace("\t", " "))
25 if line.startswith("endmodule"):
26 if len(current_help_msg) == 0:
27 current_help_msg.append("\n")
28 current_help_msg.append(" %s\n" % current_module_signature)
29 current_help_msg.append("\n")
30 current_help_msg.append("No help message for this cell type found.\n")
31 current_help_msg.append("\n")
32 print_current_cell()
33 current_help_msg = []
34