Skip to content
Snippets Groups Projects
Commit 4d039c70 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[HLSCustomOp] use dictionaries for all resource reporting

parent b8a52cb8
No related branches found
No related tags found
No related merge requests found
......@@ -60,14 +60,12 @@ def hls_synth_res_estimation(model):
)
if os.path.isfile(xmlfile):
res_dict[node.name] = []
res_dict[node.name] = dict()
tree = ET.parse(xmlfile)
root = tree.getroot()
for item in root.findall("AreaEstimates/Resources"):
for child in item:
res_dict[node.name].append(
"{} : {}".format(child.tag, child.text)
)
res_dict[node.name][child.tag] = child.text
else:
raise Exception(
"""Please run "HLSSynth_IPGen" first
......
......@@ -79,11 +79,11 @@ class HLSCustomOp(CustomOp):
def node_res_estimation(self):
"""Returns summarized resource estimation of BRAMs and LUTs
of the node."""
resources = []
resources.append("BRAM_18K: " + str(self.bram_estimation()))
resources.append("LUT: " + str(self.lut_estimation()))
return resources
of the node as a dictionary."""
ret = dict()
ret["BRAM_18K"] = self.bram_estimation()
ret["LUT"] = self.lut_estimation()
return ret
def bram_estimation(self):
"""Function for BRAM resource estimation, is member function of
......
......@@ -58,9 +58,9 @@ class AnnotateResources(Transformation):
res_dict = model.analysis(res_fxn)
total_dict = {}
for lname in res_dict.keys():
layer_res = res_dict[lname]
for res_entry in layer_res:
r_type, r_amount = res_entry.split(": ")
layer_res_dict = res_dict[lname]
for r_type in layer_res_dict.keys():
r_amount = layer_res_dict[r_type]
r_amount = float(r_amount)
if r_type in total_dict.keys():
total_dict[r_type] += r_amount
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment