Skip to content

Commit f9ed2f3

Browse files
committed
File updated
1 parent bc34989 commit f9ed2f3

File tree

1 file changed

+39
-31
lines changed

1 file changed

+39
-31
lines changed

pmgen.py

+39-31
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,15 @@ def process_pmgfile(f, filename):
393393
print(" typedef std::tuple<{}> index_{}_key_type;".format(", ".join(index_types), index), file=f)
394394
print(" typedef std::tuple<{}> index_{}_value_type;".format(", ".join(value_types), index), file=f)
395395
print(" dict<index_{}_key_type, vector<index_{}_value_type>> index_{};".format(index, index, index), file=f)
396+
396397
# BEGIN: Code added to original one in order to handle case of Jira-348 (Awais)
397-
if(prefix == "rs_dsp_macc" and block["cell"]=="mux"):
398-
print(" dict<index_{}_key_type, vector<index_{}_value_type>> index_{}_mux;".format(index, index, index), file=f)
399-
elif ((prefix == "rs_dsp_macc" and block["cell"]=="add")):
400-
print(" dict<index_{}_key_type, vector<index_{}_value_type>> index_{}_add;".format(index, index, index), file=f)
398+
if (customize_file):
399+
if(prefix == "rs_dsp_macc" and block["cell"]=="mux"):
400+
print(" dict<index_{}_key_type, vector<index_{}_value_type>> index_{}_mux;".format(index, index, index), file=f)
401+
elif ((prefix == "rs_dsp_macc" and block["cell"]=="add")):
402+
print(" dict<index_{}_key_type, vector<index_{}_value_type>> index_{}_add;".format(index, index, index), file=f)
401403
# END: Code added to original one in order to handle case of Jira-348 (Awais)
404+
402405
print(" dict<SigBit, pool<Cell*>> sigusers;", file=f)
403406
print(" pool<Cell*> blacklist_cells;", file=f)
404407
print(" pool<Cell*> autoremove_cells;", file=f)
@@ -545,12 +548,13 @@ def process_pmgfile(f, filename):
545548
print(" index_{}_key_type key;".format(index), file=f)
546549
for field, entry in enumerate(block["index"]):
547550
# BEGIN: Code added to original one in order to handle case of Jira-348 (Awais)
548-
if (len(block["if"]) and prefix == "rs_dsp_macc"):
549-
for expr in block["if"]:
550-
if((entry[2].find("neg") != -1) and (entry[2].find("mux_ba") == -1) ):
551-
print(" index_{}_{}[key].push_back(value);".format(index,block["cell"]), file=f)
552-
elif((entry[2].find("neg") == -1) and (entry[2].find("mux_ba") != -1) ):
553-
print(" index_{}_{}[key].push_back(value);".format(index,block["cell"]), file=f)
551+
if (customize_file):
552+
if (len(block["if"]) and prefix == "rs_dsp_macc"):
553+
for expr in block["if"]:
554+
if((entry[2].find("neg") != -1) and (entry[2].find("mux_ba") == -1) ):
555+
print(" index_{}_{}[key].push_back(value);".format(index,block["cell"]), file=f)
556+
elif((entry[2].find("neg") == -1) and (entry[2].find("mux_ba") != -1) ):
557+
print(" index_{}_{}[key].push_back(value);".format(index,block["cell"]), file=f)
554558
# END: Code added to original one in order to handle case of Jira-348 (Awais)
555559
print(" std::get<{}>(key) = {};".format(field, entry[1]), file=f)
556560

@@ -728,9 +732,10 @@ def process_pmgfile(f, filename):
728732
if len(block["if"]):
729733
for expr in block["if"]:
730734
# BEGIN: Code added to original one in order to handle case of Jira-348 (Awais)
731-
if ((expr.find("neg")!=-1) and (expr.find("nullptr")!=-1) and prefix == "rs_dsp_macc"):
732-
if (block["cell"] == "mux" or block["cell"] == "add"):
733-
print("", file=f)
735+
if (customize_file):
736+
if ((expr.find("neg")!=-1) and (expr.find("nullptr")!=-1) and prefix == "rs_dsp_macc"):
737+
if (block["cell"] == "mux" or block["cell"] == "add"):
738+
print("", file=f)
734739
else:
735740
# END: Code added to original one in order to handle case of Jira-348 (Awais)
736741
print("", file=f)
@@ -745,26 +750,29 @@ def process_pmgfile(f, filename):
745750
print(" index_{}_key_type key;".format(index), file=f)
746751
for field, entry in enumerate(block["index"]):
747752
# BEGIN: Code added to original one in order to handle case of Jira-348 (Awais)
748-
if (len(block["if"]) and prefix == "rs_dsp_macc"):
749-
for expr in block["if"]:
750-
if((block["cell"] == "mux" and (entry[2].find("neg") != -1) and (entry[2].find("mux_ba") == -1)) or (block["cell"] == "add" and (entry[2].find("neg") == -1) and (entry[2].find("mux_ba") != -1))):
751-
print("", file=f)
752-
if (block["cell"] == "mux"):
753-
print(" if ({}) {{".format(expr), file=f)
753+
if (customize_file):
754+
if (len(block["if"]) and prefix == "rs_dsp_macc"):
755+
for expr in block["if"]:
756+
if((block["cell"] == "mux" and (entry[2].find("neg") != -1) and (entry[2].find("mux_ba") == -1)) or (block["cell"] == "add" and (entry[2].find("neg") == -1) and (entry[2].find("mux_ba") != -1))):
757+
print("", file=f)
758+
if (block["cell"] == "mux"):
759+
print(" if ({}) {{".format(expr), file=f)
760+
else:
761+
print(" if (!({}) and {} != nullptr) {{".format(expr,block["cell"]), file=f)
762+
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
763+
print(" }", file=f)
764+
print("", file=f)
765+
print(" else {", file=f)
766+
print(" index_{}.clear();".format(index), file=f)
767+
print(" index_{} = index_{}_{};".format(index,index,block["cell"]), file=f)
768+
print(" }", file=f)
754769
else:
755-
print(" if (!({}) and {} != nullptr) {{".format(expr,block["cell"]), file=f)
756-
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
757-
print(" }", file=f)
758-
print("", file=f)
759-
print(" else {", file=f)
760-
print(" index_{}.clear();".format(index), file=f)
761-
print(" index_{} = index_{}_{};".format(index,index,block["cell"]), file=f)
762-
print(" }", file=f)
763-
else:
764-
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
770+
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
771+
else:
772+
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
765773
else:
766-
# END: Code added to original one in order to handle case of Jira-348 (Awais)
767-
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
774+
# END: Code added to original one in order to handle case of Jira-348 (Awais)
775+
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
768776
print(" auto cells_ptr = index_{}.find(key);".format(index), file=f)
769777

770778
if block["semioptional"] or block["genargs"] is not None:

0 commit comments

Comments
 (0)