code: def _make_report_body(
      report_dict, make_table_template, make_header_template
  ):
      body = ""
  
      if "CSynthesisReport" in report_dict:
          body += make_header_template("C Synthesis report")
          perf_rows = {
              "Best-case latency": "best_latency",
              "Worst-case latency": "worst_latency",
              "Interval Min": "interval_min",
              "Interval Max": "interval_max",
              "Estimated Clock Period": "estimated_clock",
          }
          area_rows = {
              "BRAM_18K": "bram",
              "DSP": "dsp",
              "FF": "ff",
              "LUT": "lut",
              "URAM": "uram",
          }
          body += make_table_template(
              "Performance estimates", perf_rows
          )
          body += make_table_template("Resource estimates", area_rows)
  
          csynth_report = report_dict["CSynthesisReport"]
          target_clock = float(csynth_report["TargetClockPeriod"])
          best_latency = int(csynth_report["BestLatency"])
          worst_latency = int(csynth_report["BestLatency"])
          bram = int(csynth_report["BRAM_18K"])
          avail_bram = int(csynth_report["AvailableBRAM_18K"])
          dsp = int(csynth_report["DSP"])
          avail_dsp = int(csynth_report["AvailableDSP"])
          ff = int(csynth_report["FF"])
          avail_ff = int(csynth_report["AvailableFF"])
          lut = int(csynth_report["LUT"])
          avail_lut = int(csynth_report["AvailableLUT"])
          if "URAM" in csynth_report:
              uram = int(csynth_report["URAM"])
              avail_uram = int(csynth_report["AvailableURAM"])
  
          params = {}
  
          params["best_latency"] = (
              str(best_latency)
              + " ("
              + _convert_cycles_to_time(best_latency, target_clock)
              + ")"
          )
          params["worst_latency"] = (
              str(worst_latency)
              + " ("
              + _convert_cycles_to_time(worst_latency, target_clock)
              + ")"
          )
          params["interval_min"] = csynth_report["IntervalMin"]
          params["interval_max"] = csynth_report["IntervalMax"]
          params["estimated_clock"] = csynth_report[
              "EstimatedClockPeriod"
          ]
  
          params["bram"] = (
              str(bram)
              + " / "
              + str(avail_bram)
              + " ("
              + str(round(bram / avail_bram * 100, 1))
              + "%)"
          )
          params["dsp"] = (
              str(dsp)
              + " / "
              + str(avail_dsp)
              + " ("
              + str(round(dsp / avail_dsp * 100, 1))
              + "%)"
          )
          params["ff"] = (
              str(ff)
              + " / "
              + str(avail_ff)
              + " ("
              + str(round(ff / avail_ff * 100, 1))
              + "%)"
          )
          params["lut"] = (
              str(lut)
              + " / "
              + str(avail_lut)
              + " ("
              + str(round(lut / avail_lut * 100, 1))
              + "%)"
          )
          if "URAM" in csynth_report and avail_uram > 0:
              params["uram"] = (
                  str(uram)
                  + " / "
                  + str(avail_uram)
                  + " ("
                  + str(round(uram / avail_uram * 100, 1))
                  + "%)"
              )
          else:
              params["uram"] = "N/A"
  
          body = body.format(**params)
  
      if "VivadoSynthReport" in report_dict:
          body += make_header_template("Vivado Synthesis report")
          area_rows = {
              "BRAM_18K": "bram",
              "DSP48E": "dsp",
              "FF": "ff",
              "LUT": "lut",
              "URAM": "uram",
          }
          body += make_table_template("Resource utilization", area_rows)
  
          vsynth_report = report_dict["VivadoSynthReport"]
  
          params = {}
          params["bram"] = vsynth_report["BRAM_18K"]
          params["dsp"] = vsynth_report["DSP48E"]
          params["ff"] = vsynth_report["FF"]
          params["lut"] = vsynth_report["LUT"]
          params["uram"] = (
              vsynth_report["URAM"]
              if "URAM" in vsynth_report
              else "N/A"
          )
  
          body = body.format(**params)
  
      if "CosimReport" in report_dict:
          body += make_header_template("Co-Simulation report")
          perf_rows = {
              "Status": "status",
              "Best-case latency": "best_latency",
              "Worst-case latency": "worst_latency",
              "Interval Min": "interval_min",
              "Interval Max": "interval_max",
          }
          body += make_table_template("Performance", perf_rows)
  
          cosim_report = report_dict["CosimReport"]
  
          params = {}
          params["status"] = cosim_report["Status"]
          params["best_latency"] = cosim_report["LatencyMin"]
          params["worst_latency"] = cosim_report["LatencyMax"]
          params["interval_min"] = cosim_report["IntervalMin"]
          params["interval_max"] = cosim_report["IntervalMax"]
  
          body = body.format(**params)
  
      if "ImplementationReport" in report_dict:
          body += make_header_template("Implementation report")
          area_rows = {
              "Total LUTs": "lut",
              "Logic LUTs": "logiclut",
              "LUTRAM": "lutram",
              "SRLs": "srl",
              "FF": "ff",
              "RAMB18": "bram18",
              "RAMB36": "bram36",
              "DSP": "dsp",
              "URAM": "uram",
          }
          body += make_table_template("Resource utilization", area_rows)
  
          impl_report = report_dict["ImplementationReport"]
  
          params = {}
          params["lut"] = (
              impl_report["TotLUTs"]
              + " ("
              + impl_report["TotLUTs%"]
              + "%)"
          )
          params["logiclut"] = (
              impl_report["LogicLUTs"]
              + " ("
              + impl_report["LogicLUTs%"]
              + "%)"
          )
          params["lutram"] = (
              impl_report["LUTRAMs"]
              + " ("
              + impl_report["LUTRAMs%"]
              + "%)"
          )
          params["srl"] = (
              impl_report["SRLs"] + " (" + impl_report["SRLs%"] + "%)"
          )
          params["ff"] = (
              impl_report["FFs"] + " (" + impl_report["FFs%"] + "%)"
          )
          params["bram18"] = (
              impl_report["RAMB18s"]
              + " ("
              + impl_report["RAMB18s%"]
              + "%)"
          )
          params["bram36"] = (
              impl_report["RAMB36s"]
              + " ("
              + impl_report["RAMB36s%"]
              + "%)"
          )
          params["dsp"] = (
              impl_report["DSPs"] + " (" + impl_report["DSPs%"] + "%)"
          )
          if "URAMs" in impl_report:
              params["uram"] = (
                  impl_report["URAMs"]
                  + " ("
                  + impl_report["URAMs%"]
                  + "%)"
              )
          else:
              params["uram"] = "N/A"
  
          body = body.format(**params)
  
      if "TimingReport" in report_dict:
          body += make_header_template("Timing report")
          perf_rows = {
              "Worst Negative Slack (WNS)": "wns",
              "Total Negative Slack (TNS)": "tns",
              "Worst Hold Slack (WHS)": "whs",
              "Total Hold Slack (THS)": "ths",
              "Worst Pulse Width Slack (WPWS)": "wpws",
              "Total Pulse Width Slack (TPWS)": "tpws",
          }
          body += make_table_template("Timing", perf_rows)
  
          timing_report = report_dict["TimingReport"]
  
          params = {}
          params["wns"] = round(timing_report["WNS"], 2)
          params["tns"] = round(timing_report["TNS"], 2)
          params["whs"] = round(timing_report["WHS"], 2)
          params["ths"] = round(timing_report["THS"], 2)
          params["wpws"] = round(timing_report["WPWS"], 2)
          params["tpws"] = round(timing_report["TPWS"], 2)
  
          body = body.format(**params)
  
      return body
  
imports: import os
  import re
  import sys
  import xml.etree.ElementTree
label_desc: Use image node_id 19 for calling a global function with example usage: _make_report_body(report_dict, make_table_template, make_header_template) and returns: body