docstr: Modify the build_prj.tcl and build_lib.sh scripts to add the extra wrapper files and set the top function
docstr_tok: ["Modify","the","build_prj.tcl","and","build_lib.sh","scripts","to","add","the","extra","wrapper","files","and","set","the","top","function"]
code: def modify_build_script(self, model):
      """
      Modify the build_prj.tcl and build_lib.sh scripts to add the extra wrapper files and set the top function
      """
      filedir = os.path.dirname(os.path.abspath(__file__))
      oldfile = f"{model.config.get_output_dir()}/build_prj.tcl"
      newfile = f"{model.config.get_output_dir()}/build_prj_axi.tcl"
      f = open(oldfile)
      fout = open(newfile, "w")
  
      for line in f.readlines():
          if "set_top" in line:
              newline = (
                  line[:-1] + "_axi\n"
              )  # remove the newline from the line end and append _axi for the new top
              newline += f'add_files firmware/{model.config.get_project_name()}_axi.cpp -cflags "-std=c++0x"\n'
          elif f"{model.config.get_project_name()}_cosim" in line:
              newline = line.replace(
                  f"{model.config.get_project_name()}_cosim",
                  f"{model.config.get_project_name()}_axi_cosim",
              )
          elif "${project_name}.tcl" in line:
              newline = line.replace(
                  "${project_name}.tcl", "${project_name}_axi.tcl"
              )
          else:
              newline = line
          fout.write(newline)
  
      f.close()
      fout.close()
      os.rename(newfile, oldfile)
  
      ###################
      # build_lib.sh
      ###################
  
      f = open(
          os.path.join(
              filedir, "../templates/vivado_accelerator/build_lib.sh"
          )
      )
      fout = open(f"{model.config.get_output_dir()}/build_lib.sh", "w")
  
      for line in f.readlines():
          line = line.replace(
              "myproject", model.config.get_project_name()
          )
          line = line.replace(
              "mystamp", model.config.get_config_value("Stamp")
          )
  
          fout.write(line)
      f.close()
      fout.close()
  
file_path: hls4ml/hls4ml/writer/vivado_accelerator_writer.py
imports: import os
  from distutils.dir_util import copy_tree
  from shutil import copyfile
  from hls4ml.writer.vivado_writer import VivadoWriter
label_desc: Use image node_id 3 for calling the VivadoAcceleratorWriter obj's underlying member method code with example usage: obj.modify_build_script(model) without return types