Commit a4830527 authored by Harald Keller's avatar Harald Keller
Browse files

main dma I/O Fixed + Sobel added in Overlay code

parent e96753b5
%% Cell type:code id: tags:
``` python
from PIL import Image as img
from pynq import Overlay, allocate, Xlnk
from pynq import Overlay, allocate
import matplotlib.pyplot as plt
import pynq.lib.dma
import numpy as np
oly = Overlay('design_1.bit')
oly.download()
```
%% Cell type:code id: tags:
``` python
oly = Overlay('design_1.bit')
dma0 = oly.axi_dma_0
dma1 = oly.axi_dma_1
dma2 = oly.axi_dma_2
dma3 = oly.axi_dma_3
```
%% Cell type:code id: tags:
``` python
inp1 = allocate(shape=(4000,), dtype=np.uint32)
inp2 = allocate(shape=(4000,), dtype=np.uint32)
op = allocate(shape=(4000,), dtype=np.uint32)
for i in range(4000):
inp1[i] = i
inp2[i] = 76
inp1 = allocate(shape=(20,), dtype=np.uint32)
inp2 = allocate(shape=(20,), dtype=np.uint32)
inp3 = allocate(shape=(20,), dtype=np.uint32)
op = allocate(shape=(20,), dtype=np.uint32)
for i in range(20):
inp1[i] = 10
inp2[i] = 24 if ((i>4)and(i<8)) else 0
inp3[i] = 15
```
%% Cell type:code id: tags:
``` python
dma0.sendchannel.transfer(inp1)
dma1.sendchannel.transfer(inp2)
dma2.recvchannel.transfer(op)
dma2.sendchannel.transfer(inp3)
dma0.sendchannel.wait()
dma1.sendchannel.wait()
dma2.recvchannel.wait()
dma2.sendchannel.wait()
```
%% Cell type:code id: tags:
``` python
oly.edge_filter_0.write(0x10,8)
oly.edge_filter_0.write(0x0,0x1)
dma3.recvchannel.start()
dma3.recvchannel.transfer(op)
```
%% Cell type:code id: tags:
``` python
oly.ip_0.register_map
dma3.read(0x30)
```
%%%% Output: execute_result
RegisterMap {
constant_r = Register(constant_r=0)
}
65539
%% Cell type:code id: tags:
``` python
op
```
%%%% Output: execute_result
PynqBuffer([ 38, 38, 39, ..., 2036, 2037, 2037], dtype=uint32)
PynqBuffer([ 0, 0, 0, 0, 0, 20, 0, 48, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0], dtype=uint32)
%% Cell type:code id: tags:
``` python
inp1
```
%%%% Output: execute_result
PynqBuffer([10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10], dtype=uint32)
%% Cell type:code id: tags:
``` python
inp2
```
%%%% Output: execute_result
PynqBuffer([ 0, 0, 0, 0, 0, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0], dtype=uint32)
%% Cell type:code id: tags:
``` python
inp3
```
%%%% Output: execute_result
PynqBuffer([15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15], dtype=uint32)
%% Cell type:code id: tags:
``` python
```
......
No preview for this file type
This diff is collapsed.
This diff is collapsed.
%% Cell type:code id: tags:
``` python
from PIL import Image as img
from pynq import Overlay, allocate, Xlnk
from pynq import Overlay, allocate
import matplotlib.pyplot as plt
import pynq.lib.dma
import numpy as np
oly = Overlay('design_1.bit')
oly.download()
```
%%%% Output: display_data
%%%% Output: display_data
%% Cell type:code id: tags:
``` python
oly = Overlay('design_1.bit')
dma0 = oly.axi_dma_0
dma1 = oly.axi_dma_1
dma2 = oly.axi_dma_2
dma3 = oly.axi_dma_3
```
%% Cell type:code id: tags:
``` python
inp1 = allocate(shape=(4000,), dtype=np.uint32)
inp2 = allocate(shape=(4000,), dtype=np.uint32)
op = allocate(shape=(4000,), dtype=np.uint32)
for i in range(4000):
inp1[i] = i
inp2[i] = 76
inp1 = allocate(shape=(20,), dtype=np.uint32)
inp2 = allocate(shape=(20,), dtype=np.uint32)
inp3 = allocate(shape=(20,), dtype=np.uint32)
op = allocate(shape=(20,), dtype=np.uint32)
for i in range(20):
inp1[i] = 10
inp2[i] = 24 if ((i>4)and(i<8)) else 0
inp3[i] = 15
```
%% Cell type:code id: tags:
``` python
dma0.sendchannel.transfer(inp1)
dma1.sendchannel.transfer(inp2)
dma2.recvchannel.transfer(op)
dma2.sendchannel.transfer(inp3)
dma0.sendchannel.wait()
dma1.sendchannel.wait()
dma2.recvchannel.wait()
dma2.sendchannel.wait()
```
%% Cell type:code id: tags:
``` python
oly.ip_0.register_map
oly.edge_filter_0.write(0x10,8)
oly.edge_filter_0.write(0x0,0x1)
dma3.recvchannel.start()
dma3.recvchannel.transfer(op)
```
%% Cell type:code id: tags:
``` python
dma3.read(0x30)
```
%%%% Output: execute_result
RegisterMap {
constant_r = Register(constant_r=0)
}
65539
%% Cell type:code id: tags:
``` python
op
```
%%%% Output: execute_result
PynqBuffer([ 38, 38, 39, ..., 2036, 2037, 2037], dtype=uint32)
PynqBuffer([ 0, 0, 0, 0, 0, 20, 0, 48, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0], dtype=uint32)
%% Cell type:code id: tags:
``` python
inp1
```
%%%% Output: execute_result
PynqBuffer([ 0, 1, 2, ..., 3997, 3998, 3999], dtype=uint32)
PynqBuffer([10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10], dtype=uint32)
%% Cell type:code id: tags:
``` python
inp2
```
%%%% Output: execute_result
PynqBuffer([76, 76, 76, ..., 76, 76, 76], dtype=uint32)
PynqBuffer([ 0, 0, 0, 0, 0, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0], dtype=uint32)
%% Cell type:code id: tags:
``` python
inp3
```
%%%% Output: execute_result
PynqBuffer([15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15], dtype=uint32)
%% Cell type:code id: tags:
``` python
```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment