From 92bfe849b47d5d1b8d291c2aa0d5ce540a16ef84 Mon Sep 17 00:00:00 2001 From: Daniel Krebs Date: Mon, 4 Jun 2018 17:29:36 +0200 Subject: [PATCH] ips/rtds2gpu: use new connect interface --- fpga/include/villas/fpga/ips/gpu2rtds.hpp | 6 +++++- fpga/include/villas/fpga/ips/rtds2gpu.hpp | 6 +++++- fpga/tests/rtds2gpu.cpp | 15 +++++++-------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/fpga/include/villas/fpga/ips/gpu2rtds.hpp b/fpga/include/villas/fpga/ips/gpu2rtds.hpp index 6e9a14b40..b19702bef 100644 --- a/fpga/include/villas/fpga/ips/gpu2rtds.hpp +++ b/fpga/include/villas/fpga/ips/gpu2rtds.hpp @@ -24,12 +24,16 @@ public: size_t getMaxFrameSize(); -// void dumpDoorbell(uint32_t doorbellRegister) const; + const StreamVertex& + getDefaultMasterPort() const + { return getMasterPort(rtdsOutputStreamPort); } private: bool updateStatus(); private: + static constexpr const char* rtdsOutputStreamPort = "rtds_output"; + struct StatusControlRegister { uint32_t status_ap_vld : 1, _res : 31; diff --git a/fpga/include/villas/fpga/ips/rtds2gpu.hpp b/fpga/include/villas/fpga/ips/rtds2gpu.hpp index bc0e2b94b..64904d630 100644 --- a/fpga/include/villas/fpga/ips/rtds2gpu.hpp +++ b/fpga/include/villas/fpga/ips/rtds2gpu.hpp @@ -32,12 +32,16 @@ public: { return { registerMemory }; } + const StreamVertex& + getDefaultSlavePort() const + { return getSlavePort(rtdsInputStreamPort); } + private: bool updateStatus(); private: static constexpr const char* axiInterface = "m_axi_axi_mm"; - static constexpr const char* streamInterface = "rtds_input"; + static constexpr const char* rtdsInputStreamPort = "rtds_input"; XRtds2gpu xInstance; diff --git a/fpga/tests/rtds2gpu.cpp b/fpga/tests/rtds2gpu.cpp index 5d751ce99..b9ddd62af 100644 --- a/fpga/tests/rtds2gpu.cpp +++ b/fpga/tests/rtds2gpu.cpp @@ -117,9 +117,8 @@ Test(fpga, rtds2gpu, .description = "Rtds2Gpu") dumpMem(dataDst2, dmaMemDst2.getMemoryBlock().getSize()); - // connect DMA to Rtds2Gpu IP - // TODO: this should be done automatically - cr_assert(axiSwitch->connect(6, 7)); + // connect AXI Stream from DMA to Rtds2Gpu IP + cr_assert(dma->connect(rtds2gpu)); cr_assert(rtds2gpu.startOnce(dmaMemDst.getMemoryBlock(), SAMPLE_COUNT, DATA_OFFSET*4, DOORBELL_OFFSET*4), "Preparing Rtds2Gpu IP failed"); @@ -130,7 +129,6 @@ Test(fpga, rtds2gpu, .description = "Rtds2Gpu") cr_assert(dma->writeComplete(), "DMA failed"); - while(not rtds2gpu.isFinished()); const uint32_t* doorbellDst = &dmaMemDst[DOORBELL_OFFSET]; @@ -139,13 +137,14 @@ Test(fpga, rtds2gpu, .description = "Rtds2Gpu") cr_assert(memcmp(dataSrc, dataDst, FRAME_SIZE) == 0, "Memory not equal"); - (void) dmaMemDst2; - (void) dataDst2; for(size_t i = 0; i < SAMPLE_COUNT; i++) { gpu2rtds->registerFrames[i] = dmaMemDst[i]; } - cr_assert(axiSwitch->connect(7, 6)); + + + // connect AXI Stream from Gpu2Rtds IP to DMA + cr_assert(gpu2rtds->connect(*dma)); cr_assert(dma->read(dmaMemDst2.getMemoryBlock(), FRAME_SIZE), "Starting DMA S2MM transfer failed"); @@ -156,7 +155,7 @@ Test(fpga, rtds2gpu, .description = "Rtds2Gpu") cr_assert(dma->readComplete(), "DMA failed"); - while(not rtds2gpu.isFinished()); + while(not gpu2rtds->isFinished()); cr_assert(memcmp(dataSrc, dataDst2, FRAME_SIZE) == 0, "Memory not equal");