# Axi dma needs the overlay to be downloaded again to produce results for new values

**URL:** <https://discuss.pynq.io/t/axi-dma-needs-the-overlay-to-be-downloaded-again-to-produce-results-for-new-values/88>\
**Category:** Support\
**Created:** [May 15, 2019, 11:16am UTC](https://discuss.pynq.io/t/axi-dma-needs-the-overlay-to-be-downloaded-again-to-produce-results-for-new-values/88 "2019-05-15T11:16:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shankar\_kumar](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/shankar_kumar/32/36_2.png) [@Shankar\_kumar](https://discuss.pynq.io/u/Shankar_kumar)\
**Post date:** [May 15, 2019, 11:16am UTC](https://discuss.pynq.io/t/axi-dma-needs-the-overlay-to-be-downloaded-again-to-produce-results-for-new-values/88/1 "2019-05-15T11:16:25Z")

</div>

It looks like I have to reload the dma everytime I need to get the computations for new values. How do I overcome this?

This is the code that I am using:

```python
import time
import struct
from pynq import Overlay
import pynq.lib.dma
from pynq import Xlnk
import numpy as np
from pynq import MMIO

ol = Overlay('kernel.bit') # check your path
ol.download() # it downloads your bit to FPGA
dma = ol.axi_dma_0 # creating a dma instance. Note that we packed smul and smul_dma into streamMul
sadd_ip = ol.smul_0 
xlnk = Xlnk()

def pl_rbf_kernel(samples):
    length = samples.shape[0]
    in_buffer = xlnk.cma_array(shape=(length,), dtype=np.float32)
    np.copyto(in_buffer, samples)
    sadd_ip.write(0x18, length)
    dma.sendchannel.transfer(in_buffer)
    dma.sendchannel.wait()
    in_buffer.close()
    return struct.unpack("f", struct.pack("I", sadd_ip.read(0x10)))

pl_rbf_kernel(np.load('array.npy')[0:500])

```

When I run the last line for differnt values, it gives me results for the previous input. When I run it once again then it gives me results for the current input.

---

<div class="post-metadata">

**Author:** ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)\
**Post date:** [May 15, 2019, 8:57pm UTC](https://discuss.pynq.io/t/axi-dma-needs-the-overlay-to-be-downloaded-again-to-produce-results-for-new-values/88/2 "2019-05-15T20:57:30Z")

</div>

What is your IP doing?  
It could be taking longer to calculate than the time it takes to read back the value from register 0x10.

I fixed the formatting for your post. For info, blocks of code can be fenced by lines with three back-ticks  
``` and ```

> **[Markdown Cheatsheet · adam-p/markdown-here Wiki](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)**
>
> Google Chrome, Firefox, and Thunderbird extension that lets you write email in Markdown and render it before sending. - Markdown Cheatsheet · adam-p/markdown-here Wiki

Cathal
