Hello
I have created an IP with Vitis HLS 2020.2 with the following interface (with the convenient pragmas for better understanding):
void pobj_accel(hls::stream<axis_t> &in_A, hls::stream<axis_t> &in_X, hls::stream<axis_t> &in_Y, hls::stream<axis_t> &out_Z, double lmbda, double pobj)
{
#pragma HLS INTERFACE s_axilite port = return bundle = control
#pragma HLS INTERFACE s_axilite port = lmbda bundle = pobj_port
#pragma HLS INTERFACE s_axilite port = pobj bundle = pobj_port
#pragma HLS INTERFACE axis port = in_A
#pragma HLS INTERFACE axis port = in_X
#pragma HLS INTERFACE axis port = in_Y
#pragma HLS INTERFACE axis port = out_Z
.............
}
I have synthesized the IP successfully and created a block design then generated the bitstream without any problem.
To start the IP and assign the input parameters lmbda and pobj (as output). I had to look for the Adress Info. So I got the following:
control port
//------------------------Address Info-------------------
// 0x0 : Control signals
// bit 0 - ap_start (Read/Write/COH)
// bit 1 - ap_done (Read/COR)
// bit 2 - ap_idle (Read)
// bit 3 - ap_ready (Read)
// bit 7 - auto_restart (Read/Write)
// others - reserved
// 0x4 : Global Interrupt Enable Register
// bit 0 - Global Interrupt Enable (Read/Write)
// others - reserved
// 0x8 : IP Interrupt Enable Register (Read/Write)
// bit 0 - enable ap_done interrupt (Read/Write)
// bit 1 - enable ap_ready interrupt (Read/Write)
// others - reserved
// 0xc : IP Interrupt Status Register (Read/TOW)
// bit 0 - ap_done (COR/TOW)
// bit 1 - ap_ready (COR/TOW)
// others - reserved
// (SC = Self Clear, COR = Clear on Read, TOW = Toggle on Write, COH = Clear on Handshake)
pobj_port
//------------------------Address Info-------------------
// 0x00 : reserved
// 0x04 : reserved
// 0x08 : reserved
// 0x0c : reserved
// 0x10 : Data signal of lmbda
// bit 31~0 - lmbda[31:0] (Read/Write)
// 0x14 : Data signal of lmbda
// bit 31~0 - lmbda[63:32] (Read/Write)
// 0x18 : reserved
// 0x1c : Data signal of pobj
// bit 31~0 - pobj[31:0] (Read/Write)
// 0x20 : Data signal of pobj
// bit 31~0 - pobj[63:32] (Read/Write)
// 0x24 : reserved
// (SC = Self Clear, COR = Clear on Read, TOW = Toggle on Write, COH = Clear on Handshake)
From this, I understood the following: since my input parameters are of type ‘Double’ it has been divided into 2 registers of 32-bit (Hgh and low). Is this correct?
In that case, how can I assign the input value correctly while having 2 addresses?
This is how I am trying to run the kernel:
from pynq import (allocate, Overlay)
import numpy as np
ol = Overlay('pobj.bit')
pobj_ip = ol.pobj_accel_0
dma_A = ol.axi_dma_A
dma_X = ol.axi_dma_X
dma_Y = ol.axi_dma_Y
dma_Z = ol.axi_dma_Z
M = 64
N = 512
A_buff = allocate(shape=(M, N), dtype=np.float64, cacheable=False)
x_buff = allocate(shape=(N, 1), dtype=np.float64, cacheable=False)
y_buff = allocate(shape=(1, M), dtype=np.float64, cacheable=False)
z_buff = allocate(shape=(1, M), dtype=np.float64, cacheable=False)
CTRL_REG = 0x00
AP_START = (1<<0) # bit 0
AUTO_RESTART = (1<<7) # bit 7
def run_kernel():
dma_A.sendchannel.transfer(A_buff)
dma_X.sendchannel.transfer(x_buff)
dma_Y.sendchannel.transfer(y_buff)
dma_Z.recvchannel.transfer(z_buff)
mmult_ip.write(CTRL_REG, (AP_START | AUTO_RESTART)) # initialize the module
dma_A.sendchannel.wait()
dma_X.sendchannel.wait()
dma_Y.sendchannel.wait()
dma_Z.recvchannel.wait()
How can I assign lmbda and pobj parameters correctly?