Commit d9774cc3 authored by Jens Korinth's avatar Jens Korinth

Merge branch '2018.1' into unified-driver

parents 6e7f2b14 4d3d4560
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(tapasco VERSION 1.0 LANGUAGES C CXX)
include(GNUInstallDirs)
set(CMNDIR "${CMAKE_CURRENT_SOURCE_DIR}/common")
set(CMAKE_DEBUG_POSTFIX d)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_C_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
add_subdirectory(platform)
add_subdirectory(arch/axi4mm)
add_subdirectory(arch/tests)
\ No newline at end of file
cmake_minimum_required(VERSION 2.8)
project(arch-axi4mm)
if (NOT EXISTS "$ENV{TAPASCO_HOME}")
message(FATAL_ERROR "Please set TAPASCO_HOME environment variable to root directory of Tapasco")
endif (NOT EXISTS "$ENV{TAPASCO_HOME}")
include ("$ENV{TAPASCO_HOME}/cmake/Tapasco.cmake")
set(CMAKE_INSTALL_PREFIX "${TAPASCO_HOME}/lib")
set(SRCDIR "src")
set(CMNDIR "../common/src")
set(AXI4MM_SOURCES "${SRCDIR}/tapasco_device.c"
"${SRCDIR}/tapasco_regs.c")
set(COMMON_SOURCES "${CMNDIR}/tapasco_delayed_transfers.c"
"${CMNDIR}/tapasco_device.c"
"${CMNDIR}/tapasco_errors.c"
"${CMNDIR}/tapasco_jobs.c"
"${CMNDIR}/tapasco_logging.c"
"${CMNDIR}/tapasco_local_mem.c"
"${CMNDIR}/tapasco_memory.c"
"${CMNDIR}/tapasco_pemgmt.c"
"${CMNDIR}/tapasco_scheduler.c"
"${CMNDIR}/tapasco_version.c"
"${TAPASCO_COMMON_DIR}/src/gen_mem.c"
"${TAPASCO_COMMON_DIR}/src/gen_queue.c")
project(arch-axi4mm VERSION 1.0 LANGUAGES C CXX)
set(PCMNDIR "../common/src")
set(GPCMNDIR "${TAPASCO_HOME}/common")
set(AXI4MM_SOURCES "src/tapasco_axi4mm.c"
"src/tapasco_device.c"
"src/tapasco_regs.c")
set(COMMON_SOURCES "${PCMNDIR}/tapasco_delayed_transfers.c"
"${PCMNDIR}/tapasco_device.c"
"${PCMNDIR}/tapasco_errors.c"
"${PCMNDIR}/tapasco_jobs.c"
"${PCMNDIR}/tapasco_logging.c"
"${PCMNDIR}/tapasco_local_mem.c"
"${PCMNDIR}/tapasco_memory.c"
"${PCMNDIR}/tapasco_pemgmt.c"
"${PCMNDIR}/tapasco_scheduler.c"
"${PCMNDIR}/tapasco_version.c"
"${CMNDIR}/src/gen_mem.c"
"${CMNDIR}/src/gen_queue.c")
add_library(tapasco ${AXI4MM_SOURCES} ${COMMON_SOURCES})
target_include_directories(tapasco PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../common/include>" PRIVATE ${CMNDIR}/include)
include_directories(${TAPASCO_INCDIRS})
include_directories("include" "../common/include" "${PLATFORMDIR}/common/include" "${TAPASCO_COMMON_DIR}/src/include")
set_source_files_properties(${AXI4MM_SOURCES} ${COMMON_SOURCES} PROPERTIES COMPILE_FLAGS ${TAPASCO_CFLAGS})
add_library(tapasco SHARED ${AXI4MM_SOURCES} ${COMMON_SOURCES})
add_library(libtapasco-static STATIC ${AXI4MM_SOURCES} ${COMMON_SOURCES} ${TAPASCO_PLATFORM_LIB})
target_link_libraries(tapasco platform atomic pthread)
set_target_properties(libtapasco-static PROPERTIES OUTPUT_NAME tapasco)
install(TARGETS tapasco libtapasco-static
LIBRARY DESTINATION "lib/${TAPASCO_TARGET}"
ARCHIVE DESTINATION "lib/${TAPASCO_TARGET}/static")
install(TARGETS tapasco EXPORT TapascoConfig
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(EXPORT TapascoConfig DESTINATION share/Tapasco/cmake)
export(TARGETS tapasco FILE TapascoConfig.cmake)
......@@ -88,8 +88,9 @@ namespace eval full_axi_wrapper {
return [list $inst $args]
}
proc fix_address_map {} {
proc fix_address_map {args} {
assign_bd_address
return $args
}
}
......
......@@ -87,9 +87,7 @@ tapasco_res_t tapasco_local_mem_alloc(tapasco_local_mem_t *lmem,
tapasco_handle_t *h)
{
*h = INVALID_ADDRESS;
++slot_id;
while (*h == INVALID_ADDRESS && lmem->lmem[slot_id]) {
*h = gen_mem_malloc(&lmem->lmem[slot_id], sz);
do {
++slot_id;
}
DEVLOG(lmem->dev_id, LALL_MEM, "request to allocate %zd bytes for slot_id #" PRIslot "-> " PRIhandle,
......
......@@ -43,6 +43,7 @@ extern "C" {
#include <cstdint>
#include <iostream>
#include <functional>
#include <array>
using namespace std;
......@@ -328,6 +329,16 @@ private:
return set_arg(j_id, arg_idx, t.value, flags, TAPASCO_COPY_DIRECTION_FROM);
}
/** Sets a std::array output-only argument (alloc only). **/
template<typename T, std::size_t N>
tapasco_res_t set_args(tapasco_job_id_t const j_id, size_t const arg_idx, OutOnly<std::array<T, N>> t) const noexcept
{
tapasco_handle_t h { 0 };
tapasco_res_t r;
if ((r = tapasco_device_alloc(dev_ctx, &h, N * sizeof(T), TAPASCO_DEVICE_ALLOC_FLAGS_NONE)) != TAPASCO_SUCCESS) return r;
return tapasco_device_job_set_arg(dev_ctx, j_id, arg_idx, sizeof(h), &h);
}
/** Sets a single pointer argument (alloc + copy). **/
template<typename T>
tapasco_res_t set_arg(
......@@ -342,6 +353,28 @@ private:
return tapasco_device_job_set_arg_transfer(devctx, j_id, arg_idx, sizeof(*t), t, flags, copy_flags);
}
/** Sets a std::array argument (alloc + copy). **/
template<typename T, std::size_t N>
tapasco_res_t set_args(tapasco_job_id_t const j_id, size_t const arg_idx, std::array<T, N> &t) const noexcept
{
tapasco_handle_t h { 0 };
tapasco_res_t r;
if ((r = tapasco_device_alloc(dev_ctx, &h, N * sizeof(T), TAPASCO_DEVICE_ALLOC_FLAGS_NONE)) != TAPASCO_SUCCESS) return r;
if ((r = tapasco_device_copy_to(dev_ctx, t.data(), h, N * sizeof(T), TAPASCO_DEVICE_COPY_BLOCKING)) != TAPASCO_SUCCESS) return r;
return tapasco_device_job_set_arg(dev_ctx, j_id, arg_idx, sizeof(h), &h);
}
/** Sets a const std::array argument (alloc + copy). **/
template<typename T, std::size_t N>
tapasco_res_t set_args(tapasco_job_id_t const j_id, size_t const arg_idx, const std::array<T, N> &t) const noexcept
{
tapasco_handle_t h { 0 };
tapasco_res_t r;
if ((r = tapasco_device_alloc(dev_ctx, &h, N * sizeof(T), TAPASCO_DEVICE_ALLOC_FLAGS_NONE)) != TAPASCO_SUCCESS) return r;
if ((r = tapasco_device_copy_to(dev_ctx, t.data(), h, N * sizeof(T), TAPASCO_DEVICE_COPY_BLOCKING)) != TAPASCO_SUCCESS) return r;
return tapasco_device_job_set_arg(dev_ctx, j_id, arg_idx, sizeof(h), &h);
}
/** Sets a single const pointer argument (alloc + copy). **/
template<typename T>
tapasco_res_t set_arg(
......@@ -390,6 +423,23 @@ private:
return TAPASCO_SUCCESS;
}
/** Gets a output-only std::array from the device (copy + dealloc). **/
template<typename T, std::size_t N>
tapasco_res_t get_args(tapasco_job_id_t const j_id, size_t const arg_idx, std::array<T, N> &t) const noexcept {
tapasco_handle_t h;
tapasco_res_t r;
if ((r = tapasco_device_job_get_arg(dev_ctx, j_id, arg_idx, sizeof(h), &h)) != TAPASCO_SUCCESS) return r;
if ((r = tapasco_device_copy_from(dev_ctx, h, (void *)t.data(), N * sizeof(T), TAPASCO_DEVICE_COPY_BLOCKING)) != TAPASCO_SUCCESS) return r;
tapasco_device_free(dev_ctx, h, TAPASCO_DEVICE_ALLOC_FLAGS_NONE);
return TAPASCO_SUCCESS;
}
/** Gets a std::array from the device (copy + dealloc). **/
template<typename T, std::size_t N>
tapasco_res_t get_args(tapasco_job_id_t const j_id, size_t const arg_idx, OutOnly<std::array<T, N>> t) const noexcept {
return get_args(j_id, arg_idx, *t.value);
}
/** Gets a single pointer argument (copy + dealloc). **/
template<typename T>
tapasco_res_t get_arg(tapasco_job_id_t const j_id, size_t const arg_idx, T* t) noexcept
......
cmake_minimum_required (VERSION 2.8)
include(ExternalProject)
project (tapasco-debug)
if ("$ENV{TAPASCO_HOME}" STREQUAL "")
message(FATAL_ERROR "Please set env var TAPASCO_HOME to root directory of Tapasco.")
endif ("$ENV{TAPASCO_HOME}" STREQUAL "")
set (CMAKE_INSTALL_PREFIX "${TAPASCO_HOME}")
include ("$ENV{TAPASCO_HOME}/cmake/Tapasco.cmake")
set (CMAKE_INSTALL_PREFIX "${TAPASCO_HOME}/bin")
add_executable (tapasco-debug tapasco_debug.cpp ${CMNDIR}/src/gen_queue.c)
target_include_directories(tapasco-debug PRIVATE ${CMNDIR}/include)
target_link_libraries (tapasco-debug tapasco platform pthread atomic ncurses -static-libstdc++ -static-libgcc)
set(CXX_SOURCES tapasco_benchmark.cpp tapasco_debug.cpp json11.cpp jobs/Jobs.cpp)
set(CC_SOURCES ${TAPASCO_COMMON_DIR}/src/gen_queue.c)
add_executable (tapasco-benchmark tapasco_benchmark.cpp ${CMAKE_CURRENT_BINARY_DIR}/json11/json11.cpp ${CMNDIR}/src/gen_queue.c)
target_include_directories(tapasco-benchmark PRIVATE ${CMNDIR}/include ${CMAKE_CURRENT_BINARY_DIR}/json11)
target_link_libraries (tapasco-benchmark tapasco platform pthread atomic ncurses -static-libstdc++ -static-libgcc)
set_source_files_properties(${CXX_SOURCES} PROPERTIES COMPILE_FLAGS ${TAPASCO_CXXFLAGS})
set_source_files_properties(${CC_SOURCES} PROPERTIES COMPILE_FLAGS ${TAPASCO_CFLAGS})
link_directories(${TAPASCO_STATICLINKDIRS})
include_directories(${TAPASCO_INCDIRS} "${TAPASCO_HOME}/arch/common/include" "${TAPASCO_HOME}/platform/common/include")
add_executable (tapasco-debug tapasco_debug.cpp ${TAPASCO_COMMON_DIR}/src/gen_queue.c)
target_link_libraries (tapasco-debug m tapasco platform pthread atomic ncurses)
set_target_properties (tapasco-debug PROPERTIES LINK_FLAGS ${TAPASCO_LDFLAGS})
add_executable (tapasco-benchmark tapasco_benchmark.cpp json11.cpp)
target_link_libraries (tapasco-benchmark pthread atomic ncurses)
set_target_properties (tapasco-benchmark PROPERTIES LINK_SEARCH_START_STATIC 1)
set_target_properties (tapasco-benchmark PROPERTIES LINK_SEARCH_END_STATIC 1)
set (CMAKE_FIND_LIBRARY_SUFFIXES ".a")
target_link_libraries (tapasco-benchmark tapasco platform)
set_target_properties (tapasco-benchmark PROPERTIES LINK_FLAGS ${TAPASCO_LDFLAGS})
add_executable (tapasco-jobs jobs/Jobs.cpp)
target_link_libraries (tapasco-jobs tapasco platform pthread atomic ncurses)
set_target_properties (tapasco-jobs PROPERTIES LINK_FLAGS ${TAPASCO_LDFLAGS})
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/json11.cpp ${CMAKE_CURRENT_SOURCE_DIR}/json11.hpp
COMMAND rm -rf json11
COMMAND git clone https://github.com/dropbox/json11.git
COMMAND cp json11/json11.* ${CMAKE_CURRENT_SOURCE_DIR}
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/json11/json11.cpp ${CMAKE_CURRENT_BINARY_DIR}/json11/json11.hpp
COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/json11
COMMAND git clone https://github.com/dropbox/json11.git ${CMAKE_CURRENT_BINARY_DIR}/json11
)
install (TARGETS tapasco-debug tapasco-benchmark
RUNTIME DESTINATION ${TAPASCO_HOME}/bin)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
......@@ -12,6 +12,7 @@ tlkm_cmd = 'cd {0} && make -j {1}'
parser = argparse.ArgumentParser()
parser.add_argument('--mode', help='build mode (default: %(default)s)', default='release', choices=['clean', 'release', 'debug', 'driver_debug'])
parser.add_argument('--rebuild', help='force rebuild libs (default: %(default)s)', action='store_true')
parser.add_argument('--shared', help='build shared library instead of static', action='store_true')
args = parser.parse_args()
clean = args.mode == 'clean'
......
# create a dictionary of compatible VLNVs
source $::env(TAPASCO_HOME)/common/common_ip.tcl
dict set stdcomps dualdma vlnv "esa.informatik.tu-darmstadt.de:user:dual_dma:1.12"
dict set stdcomps system_ila vlnv "xilinx.com:ip:system_ila:1.1"
dict set stdcomps axi_pcie3_0_usp vlnv "xilinx.com:ip:xdma:4.0"
dict set stdcomps clk_wiz vlnv "xilinx.com:ip:clk_wiz:6.0"
dict set stdcomps mig_core vlnv "xilinx.com:ip:mig_7series:4.1"
This source diff could not be displayed because it is too large. You can view the blob instead.
OPTION psf_version = 2.1;
BEGIN DRIVER dual_dma
OPTION supported_peripherals = (dual_dma);
OPTION copyfiles = all;
OPTION VERSION = 1.0;
OPTION NAME = dual_dma;
END DRIVER
#
# Copyright (C) 2014 Jens Korinth, TU Darmstadt
# Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
#
# This file is part of Tapasco (TPC).
#
......@@ -16,14 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
#
set(ARCH "${CMAKE_SYSTEM_PROCESSOR}")
if ("$ENV{TAPASCO_HOME}" STREQUAL "")
message(FATAL_ERROR "Please set env var TAPASCO_HOME to root directory of Tapasco.")
endif ("$ENV{TAPASCO_HOME}" STREQUAL "")
set(TAPASCO_HOME "$ENV{TAPASCO_HOME}")
# link_directories(${TAPASCO_HOME}/arch/lib/${ARCH}/static ${TAPASCO_HOME}/platform/lib/${ARCH}/static)
link_directories(${TAPASCO_HOME}/arch/lib/${ARCH} ${TAPASCO_HOME}/platform/lib/${ARCH})
include_directories(${TAPASCO_HOME}/arch/common/include ${TAPASCO_HOME}/platform/common/include)
proc generate {drv_handle} {
xdefine_include_file $drv_handle "xparameters.h" "dual_dma" "NUM_INSTANCES" "DEVICE_ID" "C_S_AXI_BASEADDR" "C_S_AXI_HIGHADDR"
}
COMPILER=
ARCHIVER=
CP=cp
COMPILER_FLAGS=
EXTRA_COMPILER_FLAGS=
LIB=libxil.a
RELEASEDIR=../../../lib
INCLUDEDIR=../../../include
INCLUDES=-I./. -I${INCLUDEDIR}
INCLUDEFILES=*.h
LIBSOURCES=*.c
OUTS = *.o
libs:
echo "Compiling dual_dma..."
$(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) $(LIBSOURCES)
$(ARCHIVER) -r ${RELEASEDIR}/${LIB} ${OUTS}
make clean
include:
${CP} $(INCLUDEFILES) $(INCLUDEDIR)
clean:
rm -rf ${OUTS}
//
// Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
//
// This file is part of Tapasco (TPC).
//
// Tapasco is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tapasco is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
//
/***************************** Include Files *******************************/
#include "dual_dma.h"
/************************** Function Definitions ***************************/
//
// Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
//
// This file is part of Tapasco (TPC).
//
// Tapasco is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tapasco is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef DUAL_DMA_H
#define DUAL_DMA_H
/****************** Include Files ********************/
#include "xil_types.h"
#include "xstatus.h"
#define DUAL_DMA_S_AXI_SLV_REG0_OFFSET 0
#define DUAL_DMA_S_AXI_SLV_REG1_OFFSET 4
#define DUAL_DMA_S_AXI_SLV_REG2_OFFSET 8
#define DUAL_DMA_S_AXI_SLV_REG3_OFFSET 12
#define DUAL_DMA_S_AXI_SLV_REG4_OFFSET 16
#define DUAL_DMA_S_AXI_SLV_REG5_OFFSET 20
#define DUAL_DMA_S_AXI_SLV_REG6_OFFSET 24
#define DUAL_DMA_S_AXI_SLV_REG7_OFFSET 28
#define DUAL_DMA_S_AXI_SLV_REG8_OFFSET 32
#define DUAL_DMA_S_AXI_SLV_REG9_OFFSET 36
#define DUAL_DMA_S_AXI_SLV_REG10_OFFSET 40
#define DUAL_DMA_S_AXI_SLV_REG11_OFFSET 44
#define DUAL_DMA_S_AXI_SLV_REG12_OFFSET 48
#define DUAL_DMA_S_AXI_SLV_REG13_OFFSET 52
#define DUAL_DMA_S_AXI_SLV_REG14_OFFSET 56
#define DUAL_DMA_S_AXI_SLV_REG15_OFFSET 60
#define DUAL_DMA_S_AXI_SLV_REG16_OFFSET 64
#define DUAL_DMA_S_AXI_SLV_REG17_OFFSET 68
#define DUAL_DMA_S_AXI_SLV_REG18_OFFSET 72
#define DUAL_DMA_S_AXI_SLV_REG19_OFFSET 76
#define DUAL_DMA_S_AXI_SLV_REG20_OFFSET 80
#define DUAL_DMA_S_AXI_SLV_REG21_OFFSET 84
#define DUAL_DMA_S_AXI_SLV_REG22_OFFSET 88
#define DUAL_DMA_S_AXI_SLV_REG23_OFFSET 92
#define DUAL_DMA_S_AXI_SLV_REG24_OFFSET 96
#define DUAL_DMA_S_AXI_SLV_REG25_OFFSET 100
#define DUAL_DMA_S_AXI_SLV_REG26_OFFSET 104
#define DUAL_DMA_S_AXI_SLV_REG27_OFFSET 108
#define DUAL_DMA_S_AXI_SLV_REG28_OFFSET 112
#define DUAL_DMA_S_AXI_SLV_REG29_OFFSET 116
#define DUAL_DMA_S_AXI_SLV_REG30_OFFSET 120
#define DUAL_DMA_S_AXI_SLV_REG31_OFFSET 124
/**************************** Type Definitions *****************************/
/**
*
* Write a value to a DUAL_DMA register. A 32 bit write is performed.
* If the component is implemented in a smaller width, only the least
* significant data is written.
*
* @param BaseAddress is the base address of the DUAL_DMAdevice.
* @param RegOffset is the register offset from the base to write to.
* @param Data is the data written to the register.
*
* @return None.
*
* @note
* C-style signature:
* void DUAL_DMA_mWriteReg(u32 BaseAddress, unsigned RegOffset, u32 Data)
*
*/
#define DUAL_DMA_mWriteReg(BaseAddress, RegOffset, Data) \
Xil_Out32((BaseAddress) + (RegOffset), (u32)(Data))
/**
*
* Read a value from a DUAL_DMA register. A 32 bit read is performed.
* If the component is implemented in a smaller width, only the least
* significant data is read from the register. The most significant data
* will be read as 0.
*
* @param BaseAddress is the base address of the DUAL_DMA device.
* @param RegOffset is the register offset from the base to write to.
*
* @return Data is the data from the register.
*
* @note
* C-style signature:
* u32 DUAL_DMA_mReadReg(u32 BaseAddress, unsigned RegOffset)
*
*/
#define DUAL_DMA_mReadReg(BaseAddress, RegOffset) \
Xil_In32((BaseAddress) + (RegOffset))
/************************** Function Prototypes ****************************/
/**
*
* Run a self-test on the driver/device. Note this may be a destructive test if
* resets of the device are performed.
*
* If the hardware system is not built correctly, this function may never
* return to the caller.
*
* @param baseaddr_p is the base address of the DUAL_DMA instance to be worked on.
*
* @return
*
* - XST_SUCCESS if all self-test code passed
* - XST_FAILURE if any self-test code failed
*
* @note Caching must be turned off for this function to work.
* @note Self test may fail if data memory and device are not on the same bus.
*
*/
XStatus DUAL_DMA_Reg_SelfTest(void * baseaddr_p);
#endif // DUAL_DMA_H
//
// Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
//
// This file is part of Tapasco (TPC).
//
// Tapasco is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tapasco is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
//
/***************************** Include Files *******************************/
#include "dual_dma.h"
#include "xparameters.h"
#include "stdio.h"
#include "xil_io.h"
/************************** Constant Definitions ***************************/
#define READ_WRITE_MUL_FACTOR 0x10
/************************** Function Definitions ***************************/
/**
*
* Run a self-test on the driver/device. Note this may be a destructive test if
* resets of the device are performed.
*
* If the hardware system is not built correctly, this function may never
* return to the caller.
*
* @param baseaddr_p is the base address of the DUAL_DMAinstance to be worked on.
*
* @return
*
* - XST_SUCCESS if all self-test code passed
* - XST_FAILURE if any self-test code failed
*
* @note Caching must be turned off for this function to work.
* @note Self test may fail if data memory and device are not on the same bus.
*
*/
XStatus DUAL_DMA_Reg_SelfTest(void * baseaddr_p)
{
u32 baseaddr;
int write_loop_index;
int read_loop_index;
int Index;
baseaddr = (u32) baseaddr_p;
xil_printf("******************************\n\r");
xil_printf("* User Peripheral Self Test\n\r");
xil_printf("******************************\n\n\r");
/*
* Write to user logic slave module register(s) and read back
*/
xil_printf("User logic slave module test...\n\r");
for (write_loop_index = 0 ; write_loop_index < 4; write_loop_index++)
DUAL_DMA_mWriteReg (baseaddr, write_loop_index*4, (write_loop_index+1)*READ_WRITE_MUL_FACTOR);
for (read_loop_index = 0 ; read_loop_index < 4; read_loop_index++)
if ( DUAL_DMA_mReadReg (baseaddr, read_loop_index*4) != (read_loop_index+1)*READ_WRITE_MUL_FACTOR){
xil_printf ("Error reading register value at address %x\n", (int)baseaddr + read_loop_index*4);
return XST_FAILURE;
}
xil_printf(" - slave register write/read passed\n\n\r");
return XST_SUCCESS;
}
#
# Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
#
# This file is part of Tapasco (TPC).
#
# Tapasco is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tapasco is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
#
#has to be scoped to the dual_dma instance
set s_clk [get_clocks -of_objects [get_ports m32_axi_aclk]]
set m_clk [get_clocks -of_objects [get_ports m64_axi_aclk]]
set_false_path -through [get_ports -filter {NAME =~ *_axi_aresetn}] -to [filter [get_cells -hierarchical -filter {NAME =~ */rstblk/*}] {IS_SEQUENTIAL}]
set_max_delay -from [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -endpoints_only] {IS_LEAF}] -to [filter [all_fanout -from [get_ports m64_axi_aclk] -flat -only_cells] {IS_SEQUENTIAL && (NAME !~ *dout_i_reg[*])}] -datapath_only [get_property -min PERIOD $s_clk]
set_max_delay -from [filter [all_fanout -from [get_ports m64_axi_aclk] -flat -endpoints_only] {IS_LEAF}] -to [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -only_cells] {IS_SEQUENTIAL && (NAME !~ *dout_i_reg[*])}] -datapath_only [get_property -min PERIOD $m_clk]
set_disable_timing -from CLK -to O [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -endpoints_only -only_cells] {PRIMITIVE_SUBGROUP==dram || PRIMITIVE_SUBGROUP==LUTRAM}]
set_disable_timing -from CLK -to O [filter [all_fanout -from [get_ports m64_axi_aclk] -flat -endpoints_only -only_cells] {PRIMITIVE_SUBGROUP==dram || PRIMITIVE_SUBGROUP==LUTRAM}]
set g_clk [get_clocks -of_objects [get_ports s_axi_aclk]]
set_max_delay -from [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -endpoints_only] {IS_LEAF}] -to [filter [all_fanout -from [get_ports s_axi_aclk] -flat -only_cells] {IS_SEQUENTIAL && (NAME !~ *dout_i_reg[*])}] -datapath_only [get_property -min PERIOD $s_clk]
set_max_delay -from [filter [all_fanout -from [get_ports s_axi_aclk] -flat -endpoints_only] {IS_LEAF}] -to [filter [all_fanout -from [get_ports m32_axi_aclk] -flat -only_cells] {IS_SEQUENTIAL && (NAME !~ *dout_i_reg[*])}] -datapath_only [get_property -min PERIOD $g_clk]
set_disable_timing -from CLK -to O [filter [all_fanout -from [get_ports s_axi_aclk] -flat -endpoints_only -only_cells] {PRIMITIVE_SUBGROUP==dram || PRIMITIVE_SUBGROUP==LUTRAM}]
#
# Copyright (C) 2014 David de la Chevallerie, TU Darmstadt
#
# This file is part of Tapasco (TPC).
#
# Tapasco is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tapasco is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Tapasco. If not, see <http://www.gnu.org/licenses/>.
#
proc create_ipi_design { offsetfile design_name } {
create_bd_design $design_name
open_bd_design $design_name
# Create Clock and Reset Ports
set ACLK_LITE [ create_bd_port -dir I -type clk ACLK_LITE ]
set_property -dict [ list CONFIG.FREQ_HZ {100000000} CONFIG.PHASE {0.000} CONFIG.CLK_DOMAIN "${design_name}_ACLK_LITE" ] $ACLK_LITE
set ARESETN_LITE [ create_bd_port -dir I -type rst ARESETN_LITE ]
set_property -dict [ list CONFIG.POLARITY {ACTIVE_LOW} ] $ARESETN_LITE
set_property CONFIG.ASSOCIATED_RESET ARESETN_LITE $ACLK_LITE
set ACLK_M64 [ create_bd_port -dir I -type clk ACLK_M64 ]
set_property -dict [ list CONFIG.FREQ_HZ {100000000} CONFIG.PHASE {0.000} CONFIG.CLK_DOMAIN "${design_name}_ACLK_M64" ] $ACLK_M64
set ARESETN_M64 [ create_bd_port -dir I -type rst ARESETN_M64 ]
set_property -dict [ list CONFIG.POLARITY {ACTIVE_LOW} ] $ARESETN_M64
set_property CONFIG.ASSOCIATED_RESET ARESETN_M64 $ACLK_M64
set ACLK_M32 [ create_bd_port -dir I -type clk ACLK_M32 ]
set_property -dict [ list CONFIG.FREQ_HZ {100000000} CONFIG.PHASE {0.000} CONFIG.CLK_DOMAIN "${design_name}_ACLK_M32" ] $ACLK_M32
set ARESETN_M32 [ create_bd_port -dir I -type rst ARESETN_M32 ]
set_property -dict [ list CONFIG.POLARITY {ACTIVE_LOW} ] $ARESETN_M32
set_property CONFIG.ASSOCIATED_RESET ARESETN_M32 $ACLK_M32
# Create instance: dual_dma_0, and set properties
set dual_dma_0 [ create_bd_cell -type ip -vlnv esa.informatik.tu-darmstadt.de:user:dual_dma:1.0 dual_dma_0]
# Create External ports
set IRQ [ create_bd_port -dir O IRQ ]
connect_bd_net -net IRQ_net [get_bd_ports IRQ] [get_bd_pins dual_dma_0/IRQ]
# Create axi interconnect
set axi_interconnect_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:axi_interconnect:2.1 axi_interconnect_0]
set_property -dict [list CONFIG.NUM_SI {2} CONFIG.NUM_MI {1} CONFIG.STRATEGY {2} CONFIG.S00_HAS_DATA_FIFO {2} CONFIG.S01_HAS_DATA_FIFO {2}] [get_bd_cells axi_interconnect_0] $axi_interconnect_0
# Create port connections
connect_bd_net -net aclk_net_m64 [get_bd_ports ACLK_M64] [get_bd_pins axi_interconnect_0/ACLK] [get_bd_pins axi_interconnect_0/S00_ACLK] [get_bd_pins axi_interconnect_0/S01_ACLK] [get_bd_pins axi_interconnect_0/M00_ACLK]
connect_bd_net -net aresetn_net_m64 [get_bd_ports ARESETN_M64] [get_bd_pins axi_interconnect_0/ARESETN] [get_bd_pins axi_interconnect_0/S00_ARESETN] [get_bd_pins axi_interconnect_0/S01_ARESETN] [get_bd_pins axi_interconnect_0/M00_ARESETN]
# Create instance: master_0, and set properties
set master_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:cdn_axi_bfm master_0]
set_property -dict [ list CONFIG.C_PROTOCOL_SELECTION {2} ] $master_0
# Create interface connections
connect_bd_intf_net [get_bd_intf_pins master_0/M_AXI_LITE] [get_bd_intf_pins dual_dma_0/S_AXI]
# Create port connections
connect_bd_net -net aclk_net_lite [get_bd_ports ACLK_LITE] [get_bd_pins master_0/M_AXI_LITE_ACLK] [get_bd_pins dual_dma_0/S_AXI_ACLK]
connect_bd_net -net aresetn_net_lite [get_bd_ports ARESETN_LITE] [get_bd_pins master_0/M_AXI_LITE_ARESETN] [get_bd_pins dual_dma_0/S_AXI_ARESETN]
# Create instance: master_1, and set properties
set master_1 [ create_bd_cell -type ip -vlnv xilinx.com:ip:cdn_axi_bfm master_1]
set_property -dict [ list CONFIG.C_PROTOCOL_SELECTION {2} CONFIG.C_M_AXI4_LITE_ADDR_WIDTH {64} ] $master_1
# Create interface connections
connect_bd_intf_net [get_bd_intf_pins master_1/M_AXI_LITE] [get_bd_intf_pins axi_interconnect_0/S00_AXI]
# Create port connections
connect_bd_net -net [get_bd_nets aclk_net_m64] [get_bd_ports ACLK_M64] [get_bd_pins master_1/m_axi_lite_aclk]
connect_bd_net -net [get_bd_nets aresetn_net_m64] [get_bd_ports ARESETN_M64] [get_bd_pins master_1/m_axi_lite_aresetn]
# Create instance: slave_0, and set properties
set slave_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:cdn_axi_bfm slave_0]
set_property -dict [ list CONFIG.C_PROTOCOL_SELECTION {1} CONFIG.C_MODE_SELECT {1} CONFIG.C_S_AXI4_ADDR_WIDTH {64} CONFIG.C_S_AXI4_HIGHADDR {0x500000006000FFFF} CONFIG.C_S_AXI4_BASEADDR {0x5000000060000000} CONFIG.C_S_AXI4_MEMORY_MODEL_MODE {1} ] $slave_0
# Create interface connections
connect_bd_intf_net [get_bd_intf_pins slave_0/S_AXI] [get_bd_intf_pins axi_interconnect_0/M00_AXI]
connect_bd_intf_net [get_bd_intf_pins dual_dma_0/M64_AXI] [get_bd_intf_pins axi_interconnect_0/S01_AXI]
# Create port connections
connect_bd_net -net [get_bd_nets aclk_net_m64] [get_bd_ports ACLK_M64] [get_bd_pins slave_0/S_AXI_ACLK] [get_bd_pins dual_dma_0/M64_AXI_ACLK]
connect_bd_net -net [get_bd_nets aresetn_net_m64] [get_bd_ports ARESETN_M64] [get_bd_pins slave_0/S_AXI_ARESETN] [get_bd_pins dual_dma_0/M64_AXI_ARESETN]
# Create instance: slave_1, and set properties
set slave_1 [ create_bd_cell -type ip -vlnv xilinx.com:ip:cdn_axi_bfm slave_1]
set_property -dict [ list CONFIG.C_PROTOCOL_SELECTION {1} CONFIG.C_MODE_SELECT {1} CONFIG.C_S_AXI4_HIGHADDR {0x4000FFFF} CONFIG.C_S_AXI4_BASEADDR {0x40000000} CONFIG.C_S_AXI4_MEMORY_MODEL_MODE {1} ] $slave_1
# Create interface connections
connect_bd_intf_net [get_bd_intf_pins slave_1/S_AXI] [get_bd_intf_pins dual_dma_0/M32_AXI]
# Create port connections
connect_bd_net -net aclk_net_m32 [get_bd_ports ACLK_M32] [get_bd_pins slave_1/S_AXI_ACLK] [get_bd_pins dual_dma_0/M32_AXI_ACLK]
connect_bd_net -net aresetn_net [get_bd_ports ARESETN_M32] [get_bd_pins slave_1/S_AXI_ARESETN] [get_bd_pins dual_dma_0/M32_AXI_ARESETN]