diff --git a/.gitattributes b/.gitattributes index c645d27e1ebe7b67d762930925cec04a1e42c7a3..5bb99603356dc3c99b0b510eac23131da021ae40 100644 --- a/.gitattributes +++ b/.gitattributes @@ -430,3 +430,4 @@ splinedrive_kianRiscV/linux_socs/kianv_mc_rv32ima_sv32/os/linux/buildroot-kianv- splinedrive_kianRiscV/linux_socs/kianv_mc_rv32ima_sv32/os/linux/buildroot-kianv-soc/bldroot/rootfs-overlay/root/TinyPrograms/race filter=lfs diff=lfs merge=lfs -text splinedrive_kianRiscV/linux_socs/kianv_mc_rv32ima_sv32/os/linux/buildroot-kianv-soc/bldroot/rootfs-overlay/root/TinyPrograms/render filter=lfs diff=lfs merge=lfs -text splinedrive_kianRiscV/linux_socs/kianv_mc_rv32ima_sv32/os/linux/buildroot-kianv-soc/bldroot/rootfs-overlay/root/TinyPrograms/tinyraytracer filter=lfs diff=lfs merge=lfs -text +KastnerRG_riffa/java/riffa.jar filter=lfs diff=lfs merge=lfs -text diff --git a/KastnerRG_riffa/LICENSE b/KastnerRG_riffa/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..dd8a6e7bcc9a3d3b24c5a4fa0b90a4af5c2263d1 --- /dev/null +++ b/KastnerRG_riffa/LICENSE @@ -0,0 +1,34 @@ +---------------------------------------------------------------------- +Copyright (c) 2016, The Regents of the University of California All +rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of The Regents of the University of California + nor the names of its contributors may be used to endorse or + promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL REGENTS OF THE +UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. +---------------------------------------------------------------------- diff --git a/KastnerRG_riffa/Makefile b/KastnerRG_riffa/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..817353c0606acc7aa01dc2cd15c8e32a8d9ad418 --- /dev/null +++ b/KastnerRG_riffa/Makefile @@ -0,0 +1,76 @@ +# ---------------------------------------------------------------------- +# Copyright (c) 2016, The Regents of the University of California All +# rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of The Regents of the University of California +# nor the names of its contributors may be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL REGENTS OF THE +# UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +# DAMAGE. +# ---------------------------------------------------------------------- +#----------------------------------------------------------------------- +# Filename: Makefile +# Version: 1.0 +# Description: Top-level makefile for building a RIFFA distribution +# Author: Dustin Richmond (@darichmond) +#----------------------------------------------------------------------- +include release.mk +CURRENT_PATH := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) +RIFFA_ROOT_PATH := $(CURRENT_PATH) + +RELEASE_VER=2.2.2 +RELEASE_DIR=riffa_$(RELEASE_VER) +RELEASE_PATH=$(CURRENT_PATH)/$(RELEASE_DIR) +RELEASE_SRC_DIR=$(RELEASE_DIR)/source +RELEASE_SRC_PATH=$(CURRENT_PATH)/$(RELEASE_SRC_DIR) +RELEASE_DOC_DIR=$(RELEASE_DIR)/documentation +RELEASE_DOC_PATH=$(CURRENT_PATH)/$(RELEASE_DOC_DIR) +RELEASE_INSTALL_DIR=$(RELEASE_DIR)/install +RELEASE_INSTALL_PATH=$(CURRENT_PATH)/$(RELEASE_INSTALL_DIR) + +VENDORS=altera xilinx +SUBDIRS=c_c++ docs driver fpga java matlab python #install + +all-boards: + $(MAKE) -C fpga $(VENDORS) + +$(RELEASE_DIR): + mkdir $@ + +$(RELEASE_SRC_DIR): $(RELEASE_DIR) check-release + mkdir $@ + +$(RELEASE_DOC_DIR): $(RELEASE_DIR) check-release + mkdir $@ + +release: clean $(RELEASE_DIR) $(RELEASE_SRC_DIR) $(RELEASE_DOC_DIR) $(SUBDIRS) + +$(SUBDIRS):: + make -C $@ $(MAKECMDGOALS) RELEASE_SRC_PATH=$(RELEASE_SRC_PATH) RELEASE_VER=$(RELEASE_VER) RIFFA_ROOT_PATH=$(RIFFA_ROOT_PATH) RELEASE_DOC_PATH=$(RELEASE_DOC_PATH) + +clean: + rm -rf $(RELEASE_DIR) diff --git a/KastnerRG_riffa/README.md b/KastnerRG_riffa/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1bcab524ff11a0493c455b3ace6bb2c4347388eb --- /dev/null +++ b/KastnerRG_riffa/README.md @@ -0,0 +1,8 @@ +# riffa +RIFFA (Reusable Integration Framework for FPGA Accelerators) is a simple framework for communicating data from a host CPU to a FPGA via a PCI Express bus. The framework requires a PCIe enabled workstation and a FPGA on a board with a PCIe connector. RIFFA supports Windows and Linux, Altera and Xilinx, with bindings for C/C++, Python, MATLAB and Java. + +On the software side there are two main functions: data send and data receive. These functions are exposed via user libraries in C/C++, Python, MATLAB, and Java. The driver supports multiple FPGAs (up to 5) per system. The software bindings work on Linux and Windows operating systems. Users can communicate with FPGA IP cores by writing only a few lines of code. + +On the hardware side, users access an interface with independent transmit and receive signals. The signals provide transaction handshaking and a first word fall through FIFO interface for reading/writing data. No knowledge of bus addresses, buffer sizes, or PCIe packet formats is required. Simply send data on a FIFO interface and receive data on a FIFO interface. RIFFA does not rely on a PCIe Bridge and therefore is not subject to the limitations of a bridge implementation. Instead, RIFFA works directly with the PCIe Endpoint and can run fast enough to saturate the PCIe link. Both the software and hardware interfaces have been greatly simplified. Details can be found on the hardware interface page. + +RIFFA communicates data using direct memory access (DMA) transfers and interrupt signaling. This achieves high bandwidth over the PCIe link. In our tests we are able to saturate (or near saturate) the link in all our tests. We have implemented RIFFA on the AVNet Spartan LX150T, Xilinx ML605, and Xilinx VC707, as well as the Altera DE5-Net, DE4 and DE2i boards. The RIFFA distribution contains examples and guides for setting up designs on the three development boards listed above. In addition, this website has examples of how to access your design from all the software bindings. RIFFA has been tested on Fedora 13 & 17 (32/64 bit vers.) and Ubuntu Desktop 10.04 LTS & 12.04 LTS (32/64 bit vers.). RIFFA relies on a custom Linux kernel driver which is supported on Linux kernels 2.6.27+ (tested on versions between 2.6.32 - 3.3.0). The Windows driver is supported on: Windows 7 in both 32 bit and 64 bit variants diff --git a/KastnerRG_riffa/c_c++/Makefile b/KastnerRG_riffa/c_c++/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..16d0a9f7f16aab2fb8555da23c4a4cf2a077f760 --- /dev/null +++ b/KastnerRG_riffa/c_c++/Makefile @@ -0,0 +1,57 @@ +# ---------------------------------------------------------------------- +# Copyright (c) 2016, The Regents of the University of California All +# rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of The Regents of the University of California +# nor the names of its contributors may be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL REGENTS OF THE +# UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +# DAMAGE. +# ---------------------------------------------------------------------- +#----------------------------------------------------------------------- +# Filename: Makefile +# Version: 1.0 +# Description: Makefile for including the C/C++ subdirectory in +# a RIFFA release. Expects RELEASE_SRC_PATH to be set +# by parent Makefile. +# Author: Dustin Richmond (@darichmond) +#----------------------------------------------------------------------- + +CURRENT_PATH := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) +CURRENT_DIR := $(shell basename $(CURRENT_PATH)) +DEST_PATH := $(RELEASE_SRC_PATH)/$(CURRENT_DIR)/ +include $(RIFFA_ROOT_PATH)/release.mk + +release: check-release-src clean-release + cp -r $(CURRENT_PATH) $(DEST_PATH) + rm -r $(DEST_PATH)/Makefile + +clean-release: check-release-src + rm -rf $(DEST_PATH) + +clean: check + diff --git a/KastnerRG_riffa/c_c++/linux/x64/README.txt b/KastnerRG_riffa/c_c++/linux/x64/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..baeb4fb0d25e62e999cb56399cef9211ca987f9e --- /dev/null +++ b/KastnerRG_riffa/c_c++/linux/x64/README.txt @@ -0,0 +1,3 @@ +The Linux C/C++ library is compiled and installed with the kernel driver. This +directory contains a sample application subdirectory that you can use to test +your design. diff --git a/KastnerRG_riffa/c_c++/linux/x64/sample_app/Makefile b/KastnerRG_riffa/c_c++/linux/x64/sample_app/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..23662f428d2151df02e60f9a9b24a21406caac1d --- /dev/null +++ b/KastnerRG_riffa/c_c++/linux/x64/sample_app/Makefile @@ -0,0 +1,61 @@ +# ---------------------------------------------------------------------- +# Copyright (c) 2016, The Regents of the University of California All +# rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of The Regents of the University of California +# nor the names of its contributors may be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL REGENTS OF THE +# UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +# DAMAGE. +# ---------------------------------------------------------------------- +program_NAME := testutil +program_C_SRCS := $(wildcard *.c) +program_CXX_SRCS := $(wildcard *.cpp) +program_C_OBJS := ${program_C_SRCS:.c=.o} +program_CXX_OBJS := ${program_CXX_SRCS:.cpp=.o} +program_OBJS := $(program_C_OBJS) $(program_CXX_OBJS) +program_INCLUDE_DIRS := +program_LIBRARY_DIRS := +program_LIBRARIES := riffa +CPPFLAGS += -g + +CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir)) +LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir)) +LDFLAGS += $(foreach library,$(program_LIBRARIES),-l$(library)) + +.PHONY: all clean distclean + +all: $(program_NAME) + +$(program_NAME): $(program_OBJS) + $(CC) $(CPPFLAGS) $(program_OBJS) -o $(program_NAME) $(LDFLAGS) + +clean: + @- $(RM) $(program_NAME) + @- $(RM) $(program_OBJS) + +distclean: clean diff --git a/KastnerRG_riffa/c_c++/linux/x64/sample_app/README.txt b/KastnerRG_riffa/c_c++/linux/x64/sample_app/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..870fd4bd5c0b2c4433dcb78600dc59a36ee6a6bb --- /dev/null +++ b/KastnerRG_riffa/c_c++/linux/x64/sample_app/README.txt @@ -0,0 +1,8 @@ +The testutil example application works with the Verilog chnl_tester module +which receives data and then sends data back to the workstation. + +To compile the example application: + +make + +The riffa C/C++ library must be installed (it gets installed with the driver). diff --git a/KastnerRG_riffa/c_c++/linux/x64/sample_app/testutil.c b/KastnerRG_riffa/c_c++/linux/x64/sample_app/testutil.c new file mode 100644 index 0000000000000000000000000000000000000000..fb22e8643286989b645727302ab1606d457f88d8 --- /dev/null +++ b/KastnerRG_riffa/c_c++/linux/x64/sample_app/testutil.c @@ -0,0 +1,179 @@ +// ---------------------------------------------------------------------- +// Copyright (c) 2016, The Regents of the University of California All +// rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// * Neither the name of The Regents of the University of California +// nor the names of its contributors may be used to endorse or +// promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL REGENTS OF THE +// UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +// TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +// DAMAGE. +// ---------------------------------------------------------------------- +#include +#include +#include "timer.h" +#include "riffa.h" + +int main(int argc, char** argv) { + fpga_t * fpga; + fpga_info_list info; + int option; + int i; + int id; + int chnl; + size_t numWords; + int sent; + int recvd; + unsigned int * sendBuffer; + unsigned int * recvBuffer; + GET_TIME_INIT(3); + + if (argc < 2) { + printf("Usage: %s