Skip to content

Commit bc34989

Browse files
committed
pmgen.py updated with commenting
1 parent 36312ba commit bc34989

File tree

1 file changed

+40
-37
lines changed

1 file changed

+40
-37
lines changed

pmgen.py

+40-37
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,12 @@ 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-
if (customize_file): # Awais: emulate "out = subtr?acc-mul:acc+mul" for RS DSP MACC against EDA-348
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)
401-
396+
# 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)
401+
# END: Code added to original one in order to handle case of Jira-348 (Awais)
402402
print(" dict<SigBit, pool<Cell*>> sigusers;", file=f)
403403
print(" pool<Cell*> blacklist_cells;", file=f)
404404
print(" pool<Cell*> autoremove_cells;", file=f)
@@ -544,13 +544,14 @@ def process_pmgfile(f, filename):
544544
valueidx += 1
545545
print(" index_{}_key_type key;".format(index), file=f)
546546
for field, entry in enumerate(block["index"]):
547-
if (customize_file):
548-
if (len(block["if"]) and prefix == "rs_dsp_macc"): # Awais: emulate "out = subtr?acc-mul:acc+mul" for RS DSP MACC against EDA-348
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) #
547+
# 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)
554+
# END: Code added to original one in order to handle case of Jira-348 (Awais)
554555
print(" std::get<{}>(key) = {};".format(field, entry[1]), file=f)
555556

556557
print(" index_{}[key].push_back(value);".format(index), file=f)
@@ -726,11 +727,12 @@ def process_pmgfile(f, filename):
726727

727728
if len(block["if"]):
728729
for expr in block["if"]:
729-
if (customize_file): # Awais: emulate "out = subtr?acc-mul:acc+mul" for RS DSP MACC against EDA-348
730-
if ((expr.find("neg")!=-1) and (expr.find("nullptr")!=-1) and prefix == "rs_dsp_macc"):
731-
if (block["cell"] == "mux" or block["cell"] == "add"):
732-
print("", file=f)
733-
else: #
730+
# 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)
734+
else:
735+
# END: Code added to original one in order to handle case of Jira-348 (Awais)
734736
print("", file=f)
735737
print(" if (!({})) {{".format(expr), file=f)
736738
print(" {} = nullptr;".format(block["cell"]), file=f)
@@ -742,26 +744,27 @@ def process_pmgfile(f, filename):
742744
print("", file=f)
743745
print(" index_{}_key_type key;".format(index), file=f)
744746
for field, entry in enumerate(block["index"]):
745-
if (customize_file):
746-
if (len(block["if"]) and prefix == "rs_dsp_macc"): # Awais: emulate "out = subtr?acc-mul:acc+mul" for RS DSP MACC against EDA-348
747-
for expr in block["if"]:
748-
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))):
749-
print("", file=f)
750-
if (block["cell"] == "mux"):
751-
print(" if ({}) {{".format(expr), file=f)
752-
else:
753-
print(" if (!({}) and {} != nullptr) {{".format(expr,block["cell"]), file=f)
754-
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
755-
print(" }", file=f)
756-
print("", file=f)
757-
print(" else {", file=f)
758-
print(" index_{}.clear();".format(index), file=f)
759-
print(" index_{} = index_{}_{};".format(index,index,block["cell"]), file=f)
760-
print(" }", file=f)
747+
# 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)
761754
else:
762-
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
763-
else:
764-
print(" std::get<{}>(key) = {};".format(field, entry[2]), file=f)
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)
765+
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)
765768
print(" auto cells_ptr = index_{}.find(key);".format(index), file=f)
766769

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

0 commit comments

Comments
 (0)