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

[PYNQ] set desired fclk when loading driver

parent 24e7c4d5
No related branches found
No related tags found
No related merge requests found
......@@ -107,6 +107,13 @@ class MakePYNQDriver(Transformation):
driver = driver.replace("$OUTPUT_SHAPE_FOLDED$", mss(o_tensor_shape_folded))
driver = driver.replace("$OUTPUT_SHAPE_PACKED$", mss(o_tensor_shape_packed))
# clock settings for driver
clk_ns = float(model.get_metadata_prop("clk_ns"))
fclk_mhz = 1 / (clk_ns * 0.001)
# TODO change according to PYNQ board?
driver = driver.replace("$CLK_NAME$", "fclk0_mhz")
driver = driver.replace("$CLOCK_FREQ_MHZ$", str(fclk_mhz))
with open(driver_py, "w") as f:
f.write(driver)
# copy all the dependencies into the driver folder
......
......@@ -119,8 +119,12 @@ class FINNAccelDriver():
self.oshape_folded = $OUTPUT_SHAPE_FOLDED$
self.ishape_packed = $INPUT_SHAPE_PACKED$ # datatype np.uint8
self.oshape_packed = $OUTPUT_SHAPE_PACKED$ # datatype np.uint8
# clock frequency
self.fclk_mhz = $CLOCK_FREQ_MHZ$
# load bitfile and set up accelerator
self.ol = Overlay(bitfile)
# set the clock frequency as specified by user during transformations
Clocks.$CLK_NAME$ = self.fclk_mhz
self.dma = self.ol.axi_dma_0
self.ctrl_regs = self.ol.resize_accel_0
# neuron folding factor of output = iterations per sample
......
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