Skip to content

Commit

Permalink
Updating makegen.py to have cleaner systemC part
Browse files Browse the repository at this point in the history
  • Loading branch information
Virat Agarwal authored and GitHub Enterprise committed Oct 5, 2021
1 parent c1a1af4 commit 1d85cdd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 61 deletions.
81 changes: 21 additions & 60 deletions common/utility/makefile_gen/makegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,24 +306,34 @@ def building_kernel(target, data):
for con in data["containers"]:
if "accelerators" in con:
for acc in con["accelerators"]:
target.write("$(TEMP_DIR)/")
type_systemC = 0
if "kernel_type" in acc:
if acc["kernel_type"] == "SystemC":
type_systemC = 1
if not type_systemC:
target.write("$(TEMP_DIR)/")
target.write(acc["name"])
target.write(".xo: ")
location = acc["location"]
location = location.replace('PROJECT', '.')
target.write(location)
target.write("\n")
target.write("\tmkdir -p $(TEMP_DIR)\n")
target.write("\t$(VPP) ")
target.write("$(VPP_FLAGS) ")
if "clflags" in acc:
target.write("$(VPP_FLAGS_"+acc["name"]+") ")
target.write("-c -k ")
target.write(acc["name"])
target.write(" --temp_dir ")
target.write("$(TEMP_DIR) ")
target.write(" -I'$(<D)'")
target.write(" -o'$@' '$<'\n")
if type_systemC:
target.write("\tcreate_sc_xo ")
target.write(location)
target.write("\n")
else:
target.write("\t$(VPP) ")
target.write("$(VPP_FLAGS) ")
if "clflags" in acc:
target.write("$(VPP_FLAGS_"+acc["name"]+") ")
target.write("-c -k ")
target.write(acc["name"])
target.write(" --temp_dir ")
target.write("$(TEMP_DIR) ")
target.write(" -I'$(<D)'")
target.write(" -o'$@' '$<'\n")
for con in data["containers"]:
target.write("$(BUILD_DIR)/")
target.write(con["name"])
Expand Down Expand Up @@ -384,50 +394,6 @@ def building_kernel_rtl(target, data):
target.write("endif\n")
return

def building_kernel_systemc(target, data):
if "containers" in data:
target.write("############################## Setting Rules for Binary Containers (Building Kernels) ##############################\n")
for con in data["containers"]:
if "accelerators" in con:
for acc in con["accelerators"]:
target.write(acc["name"])
target.write(".xo: ")
location = acc["location"]
location = location.replace('PROJECT', '.')
target.write(location)
target.write("\n")
target.write("\tmkdir -p $(TEMP_DIR)\n")
target.write("\tcreate_sc_xo ")
target.write(location)
target.write("\n")
for con in data["containers"]:
target.write("$(BUILD_DIR)/")
target.write(con["name"])
target.write(".xclbin:")
target.write(" $(BINARY_CONTAINER_")
target.write(con["name"])
target.write("_OBJS)\n")
target.write("\tmkdir -p $(BUILD_DIR)\n")
target.write("ifeq ($(HOST_ARCH), x86)\n")
target.write("\t$(VPP) $(VPP_FLAGS) ")
target.write("-l $(VPP_LDFLAGS) --temp_dir ")
target.write("$(TEMP_DIR)")

if "ldclflags" in con:
target.write(" $(VPP_LDFLAGS_"+con["name"]+")")
target.write(" -o'$(BUILD_DIR)/" + con["name"] + ".link.xclbin' $(+)\n")

target.write("\t$(VPP) -p $(BUILD_DIR)/" + con["name"] + ".link.xclbin -t $(TARGET) --platform $(DEVICE) ")
target.write("--package.out_dir $(PACKAGE_OUT) -o $(BUILD_DIR)/" + con["name"] + ".xclbin\n")
target.write("else\n")
target.write("\t$(VPP) $(VPP_FLAGS) -l $(VPP_LDFLAGS) --temp_dir $(TEMP_DIR)")
if "ldclflags" in con:
target.write(" $(VPP_LDFLAGS_"+con["name"]+")")
target.write(" -o'$(BUILD_DIR)/" + con["name"] + ".xclbin' $(+)\n")
target.write("endif\n")
target.write("\n")
return

def building_host(target, data):
target.write("############################## Setting Rules for Host (Building Host Executable) ##############################\n")

Expand Down Expand Up @@ -512,21 +478,16 @@ def mk_build_all(target, data):
target.write("\n")

rtl_counter = 0
systemc_counter = 0
if "containers" in data:
for con in data["containers"]:
if "accelerators" in con:
for acc in con["accelerators"]:
if "kernel_type" in acc:
if acc["kernel_type"] == "RTL":
rtl_counter = 1
elif acc["kernel_type"] == "SystemC":
systemc_counter = 1

if rtl_counter == 1:
building_kernel_rtl(target, data)
elif systemc_counter == 1:
building_kernel_systemc(target, data)
else:
building_kernel(target, data)
building_host(target, data)
Expand Down
3 changes: 2 additions & 1 deletion emulation/external_io/xrt.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[Debug]
profile=true
opencl_summary=true
opencl_device_counter=true

0 comments on commit 1d85cdd

Please sign in to comment.