diff --git a/Makefile b/Makefile index c5aa74a25188..940cc4005c14 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,7 @@ jnilint: python3 3rdparty/dmlc-core/scripts/lint.py tvm4j-jni cpp jvm/native/src scalalint: - make -C vta/hardware/chisel lint + make -C vta/vta-hw/hardware/chisel lint lint: cpplint pylint jnilint scalalint diff --git a/apps/vta_rpc/start_rpc_server_to_tracker.sh b/apps/vta_rpc/start_rpc_server_to_tracker.sh index 00f3d2805848..de719fd37059 100755 --- a/apps/vta_rpc/start_rpc_server_to_tracker.sh +++ b/apps/vta_rpc/start_rpc_server_to_tracker.sh @@ -18,7 +18,7 @@ PROJROOT="$( cd "$( dirname '${BASH_SOURCE[0]}' )/../../" && pwd )" # Derive target specified by vta_config.json -VTA_CONFIG=${PROJROOT}/vta/config/vta_config.py +VTA_CONFIG=${PROJROOT}/vta/vta-hw/config/vta_config.py TARGET=$(python ${VTA_CONFIG} --target) export PYTHONPATH=${PYTHONPATH}:${PROJROOT}/python:${PROJROOT}/vta/python diff --git a/cmake/modules/VTA.cmake b/cmake/modules/VTA.cmake index 280d340b1632..34d4956ca5b2 100644 --- a/cmake/modules/VTA.cmake +++ b/cmake/modules/VTA.cmake @@ -18,14 +18,17 @@ # CMake Build rules for VTA find_program(PYTHON NAMES python python3 python3.6) +# VTA sources directory +set(VTA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vta/vta-hw) + if(MSVC) message(STATUS "VTA build is skipped in Windows..") elseif(PYTHON) - set(VTA_CONFIG ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/vta/config/vta_config.py) + set(VTA_CONFIG ${PYTHON} ${VTA_DIR}/config/vta_config.py) if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/vta_config.json) message(STATUS "Use VTA config " ${CMAKE_CURRENT_BINARY_DIR}/vta_config.json) - set(VTA_CONFIG ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/vta/config/vta_config.py + set(VTA_CONFIG ${PYTHON} ${VTA_DIR}/config/vta_config.py --use-cfg=${CMAKE_CURRENT_BINARY_DIR}/vta_config.json) endif() @@ -40,18 +43,18 @@ elseif(PYTHON) # Fast simulator driver build if(USE_VTA_FSIM) # Add fsim driver sources - file(GLOB FSIM_RUNTIME_SRCS vta/src/*.cc) - list(APPEND FSIM_RUNTIME_SRCS vta/src/sim/sim_driver.cc) - list(APPEND FSIM_RUNTIME_SRCS vta/src/vmem/virtual_memory.cc vta/src/vmem/virtual_memory.h) - list(APPEND FSIM_RUNTIME_SRCS vta/src/sim/sim_tlpp.cc) + file(GLOB FSIM_RUNTIME_SRCS ${VTA_DIR}/src/*.cc) + file(GLOB FSIM_RUNTIME_SRCS vta/runtime/*.cc) + list(APPEND FSIM_RUNTIME_SRCS ${VTA_DIR}/src/sim/sim_driver.cc) + list(APPEND FSIM_RUNTIME_SRCS ${VTA_DIR}/src/sim/sim_tlpp.cc) + list(APPEND FSIM_RUNTIME_SRCS ${VTA_DIR}/src/vmem/virtual_memory.cc) # Target lib: vta_fsim add_library(vta_fsim SHARED ${FSIM_RUNTIME_SRCS}) - target_include_directories(vta_fsim PUBLIC vta/include) + target_include_directories(vta_fsim PUBLIC ${VTA_DIR}/include) foreach(__def ${VTA_DEFINITIONS}) string(SUBSTRING ${__def} 3 -1 __strip_def) target_compile_definitions(vta_fsim PUBLIC ${__strip_def}) endforeach() - include_directories("vta/include") if(APPLE) set_target_properties(vta_fsim PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif(APPLE) @@ -61,18 +64,18 @@ elseif(PYTHON) # Cycle accurate simulator driver build if(USE_VTA_TSIM) # Add tsim driver sources - file(GLOB TSIM_RUNTIME_SRCS vta/src/*.cc) - list(APPEND TSIM_RUNTIME_SRCS vta/src/tsim/tsim_driver.cc) - list(APPEND TSIM_RUNTIME_SRCS vta/src/dpi/module.cc) - list(APPEND TSIM_RUNTIME_SRCS vta/src/vmem/virtual_memory.cc vta/src/vmem/virtual_memory.h) + file(GLOB TSIM_RUNTIME_SRCS ${VTA_DIR}/src/*.cc) + file(GLOB TSIM_RUNTIME_SRCS vta/runtime/*.cc) + list(APPEND TSIM_RUNTIME_SRCS ${VTA_DIR}/src/tsim/tsim_driver.cc) + list(APPEND TSIM_RUNTIME_SRCS ${VTA_DIR}/src/dpi/module.cc) + list(APPEND TSIM_RUNTIME_SRCS ${VTA_DIR}/src/vmem/virtual_memory.cc) # Target lib: vta_tsim add_library(vta_tsim SHARED ${TSIM_RUNTIME_SRCS}) - target_include_directories(vta_tsim PUBLIC vta/include) + target_include_directories(vta_tsim PUBLIC ${VTA_DIR}/include) foreach(__def ${VTA_DEFINITIONS}) string(SUBSTRING ${__def} 3 -1 __strip_def) target_compile_definitions(vta_tsim PUBLIC ${__strip_def}) endforeach() - include_directories("vta/include") if(APPLE) set_target_properties(vta_tsim PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif(APPLE) @@ -80,15 +83,15 @@ elseif(PYTHON) # VTA FPGA driver sources if(USE_VTA_FPGA) - file(GLOB FPGA_RUNTIME_SRCS vta/src/*.cc) + file(GLOB FPGA_RUNTIME_SRCS ${VTA_HW_DIR}/src/*.cc) # Rules for Zynq-class FPGAs with pynq OS support (see pynq.io) if(${VTA_TARGET} STREQUAL "pynq" OR ${VTA_TARGET} STREQUAL "ultra96") - list(APPEND FPGA_RUNTIME_SRCS vta/src/pynq/pynq_driver.cc) + list(APPEND FPGA_RUNTIME_SRCS ${VTA_HW_DIR}/src/pynq/pynq_driver.cc) # Rules for Pynq v2.4 find_library(__cma_lib NAMES cma PATH /usr/lib) elseif(${VTA_TARGET} STREQUAL "de10nano") # DE10-Nano rules - file(GLOB FPGA_RUNTIME_SRCS vta/src/de10nano/*.cc vta/src/*.cc) + file(GLOB FPGA_RUNTIME_SRCS ${VTA_HW_DIR}/src/de10nano/*.cc ${VTA_HW_DIR}/src/*.cc) endif() # Target lib: vta add_library(vta SHARED ${FPGA_RUNTIME_SRCS}) @@ -102,7 +105,7 @@ elseif(PYTHON) target_link_libraries(vta ${__cma_lib}) elseif(${VTA_TARGET} STREQUAL "de10nano") # DE10-Nano rules #target_compile_definitions(vta PUBLIC VTA_MAX_XFER=2097152) # (1<<21) - target_include_directories(vta PUBLIC vta/src/de10nano) + target_include_directories(vta PUBLIC ${VTA_HW_DIR}/src/de10nano) target_include_directories(vta PUBLIC 3rdparty) target_include_directories(vta PUBLIC "/usr/local/intelFPGA_lite/18.1/embedded/ds-5/sw/gcc/arm-linux-gnueabihf/include") diff --git a/docs/Doxyfile b/docs/Doxyfile index b96678ca1696..342b74461f8c 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -770,7 +770,7 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = include/tvm topi/include/topi vta/include/vta +INPUT = include/tvm topi/include/topi vta/vta-hw/include/vta # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/docs/vta/dev/config.rst b/docs/vta/dev/config.rst index d8808e912b9f..e9690cb3f43d 100644 --- a/docs/vta/dev/config.rst +++ b/docs/vta/dev/config.rst @@ -21,7 +21,7 @@ VTA Configuration The VTA stack incorporates both a hardware accelerator stack and a TVM based software stack. VTA incorporates flexibility out of the box: by modifying the -``vta/config/vta_config.json`` high-level configuration file, +``vta/vta-hw/config/vta_config.json`` high-level configuration file, the user can change the shape of the tensor intrinsic, clock frequency, pipelining, data type width, and on-chip buffer sizes. diff --git a/docs/vta/dev/hardware.rst b/docs/vta/dev/hardware.rst index 784cd54d6d45..84cfc45bb6b2 100644 --- a/docs/vta/dev/hardware.rst +++ b/docs/vta/dev/hardware.rst @@ -53,17 +53,17 @@ HLS Hardware Source Organization The VTA design is currently specified in Vivado HLS C++, which is only supported by Xilinx toolchains. -The VTA hardware sources are contained under ``vta/hardware/xilinx/sources``: +The VTA hardware sources are contained under ``vta/vta-hw/hardware/xilinx/sources``: - ``vta.cc`` contains the definitions for each VTA module, as well as a top level behavioral model for the top-level VTA design. - ``vta.h`` contains type definitions using Xilinx ``ap_int`` types, and function prototypes declarations. -In addition preprocessor macros are defined under ``vta/include/vta/hw_spec.h``. +In addition preprocessor macros are defined under ``vta/vta-hw/include/vta/hw_spec.h``. Much of these macro definitions are derived from the parameters listed in the -``vta/config/vta_config.json`` file. -The json file is processed by ``vta/config/vta_config.py`` to produce a string of +``vta/vta-hw/config/vta_config.json`` file. +The json file is processed by ``vta/vta-hw/config/vta_config.py`` to produce a string of compile flags that define the preprocessor macros. That string is used by the makefile in order to set those high-level parameters in both the HLS hardware synthesis compiler, and the C++ @@ -220,7 +220,7 @@ Microarchitectural Overview --------------------------- We describe the modules that compose the VTA design. -The module definitions are contained in ``vta/hardware/xilinx/sources/vta.cc``. +The module definitions are contained in ``vta/vta-hw/hardware/xilinx/sources/vta.cc``. Fetch Module ~~~~~~~~~~~~ @@ -234,7 +234,7 @@ The fetch module is the entry point of VTA to the CPU and is programmed via thre The CPU prepares the instruction stream in DRAM in a physically-contiguous buffer prepared by the VTA runtime. When the instruction stream is ready, the CPU writes the start physical address into the ``insns`` register, the length of the instruction stream into the ``insn_count`` register, and asserts the start signal in the ``control`` register. -This procedure starts VTA, which reads in the instruction stream from DRAM via DMA. +This procedure starts VTA, which reads in the instruction stream from DRAM via DMA. Upon accessing the instruction stream, the fetch module partially decodes instructions, and pushes those instructions into command queues that feed into the load, compute, and store modules: diff --git a/docs/vta/install.md b/docs/vta/install.md index 0738050c81c7..ea9c462de8d7 100644 --- a/docs/vta/install.md +++ b/docs/vta/install.md @@ -52,7 +52,7 @@ You are invited to try out our [VTA programming tutorials](https://docs.tvm.ai/v ### Advanced Configuration (optional) VTA is a generic configurable deep learning accelerator. -The configuration is specified by `vta_config.json` under the TVM root folder. +The configuration is specified by `vta_config.json` under `vta/vta-hw/config`. This file provides an architectural specification of the VTA accelerator to parameterize the TVM compiler stack and the VTA hardware stack. The VTA configuration file also specifies the TVM compiler target. @@ -62,9 +62,9 @@ To do so, ```bash cd -vim vta/config/vta_config.json +vim vta/vta-hw/config/vta_config.json # edit vta_config.json -make vta +make ``` ## VTA Pynq-Based Test Setup @@ -122,7 +122,7 @@ echo 'set(USE_VTA_FSIM OFF)' >> build/config.cmake echo 'set(USE_VTA_TSIM OFF)' >> build/config.cmake echo 'set(USE_VTA_FPGA ON)' >> build/config.cmake # Copy pynq specific configuration -cp vta/config/pynq_sample.json vta/config/vta_config.json +cp vta/vta-hw/config/pynq_sample.json vta/vta-hw/config/vta_config.json cd build cmake .. make runtime vta -j2 @@ -156,7 +156,7 @@ In addition, you'll need to edit the `vta_config.json` file on the host to indic ```bash # On the Host-side cd -cp vta/config/pynq_sample.json vta/config/vta_config.json +cp vta/vta-hw/config/pynq_sample.json vta/vta-hw/config/vta_config.json ``` This time again, we will run the 2D convolution testbench. @@ -185,7 +185,7 @@ You can also try out our [VTA programming tutorials](https://docs.tvm.ai/vta/tut ## VTA Custom Test Setup for Intel FPGA -Similar to the PYNQ side setup steps, this third guide bring us the details on how can we setup up the Linux environment for Intel FPGA boards like DE10-Nano. +Similar to the PYNQ side setup steps, this third guide bring us the details on how can we setup up the Linux environment for Intel FPGA boards like DE10-Nano. In terms of hardware components, you would need the [DE10-Nano Development Kit](https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&No=1046), which can be acquired for $130, or $100 for academics from [Terasic](https://www.terasic.com.tw/). A microSD card would be delivered the kit. Power cables and USB cables would be included as well. However, an additional Ethernet cable would be needed to connect the board to LAN. @@ -213,7 +213,7 @@ tar xf de10-nano-image-Angstrom-v2016.12.socfpga-sdimg.2017.03.31.tgz This would produce a single SD card image named `de10-nano-image-Angstrom-v2016.12.socfpga-sdimg` (approx. 2.4 GB), it contains all the file systems to boot Angstrom Linux. -Second, plugin a SD card that is ready to flash in your PC, and identify the device id for the disk with `fdisk -l`, or `gparted` if you feel better to use GUI. The typical device id for your disk would likely to be `/dev/sdb`. +Second, plugin a SD card that is ready to flash in your PC, and identify the device id for the disk with `fdisk -l`, or `gparted` if you feel better to use GUI. The typical device id for your disk would likely to be `/dev/sdb`. Then, flash the disk image into your physical SD card with the following command: @@ -225,8 +225,8 @@ This would take a few minutes for your PC to write the whole file systems into t After this process completes, you are ready to unmount the SD card and insert it into your DE10-Nano board. Now you can connect the power cable and serial port to boot the Angstrom Linux. -> Note: When boot up from the microSD card, you might notice the incompatibility of the linux kernel `zImage` in the microSD card. -> In this case, you might need to build the `zImage` file of your own from [socfpga-4.9.78-ltsi](https://github.com/altera-opensource/linux-socfpga/tree/socfpga-4.9.78-ltsi) branch of the [linux-socfpga](https://github.com/altera-opensource/linux-socfpga) repository. +> Note: When boot up from the microSD card, you might notice the incompatibility of the linux kernel `zImage` in the microSD card. +> In this case, you might need to build the `zImage` file of your own from [socfpga-4.9.78-ltsi](https://github.com/altera-opensource/linux-socfpga/tree/socfpga-4.9.78-ltsi) branch of the [linux-socfpga](https://github.com/altera-opensource/linux-socfpga) repository. > For a quick fix, you can also download a prebuilt version of the `zImage` file [here](https://raw.githubusercontent.com/liangfu/de10-nano-supplement/master/zImage). After connecting the usb cables to the DE10-Nano board, power on the board by connecting the power cable. You may then connect to the serial port of the device by using `minicom` on your host PC: @@ -240,8 +240,8 @@ The default user name for the device would be `root`, and the password is empty You may now start to install supporting Python3 packages (TVM has dropped the support for Python2), specifically, they are `numpy`, `attrs` and `decorator`. -> Note: You might fail to install `numpy` by using `pip3` on the DE10-Nano device. -> In that case, you have the option to either build your own filesystem image for the board from [meta-de10-nano](https://github.com/intel/meta-de10-nano) repository; +> Note: You might fail to install `numpy` by using `pip3` on the DE10-Nano device. +> In that case, you have the option to either build your own filesystem image for the board from [meta-de10-nano](https://github.com/intel/meta-de10-nano) repository; > an alternative option is to download prebuilt packages from existing Linux distributions, e.g. Debian. > For a quick fix, we have concatenated the supplementary binary files [here](https://raw.githubusercontent.com/liangfu/de10-nano-supplement/master/rootfs_supplement.tgz), and you can extract the files into the root filesystem. @@ -251,8 +251,8 @@ After accessing bash terminal from the serial port, we need to install required #### Build Additional Components to Use VTA Bitstream -To use the above built bitstream on DE10-Nano hardware, several additional components need to be compiled for the system. -Specifically, to compile application executables for the system, you need to download and install [SoCEDS](http://fpgasoftware.intel.com/soceds/18.1/?edition=standard&download_manager=dlm3&platform=linux) (recommended), or alternatively install the `g++-arm-linux-gnueabihf` package on your host machine. You would also need a `cma` kernel module to allocate contigous memory, and a driver for communicating with the VTA subsystem. +To use the above built bitstream on DE10-Nano hardware, several additional components need to be compiled for the system. +Specifically, to compile application executables for the system, you need to download and install [SoCEDS](http://fpgasoftware.intel.com/soceds/18.1/?edition=standard&download_manager=dlm3&platform=linux) (recommended), or alternatively install the `g++-arm-linux-gnueabihf` package on your host machine. You would also need a `cma` kernel module to allocate contigous memory, and a driver for communicating with the VTA subsystem. ## VTA FPGA Toolchain Installation @@ -310,7 +310,7 @@ export PATH=${XILINX_VIVADO}/bin:${PATH} ### Intel Toolchain Installation -It is recommended to use `Intel Quartus Prime 18.1`, since the test scripts contained in this document have been tested on this version. +It is recommended to use `Intel Quartus Prime 18.1`, since the test scripts contained in this document have been tested on this version. You would need to install Intel's FPGA compilation toolchain, [Quartus Prime Lite](http://fpgasoftware.intel.com/?edition=lite), which is a license-free version of the Intel Quartus Prime software. @@ -347,11 +347,11 @@ For this custom VTA bitstream compilation exercise, we'll change the frequency o * Set the `HW_FREQ` field to `142`. The Pynq board supports 100, 142, 167 and 200MHz clocks. Note that the higher the frequency, the harder it will be to close timing. Increasing the frequency can lead to timing violation and thus faulty hardware execution. * Set the `HW_CLK_TARGET` to `6`. This parameters refers to the target clock period in nano seconds for HLS - a lower clock period leads to more aggressive pipelining to achieve timing closure at higher frequencies. Technically a 142MHz clock would require a 7ns target, but we intentionally lower the clock target to 6ns to more aggressively pipeline our design. -Bitstream generation is driven by a top-level `Makefile` under `/vta/hardware/xilinx/`. +Bitstream generation is driven by a top-level `Makefile` under `/vta/vta-hw/hardware/xilinx/`. If you just want to simulate the VTA design in software emulation to make sure that it is functional, enter: ```bash -cd /vta/hardware/xilinx +cd /vta/vta-hw/hardware/xilinx make ip MODE=sim ``` @@ -359,7 +359,7 @@ If you just want to generate the HLS-based VTA IP cores without launching the en ```bash make ip ``` -You'll be able to view the HLS synthesis reports under `/vta/build/hardware/xilinx/hls/` `//solution0/syn/report/_csynth.rpt` +You'll be able to view the HLS synthesis reports under `/vta/vta-hw/build/hardware/xilinx/hls/` `//solution0/syn/report/_csynth.rpt` > Note: The `` name is a string that summarizes the VTA configuration parameters listed in the `vta_config.json`. The `` name refers to the specific module (or HLS function) that compose the high-level VTA pipeline. Finally to run the full hardware compilation and generate the VTA bitstream, run: @@ -371,20 +371,20 @@ make This process is lengthy, and can take around up to an hour to complete depending on your machine's specs. We recommend setting the `VTA_HW_COMP_THREADS` variable in the Makefile to take full advantage of all the cores on your development machine. -Once the compilation completes, the generated bitstream can be found under `/vta/build/hardware/xilinx/vivado//export/vta.bit`. +Once the compilation completes, the generated bitstream can be found under `/vta/vta-hw/build/hardware/xilinx/vivado//export/vta.bit`. ### Chisel-based Custom VTA Bitstream Compilation for DE10-Nano -Similar to the HLS-based design, high-level hardware parameters in Chisel-based design are listed in the VTA configuration file [Configs.scala](https://github.com/apache/incubator-tvm/blob/master/vta/hardware/chisel/src/main/scala/core/Configs.scala), and they can be customized by the user. +Similar to the HLS-based design, high-level hardware parameters in Chisel-based design are listed in the VTA configuration file [Configs.scala](https://github.com/apache/incubator-tvm/blob/master/vta/vta-hw/hardware/chisel/src/main/scala/core/Configs.scala), and they can be customized by the user. -For Intel FPGA, bitstream generation is driven by a top-level `Makefile` under `/vta/hardware/intel`. +For Intel FPGA, bitstream generation is driven by a top-level `Makefile` under `/vta/vta-hw/hardware/intel`. If you just want to generate the Chisel-based VTA IP core for the DE10-Nano board without compiling the design for the FPGA hardware, enter: ```bash -cd /vta/hardware/intel +cd /vta/vta-hw/hardware/intel make ip ``` -Then you'll be able to locate the generated verilog file at `/vta/build/hardware/intel/chisel//VTA.DefaultDe10Config.v`. +Then you'll be able to locate the generated verilog file at `/vta/vta-hw/build/hardware/intel/chisel//VTA.DefaultDe10Config.v`. If you would like to run the full hardware compilation for the `de10nano` board: ```bash @@ -393,14 +393,14 @@ make This process might be a bit lengthy, and might take up to half an hour to complete depending on the performance of your PC. The Quartus Prime software would automatically detect the number of cores available on your PC and try to utilize all of them to perform such process. -Once the compilation completes, the generated bistream can be found under `/vta/build/hardware/intel/quartus//export/vta.rbf`. You can also open the Quartus project file (.qpf) available at `/vta/build/hardware/intel/quartus//de10_nano_top.qpf` to look around the generated reports. +Once the compilation completes, the generated bistream can be found under `vtay/vta-hw/build/hardware/intel/quartus//export/vta.rbf`. You can also open the Quartus project file (.qpf) available at `/vta/vta-hw/build/hardware/intel/quartus//de10_nano_top.qpf` to look around the generated reports. ### Use the Custom Bitstream We can program the new VTA FPGA bitstream by setting the bitstream path of the `vta.program_fpga()` function in the tutorial examples, or in the `test_program_rpc.py` script. ```python -vta.program_fpga(remote, bitstream="/vta/build/hardware/xilinx/vivado//export/vta.bit") +vta.program_fpga(remote, bitstream="/vta/vta-hw/build/hardware/xilinx/vivado//export/vta.bit") ``` Instead of downloading a pre-built bitstream from the VTA bitstream repository, TVM will instead use the new bitstream you just generated, which is a VTA design clocked at a higher frequency. diff --git a/tests/scripts/task_python_vta.sh b/tests/scripts/task_python_vta.sh deleted file mode 100755 index a6bfb1c24d01..000000000000 --- a/tests/scripts/task_python_vta.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -set -e -set -u - -export PYTHONPATH=python:vta/python:topi/python - -# cleanup pycache -find . -type f -path "*.pyc" | xargs rm -f - -rm -rf ~/.tvm - -# Rebuild cython -make cython3 - -# Reset default fsim simulation -cp vta/config/fsim_sample.json vta/config/vta_config.json - -# Run unit tests in functional/fast simulator -echo "Running unittest in fsim..." -python3 -m pytest -v vta/tests/python/unittest - -# Run unit tests in functional/fast simulator -echo "Running integration test in fsim..." -python3 -m pytest -v vta/tests/python/integration diff --git a/tests/scripts/task_python_vta_fsim.sh b/tests/scripts/task_python_vta_fsim.sh index a6bfb1c24d01..b0eb2d0fdee2 100755 --- a/tests/scripts/task_python_vta_fsim.sh +++ b/tests/scripts/task_python_vta_fsim.sh @@ -30,7 +30,7 @@ rm -rf ~/.tvm make cython3 # Reset default fsim simulation -cp vta/config/fsim_sample.json vta/config/vta_config.json +cp vta/vta-hw/config/fsim_sample.json vta/vta-hw/config/vta_config.json # Run unit tests in functional/fast simulator echo "Running unittest in fsim..." diff --git a/tests/scripts/task_python_vta_tsim.sh b/tests/scripts/task_python_vta_tsim.sh index eba62e537a85..d13614f9c45a 100755 --- a/tests/scripts/task_python_vta_tsim.sh +++ b/tests/scripts/task_python_vta_tsim.sh @@ -30,16 +30,22 @@ rm -rf ~/.tvm make cython3 # Set default VTA config to use TSIM cycle accurate sim -cp vta/config/tsim_sample.json vta/config/vta_config.json +cp vta/vta-hw/config/tsim_sample.json vta/vta-hw/config/vta_config.json + +# Build and run the TSIM apps (disable until refactor is complete) +# echo "Test the TSIM apps..." +# make -C vta/vta-hw/apps/tsim_example/ run_verilog +# make -C vta/vta-hw/apps/tsim_example/ run_chisel +# make -C vta/vta-hw/apps/gemm/ default # Check style of scala code echo "Check style of scala code..." -make -C vta/hardware/chisel lint +make -C vta/vta-hw/hardware/chisel lint # Build VTA chisel design and verilator simulator echo "Building VTA chisel design..." -make -C vta/hardware/chisel cleanall -make -C vta/hardware/chisel USE_THREADS=0 lib +make -C vta/vta-hw/hardware/chisel cleanall +make -C vta/vta-hw/hardware/chisel USE_THREADS=0 lib # Run unit tests in cycle accurate simulator echo "Running unittest in tsim..." @@ -50,4 +56,4 @@ echo "Running integration test in tsim..." python3 -m pytest -v vta/tests/python/integration # Reset default fsim simulation -cp vta/config/fsim_sample.json vta/config/vta_config.json +cp vta/vta-hw/config/fsim_sample.json vta/vta-hw/config/vta_config.json diff --git a/vta/python/vta/environment.py b/vta/python/vta/environment.py index 49b78b321bd2..1b7f7e8369da 100644 --- a/vta/python/vta/environment.py +++ b/vta/python/vta/environment.py @@ -312,7 +312,7 @@ def _init_env(): os.path.abspath(os.path.expanduser(__file__))) proj_root = os.path.abspath(os.path.join(curr_path, "../../../")) path_list = [ - os.path.join(proj_root, "vta/config/vta_config.json") + os.path.join(proj_root, "vta/vta-hw/config/vta_config.json") ] path_list = [p for p in path_list if os.path.exists(p)] if not path_list: diff --git a/vta/python/vta/libinfo.py b/vta/python/vta/libinfo.py index 00a43c0b03e2..7a409e614879 100644 --- a/vta/python/vta/libinfo.py +++ b/vta/python/vta/libinfo.py @@ -40,7 +40,7 @@ def _get_lib_name(lib_name): def find_libvta(lib_vta, optional=False): - """Find VTA library + """Find VTA Chisel-based library Returns ------- @@ -56,10 +56,8 @@ def find_libvta(lib_vta, optional=False): Enable error check """ curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) - lib_search = [curr_path] - lib_search += [os.path.join(curr_path, "..", "..", "build",)] - lib_search += [os.path.join(curr_path, "..", "..", "..", "build",)] - lib_search += [os.path.join(curr_path, "..", "..", "..", "build", "Release")] + lib_search = [os.path.join(curr_path, "..", "..", "..", "build",)] + lib_search += [os.path.join(curr_path, "..", "..", "vta-hw", "build")] lib_name = _get_lib_name(lib_vta) lib_path = [os.path.join(x, lib_name) for x in lib_search] lib_found = [x for x in lib_path if os.path.exists(x)] diff --git a/vta/python/vta/pkg_config.py b/vta/python/vta/pkg_config.py index c15f6df58740..7c3af57c2202 100644 --- a/vta/python/vta/pkg_config.py +++ b/vta/python/vta/pkg_config.py @@ -66,21 +66,21 @@ def __init__(self, cfg, proj_root): # Include path self.include_path = [ "-I%s/include" % proj_root, - "-I%s/vta/include" % proj_root, + "-I%s/vta/vta-hw/include" % proj_root, "-I%s/3rdparty/dlpack/include" % proj_root, "-I%s/3rdparty/dmlc-core/include" % proj_root ] # List of source files that can be used to build standalone library. self.lib_source = [] - self.lib_source += glob.glob("%s/vta/src/*.cc" % proj_root) + self.lib_source += glob.glob("%s/vta/vta-hw/src/*.cc" % proj_root) if self.TARGET in ["pynq", "ultra96"]: # add pynq drivers for any board that uses pynq driver stack (see pynq.io) - self.lib_source += glob.glob("%s/vta/src/pynq/*.cc" % (proj_root)) + self.lib_source += glob.glob("%s/vta/vta-hw/src/pynq/*.cc" % (proj_root)) elif self.TARGET in ["de10nano"]: - self.lib_source += glob.glob("%s/vta/src/de10nano/*.cc" % (proj_root)) + self.lib_source += glob.glob("%s/vta/vta-hw/src/de10nano/*.cc" % (proj_root)) self.include_path += [ - "-I%s/vta/src/de10nano" % proj_root, + "-I%s/vta/vta-hw/src/de10nano" % proj_root, "-I%s/3rdparty" % proj_root ] diff --git a/vta/python/vta/testing/simulator.py b/vta/python/vta/testing/simulator.py index 38c9467ec815..d48bee80f47f 100644 --- a/vta/python/vta/testing/simulator.py +++ b/vta/python/vta/testing/simulator.py @@ -37,7 +37,7 @@ def _load_sw(): if env.TARGET == "tsim": lib_hw = find_libvta("libvta_hw", optional=True) - assert lib_hw # make sure to build vta/hardware/chisel + assert lib_hw # make sure to build vta/vta-hw/hardware/chisel try: f = tvm.get_global_func("vta.tsim.init") m = tvm.runtime.load_module(lib_hw[0], "vta-tsim") diff --git a/vta/src/device_api.cc b/vta/runtime/device_api.cc similarity index 99% rename from vta/src/device_api.cc rename to vta/runtime/device_api.cc index 34e3ff0f41fc..047a6fdbd50d 100644 --- a/vta/src/device_api.cc +++ b/vta/runtime/device_api.cc @@ -24,8 +24,8 @@ #include #include -#include +#include "runtime.h" #include "../../src/runtime/workspace_pool.h" diff --git a/vta/src/runtime.cc b/vta/runtime/runtime.cc similarity index 99% rename from vta/src/runtime.cc rename to vta/runtime/runtime.cc index 6b08c6c2ebcd..038d5cfa398c 100644 --- a/vta/src/runtime.cc +++ b/vta/runtime/runtime.cc @@ -26,15 +26,17 @@ */ #include #include -#include #include #include +#include #include #include #include #include +#include "runtime.h" + namespace vta { // Avoid bad configurations. diff --git a/vta/include/vta/runtime.h b/vta/runtime/runtime.h similarity index 98% rename from vta/include/vta/runtime.h rename to vta/runtime/runtime.h index ca8d121dbbfa..bb16d3a3bfc2 100644 --- a/vta/include/vta/runtime.h +++ b/vta/runtime/runtime.h @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -22,15 +22,15 @@ * \brief VTA runtime library. */ -#ifndef VTA_RUNTIME_H_ -#define VTA_RUNTIME_H_ +#ifndef VTA_RUNTIME_RUNTIME_H_ +#define VTA_RUNTIME_RUNTIME_H_ #ifdef __cplusplus extern "C" { #endif #include -#include "driver.h" +#include #define VTA_MEMCPY_H2D 1 #define VTA_MEMCPY_D2H 2 @@ -291,4 +291,4 @@ TVM_DLL void VTASynchronize(VTACommandHandle cmd, uint32_t wait_cycles); #ifdef __cplusplus } #endif -#endif // VTA_RUNTIME_H_ +#endif // VTA_RUNTIME_RUNTIME_H_ diff --git a/vta/tutorials/autotvm/tune_relay_vta.py b/vta/tutorials/autotvm/tune_relay_vta.py index 16c8b3e1ad88..1d19e5d27eb9 100644 --- a/vta/tutorials/autotvm/tune_relay_vta.py +++ b/vta/tutorials/autotvm/tune_relay_vta.py @@ -181,7 +181,7 @@ def compile_network(env, target, model, start_pack, stop_pack): tracker_host = os.environ.get("TVM_TRACKER_HOST", '0.0.0.0') tracker_port = int(os.environ.get("TVM_TRACKER_PORT", 9190)) -# Load VTA parameters from the vta/config/vta_config.json file +# Load VTA parameters from the vta/vta-hw/config/vta_config.json file env = vta.get_env() # This target is used for cross compilation. You can query it by :code:`gcc -v` on your device. diff --git a/vta/tutorials/frontend/deploy_classification.py b/vta/tutorials/frontend/deploy_classification.py index d8c517c6e02d..7ae954047241 100644 --- a/vta/tutorials/frontend/deploy_classification.py +++ b/vta/tutorials/frontend/deploy_classification.py @@ -68,7 +68,7 @@ # ------------------------------------- # Execute on CPU vs. VTA, and define the model. -# Load VTA parameters from the vta/config/vta_config.json file +# Load VTA parameters from the vta/vta-hw/config/vta_config.json file env = vta.get_env() # Set ``device=arm_cpu`` to run inference on the CPU diff --git a/vta/tutorials/frontend/deploy_detection.py b/vta/tutorials/frontend/deploy_detection.py index 1559d138213f..af30818a7a20 100644 --- a/vta/tutorials/frontend/deploy_detection.py +++ b/vta/tutorials/frontend/deploy_detection.py @@ -111,7 +111,7 @@ # -------------------------------------- # Execute on CPU vs. VTA, and define the model. -# Load VTA parameters from the vta/config/vta_config.json file +# Load VTA parameters from the vta/vta-hw/config/vta_config.json file env = vta.get_env() # Set ``device=arm_cpu`` to run inference on the CPU # or ``device=vta`` to run inference on the FPGA. diff --git a/vta/tutorials/matrix_multiply.py b/vta/tutorials/matrix_multiply.py index efbebf7ff688..227144ec1709 100644 --- a/vta/tutorials/matrix_multiply.py +++ b/vta/tutorials/matrix_multiply.py @@ -43,7 +43,7 @@ from tvm.contrib import util from vta.testing import simulator -# Load VTA parameters from the vta/config/vta_config.json file +# Load VTA parameters from the vta/vta-hw/config/vta_config.json file env = vta.get_env() # We read the Pynq RPC host IP address and port number from the OS environment diff --git a/vta/tutorials/optimize/convolution_opt.py b/vta/tutorials/optimize/convolution_opt.py index 9d05d4b922cb..f609a7200843 100644 --- a/vta/tutorials/optimize/convolution_opt.py +++ b/vta/tutorials/optimize/convolution_opt.py @@ -47,7 +47,7 @@ from tvm.contrib import util from vta.testing import simulator -# Load VTA parameters from the vta/config/vta_config.json file +# Load VTA parameters from the vta/vta-hw/config/vta_config.json file env = vta.get_env() # We read the Pynq RPC host IP address and port number from the OS environment diff --git a/vta/tutorials/optimize/matrix_multiply_opt.py b/vta/tutorials/optimize/matrix_multiply_opt.py index e038ac4b4e2d..da3b9bbc5fc0 100644 --- a/vta/tutorials/optimize/matrix_multiply_opt.py +++ b/vta/tutorials/optimize/matrix_multiply_opt.py @@ -46,7 +46,7 @@ from tvm.contrib import util from vta.testing import simulator -# Load VTA parameters from the vta/config/vta_config.json file +# Load VTA parameters from the vta/vta-hw/config/vta_config.json file env = vta.get_env() # We read the Pynq RPC host IP address and port number from the OS environment diff --git a/vta/apps/tsim_example/CMakeLists.txt b/vta/vta-hw/apps/gemm/CMakeLists.txt similarity index 81% rename from vta/apps/tsim_example/CMakeLists.txt rename to vta/vta-hw/apps/gemm/CMakeLists.txt index 0e8128c9f22a..9222c1ee528a 100644 --- a/vta/apps/tsim_example/CMakeLists.txt +++ b/vta/vta-hw/apps/gemm/CMakeLists.txt @@ -18,13 +18,13 @@ cmake_minimum_required(VERSION 3.2) project(tsim C CXX) -set(TVM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../) -set(VTA_DIR ${TVM_DIR}/vta) +set(TVM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../) +set(VTA_HW_DIR ${TVM_DIR}/3rdparty/vta-hw) include_directories("${TVM_DIR}/include") include_directories("${TVM_DIR}/3rdparty/dlpack/include") include_directories("${TVM_DIR}/3rdparty/dmlc-core/include") -include_directories("${TVM_DIR}/vta/src/dpi") +include_directories("${VTA_HW_DIR}/src/dpi") set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fvisibility=hidden") set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC -fvisibility=hidden -std=c++11") @@ -35,11 +35,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND endif() file(GLOB TSIM_SW_SRC src/driver.cc) -list(APPEND TSIM_SW_SRC ${VTA_DIR}/src/vmem/virtual_memory.cc) -list(APPEND TSIM_SW_SRC ${VTA_DIR}/src/dpi/module.cc) +list(APPEND TSIM_SW_SRC ${VTA_HW_DIR}/src/vmem/virtual_memory.cc) +list(APPEND TSIM_SW_SRC ${VTA_HW_DIR}/src/dpi/module.cc) add_library(sw SHARED ${TSIM_SW_SRC}) -target_include_directories(sw PRIVATE ${VTA_DIR}/include ${VTA_DIR}/src) +target_include_directories(sw PRIVATE ${VTA_HW_DIR}/include ${VTA_HW_DIR}/src) if(APPLE) set_target_properties(sw PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") diff --git a/vta/apps/gemm/Makefile b/vta/vta-hw/apps/gemm/Makefile similarity index 87% rename from vta/apps/gemm/Makefile rename to vta/vta-hw/apps/gemm/Makefile index 8ad1481cf7fc..3b84778cb7c3 100644 --- a/vta/apps/gemm/Makefile +++ b/vta/vta-hw/apps/gemm/Makefile @@ -15,15 +15,15 @@ # specific language governing permissions and limitations # under the License. -export PYTHONPATH:=$(PWD)/python:$(PYTHONPATH) +export PYTHONPATH:=$(abspath .)/python:$(PYTHONPATH) +export PYTHONPATH:=$(abspath .)/../../../../python:$(PYTHONPATH) BUILD_NAME = build build_dir = $(abspath .)/$(BUILD_NAME) -default: chisel driver - python3 tests/python/chisel_accel.py serial +default: chisel driver serial parallel -serial: +serial: python3 tests/python/chisel_accel.py serial parallel: diff --git a/vta/apps/gemm/README.md b/vta/vta-hw/apps/gemm/README.md similarity index 78% rename from vta/apps/gemm/README.md rename to vta/vta-hw/apps/gemm/README.md index fba5924e7a4f..2a17302641c9 100644 --- a/vta/apps/gemm/README.md +++ b/vta/vta-hw/apps/gemm/README.md @@ -15,9 +15,9 @@ -VTA TSIM Application +VTA TSIM Application ====================== -Prior to this application, please take a look at `/vta/apps/tsim_example` for installation +Prior to this application, please take a look at `/vta/vta-hw/apps/tsim_example` for installation This is an application that performs Bit Serial Multiplication for GEMM utilizing TSIM. **Bit Serial Multiplication for GEMM:** @@ -28,23 +28,23 @@ We approach this operation with slicing and shifting, like how basic multiplicat We can sufficiently reduce the cycles required to perform a gemm given that the data bit width is small. This GEMM application uses TSIM for future accerlerator prototypes. * Test Chisel3 backend with bit serial GEMM - * Go to `/vta/apps/gemm` + * Go to `/vta/vta-hw/apps/gemm` * Run `make` -* If you have already compiled chisel backend (i.e. ran `make`) +* If you have already compiled chisel backend (i.e. ran `make`) * Bit Serial test with another input set, run `make serial` * Bit parallel test with another input set, run `make parallel` * Some steps for creating your own custom TSIM application - * Go to `/vta/apps/gemm` + * Go to `/vta/vta-hw/apps/gemm` * Create custom circuit within `./hardware/chisel/src/scala.main/accel/Compute.scala` * Map the according Registers in `./hardware/chisel/src/scala.main/accel/RegFile.scala` * Create your test script * Map the registers in `./src/driver.cc` and link it with both `RegFile.scala` and the test script - * Understanding of `/vta/apps/tsim_example`, which performs add by one to a vector, is highly encouraged to create a more complex application + * Understanding of `/vta/vta-hw/apps/tsim_example`, which performs add by one to a vector, is highly encouraged to create a more complex application * Some pointers - * Chisel3 tests in `/vta/apps/gemm/tests/python` - * Chisel3 accelerator backend `/vta/apps/gemm/hardware/chisel` - * Software C++ driver (backend) that handles the accelerator `/vta/apps/gemm/src/driver.cc` - * Software Python driver (frontend) that handles the accelerator `/vta/apps/gemm/python/accel` + * Chisel3 tests in `/vta/vta-hw/apps/gemm/tests/python` + * Chisel3 accelerator backend `/vta/vta-hw/apps/gemm/hardware/chisel` + * Software C++ driver (backend) that handles the accelerator `/vta/vta-hw/apps/gemm/src/driver.cc` + * Software Python driver (frontend) that handles the accelerator `vtay/vta-hw/apps/gemm/python/accel` diff --git a/vta/apps/gemm/hardware/chisel/Makefile b/vta/vta-hw/apps/gemm/hardware/chisel/Makefile similarity index 98% rename from vta/apps/gemm/hardware/chisel/Makefile rename to vta/vta-hw/apps/gemm/hardware/chisel/Makefile index 4462b7a88477..310f62335043 100644 --- a/vta/apps/gemm/hardware/chisel/Makefile +++ b/vta/vta-hw/apps/gemm/hardware/chisel/Makefile @@ -38,7 +38,7 @@ USE_TRACE = 1 LIBNAME = libhw vta_dir = $(abspath ../../../../) -tvm_dir = $(abspath ../../../../../) +tvm_dir = $(abspath ../../../../../../) build_dir = $(abspath .)/$(BUILD_NAME) verilator_build_dir = $(build_dir)/verilator chisel_build_dir = $(build_dir)/chisel diff --git a/vta/apps/gemm/hardware/chisel/build.sbt b/vta/vta-hw/apps/gemm/hardware/chisel/build.sbt similarity index 100% rename from vta/apps/gemm/hardware/chisel/build.sbt rename to vta/vta-hw/apps/gemm/hardware/chisel/build.sbt diff --git a/vta/apps/tsim_example/hardware/chisel/project/build.properties b/vta/vta-hw/apps/gemm/hardware/chisel/project/build.properties similarity index 97% rename from vta/apps/tsim_example/hardware/chisel/project/build.properties rename to vta/vta-hw/apps/gemm/hardware/chisel/project/build.properties index 7e2b74b51a4f..fc7998eb3eac 100644 --- a/vta/apps/tsim_example/hardware/chisel/project/build.properties +++ b/vta/vta-hw/apps/gemm/hardware/chisel/project/build.properties @@ -17,4 +17,4 @@ * under the License. */ -sbt.version = 1.1.1 +sbt.version = 1.3.2 diff --git a/vta/apps/gemm/hardware/chisel/project/plugins.sbt b/vta/vta-hw/apps/gemm/hardware/chisel/project/plugins.sbt similarity index 100% rename from vta/apps/gemm/hardware/chisel/project/plugins.sbt rename to vta/vta-hw/apps/gemm/hardware/chisel/project/plugins.sbt diff --git a/vta/apps/gemm/hardware/chisel/src/main/scala/accel/Accel.scala b/vta/vta-hw/apps/gemm/hardware/chisel/src/main/scala/accel/Accel.scala similarity index 100% rename from vta/apps/gemm/hardware/chisel/src/main/scala/accel/Accel.scala rename to vta/vta-hw/apps/gemm/hardware/chisel/src/main/scala/accel/Accel.scala diff --git a/vta/apps/gemm/hardware/chisel/src/main/scala/accel/Compute.scala b/vta/vta-hw/apps/gemm/hardware/chisel/src/main/scala/accel/Compute.scala similarity index 98% rename from vta/apps/gemm/hardware/chisel/src/main/scala/accel/Compute.scala rename to vta/vta-hw/apps/gemm/hardware/chisel/src/main/scala/accel/Compute.scala index 6bfe3e054121..1eced6ecc3c2 100644 --- a/vta/apps/gemm/hardware/chisel/src/main/scala/accel/Compute.scala +++ b/vta/vta-hw/apps/gemm/hardware/chisel/src/main/scala/accel/Compute.scala @@ -89,7 +89,7 @@ class Compute(implicit config: AccelConfig) extends Module { is (sReadAData) { when (io.mem.rd.valid) { state := sReadADone - } + } } is (sReadADone) { when (cntwgt === (length * length) - 1.U) { @@ -180,8 +180,8 @@ class Compute(implicit config: AccelConfig) extends Module { } io.mem.rd.ready := state === sReadAData | state === sReadBData - mvc.io.inp.data.valid := state === sInpDone // 2 inputs have been processed - mvc.io.wgt.data.valid := state === sInpDone // 2 inputs have been processed + mvc.io.inp.data.valid := state === sInpDone // 2 inputs have been processed + mvc.io.wgt.data.valid := state === sInpDone // 2 inputs have been processed mvc.io.wgt.data.bits <> reg1 mvc.io.inp.data.bits <> reg2 @@ -198,7 +198,7 @@ class Compute(implicit config: AccelConfig) extends Module { accum.io.valid := mvc.io.acc_o.data.valid // write - io.mem.wr.valid := state === sWriteData + io.mem.wr.valid := state === sWriteData io.mem.wr.bits := accum.io.sum(cntout) // count read/write diff --git a/vta/apps/gemm/hardware/chisel/src/main/scala/accel/RegFile.scala b/vta/vta-hw/apps/gemm/hardware/chisel/src/main/scala/accel/RegFile.scala similarity index 100% rename from vta/apps/gemm/hardware/chisel/src/main/scala/accel/RegFile.scala rename to vta/vta-hw/apps/gemm/hardware/chisel/src/main/scala/accel/RegFile.scala diff --git a/vta/apps/gemm/hardware/chisel/src/test/scala/dut/TestAccel.scala b/vta/vta-hw/apps/gemm/hardware/chisel/src/test/scala/dut/TestAccel.scala similarity index 100% rename from vta/apps/gemm/hardware/chisel/src/test/scala/dut/TestAccel.scala rename to vta/vta-hw/apps/gemm/hardware/chisel/src/test/scala/dut/TestAccel.scala diff --git a/vta/apps/gemm/python/__init__.py b/vta/vta-hw/apps/gemm/python/__init__.py similarity index 100% rename from vta/apps/gemm/python/__init__.py rename to vta/vta-hw/apps/gemm/python/__init__.py diff --git a/vta/apps/gemm/python/tsim.py b/vta/vta-hw/apps/gemm/python/tsim.py similarity index 100% rename from vta/apps/gemm/python/tsim.py rename to vta/vta-hw/apps/gemm/python/tsim.py diff --git a/vta/apps/gemm/src/driver.cc b/vta/vta-hw/apps/gemm/src/driver.cc similarity index 100% rename from vta/apps/gemm/src/driver.cc rename to vta/vta-hw/apps/gemm/src/driver.cc diff --git a/vta/apps/gemm/tests/python/chisel_accel.py b/vta/vta-hw/apps/gemm/tests/python/chisel_accel.py similarity index 100% rename from vta/apps/gemm/tests/python/chisel_accel.py rename to vta/vta-hw/apps/gemm/tests/python/chisel_accel.py diff --git a/vta/apps/gemm/CMakeLists.txt b/vta/vta-hw/apps/tsim_example/CMakeLists.txt similarity index 81% rename from vta/apps/gemm/CMakeLists.txt rename to vta/vta-hw/apps/tsim_example/CMakeLists.txt index 0e8128c9f22a..8ba86a32a18e 100644 --- a/vta/apps/gemm/CMakeLists.txt +++ b/vta/vta-hw/apps/tsim_example/CMakeLists.txt @@ -18,13 +18,13 @@ cmake_minimum_required(VERSION 3.2) project(tsim C CXX) -set(TVM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../) -set(VTA_DIR ${TVM_DIR}/vta) +set(TVM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../) +set(VTA_HW_DIR ${TVM_DIR}/vta/vta-hw) include_directories("${TVM_DIR}/include") include_directories("${TVM_DIR}/3rdparty/dlpack/include") include_directories("${TVM_DIR}/3rdparty/dmlc-core/include") -include_directories("${TVM_DIR}/vta/src/dpi") +include_directories("${VTA_HW_DIR}/src/dpi") set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fvisibility=hidden") set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC -fvisibility=hidden -std=c++11") @@ -35,11 +35,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND endif() file(GLOB TSIM_SW_SRC src/driver.cc) -list(APPEND TSIM_SW_SRC ${VTA_DIR}/src/vmem/virtual_memory.cc) -list(APPEND TSIM_SW_SRC ${VTA_DIR}/src/dpi/module.cc) +list(APPEND TSIM_SW_SRC ${VTA_HW_DIR}/src/vmem/virtual_memory.cc) +list(APPEND TSIM_SW_SRC ${VTA_HW_DIR}/src/dpi/module.cc) add_library(sw SHARED ${TSIM_SW_SRC}) -target_include_directories(sw PRIVATE ${VTA_DIR}/include ${VTA_DIR}/src) +target_include_directories(sw PRIVATE ${VTA_HW_DIR}/include ${VTA_HW_DIR}/src) if(APPLE) set_target_properties(sw PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") diff --git a/vta/apps/tsim_example/Makefile b/vta/vta-hw/apps/tsim_example/Makefile similarity index 96% rename from vta/apps/tsim_example/Makefile rename to vta/vta-hw/apps/tsim_example/Makefile index b18ced840d15..406f9314ab03 100644 --- a/vta/apps/tsim_example/Makefile +++ b/vta/vta-hw/apps/tsim_example/Makefile @@ -20,7 +20,9 @@ export PYTHONPATH:=$(PWD)/python:$(PYTHONPATH) BUILD_NAME = build build_dir = $(abspath .)/$(BUILD_NAME) -default: verilog driver +default: run_verilog + +run_verilog: verilog driver python3 tests/python/verilog_accel.py run_chisel: chisel driver diff --git a/vta/apps/tsim_example/README.md b/vta/vta-hw/apps/tsim_example/README.md similarity index 85% rename from vta/apps/tsim_example/README.md rename to vta/vta-hw/apps/tsim_example/README.md index 97758b937f32..6a9a3553bc32 100644 --- a/vta/apps/tsim_example/README.md +++ b/vta/vta-hw/apps/tsim_example/README.md @@ -55,7 +55,7 @@ verilator --version the supported version of Verilator should be at least 4.012, if homebrew (OSX) or package-manager (Linux) does not support that version, please install Verilator 4.012 or later from binary or source base on following -instruction of Verilator wiki. +instruction of Verilator wiki. https://www.veripool.org/projects/verilator/wiki/Installing @@ -72,16 +72,16 @@ The default target language for these two implementations is Verilog. The follow how to run both of them: * Test Verilog backend - * Go to `/vta/apps/tsim_example` + * Go to `/vta/vta-hw/apps/tsim_example` * Run `make` * Test Chisel3 backend - * Go to `/vta/apps/tsim_example` + * Go to `/vta/vta-hw/apps/tsim_example` * Run `make run_chisel` * Some pointers - * Verilog and Chisel3 tests in `/vta/apps/tsim_example/tests/python` - * Verilog accelerator backend `/vta/apps/tsim_example/hardware/verilog` - * Chisel3 accelerator backend `/vta/apps/tsim_example/hardware/chisel` - * Software C++ driver (backend) that handles the accelerator `/vta/apps/tsim_example/src/driver.cc` - * Software Python driver (frontend) that handles the accelerator `/vta/apps/tsim_example/python/accel` + * Verilog and Chisel3 tests in `/vta/vta-hw/apps/tsim_example/tests/python` + * Verilog accelerator backend `/vta/vta-hw/apps/tsim_example/hardware/verilog` + * Chisel3 accelerator backend `/vta/vta-hw/apps/tsim_example/hardware/chisel` + * Software C++ driver (backend) that handles the accelerator `/vta/vta-hw/apps/tsim_example/src/driver.cc` + * Software Python driver (frontend) that handles the accelerator `vtay/vta-hw/apps/tsim_example/python/accel` diff --git a/vta/apps/tsim_example/hardware/chisel/Makefile b/vta/vta-hw/apps/tsim_example/hardware/chisel/Makefile similarity index 98% rename from vta/apps/tsim_example/hardware/chisel/Makefile rename to vta/vta-hw/apps/tsim_example/hardware/chisel/Makefile index 342e6896b000..2bbe7778095c 100644 --- a/vta/apps/tsim_example/hardware/chisel/Makefile +++ b/vta/vta-hw/apps/tsim_example/hardware/chisel/Makefile @@ -38,7 +38,7 @@ USE_TRACE = 0 LIBNAME = libhw vta_dir = $(abspath ../../../../) -tvm_dir = $(abspath ../../../../../) +tvm_dir = $(abspath ../../../../../../) build_dir = $(abspath .)/$(BUILD_NAME) verilator_build_dir = $(build_dir)/verilator chisel_build_dir = $(build_dir)/chisel diff --git a/vta/apps/tsim_example/hardware/chisel/build.sbt b/vta/vta-hw/apps/tsim_example/hardware/chisel/build.sbt similarity index 100% rename from vta/apps/tsim_example/hardware/chisel/build.sbt rename to vta/vta-hw/apps/tsim_example/hardware/chisel/build.sbt diff --git a/vta/apps/gemm/hardware/chisel/project/build.properties b/vta/vta-hw/apps/tsim_example/hardware/chisel/project/build.properties similarity index 97% rename from vta/apps/gemm/hardware/chisel/project/build.properties rename to vta/vta-hw/apps/tsim_example/hardware/chisel/project/build.properties index 7e2b74b51a4f..fc7998eb3eac 100644 --- a/vta/apps/gemm/hardware/chisel/project/build.properties +++ b/vta/vta-hw/apps/tsim_example/hardware/chisel/project/build.properties @@ -17,4 +17,4 @@ * under the License. */ -sbt.version = 1.1.1 +sbt.version = 1.3.2 diff --git a/vta/apps/tsim_example/hardware/chisel/project/plugins.sbt b/vta/vta-hw/apps/tsim_example/hardware/chisel/project/plugins.sbt similarity index 100% rename from vta/apps/tsim_example/hardware/chisel/project/plugins.sbt rename to vta/vta-hw/apps/tsim_example/hardware/chisel/project/plugins.sbt diff --git a/vta/apps/tsim_example/hardware/chisel/src/main/scala/accel/Accel.scala b/vta/vta-hw/apps/tsim_example/hardware/chisel/src/main/scala/accel/Accel.scala similarity index 100% rename from vta/apps/tsim_example/hardware/chisel/src/main/scala/accel/Accel.scala rename to vta/vta-hw/apps/tsim_example/hardware/chisel/src/main/scala/accel/Accel.scala diff --git a/vta/apps/tsim_example/hardware/chisel/src/main/scala/accel/Compute.scala b/vta/vta-hw/apps/tsim_example/hardware/chisel/src/main/scala/accel/Compute.scala similarity index 100% rename from vta/apps/tsim_example/hardware/chisel/src/main/scala/accel/Compute.scala rename to vta/vta-hw/apps/tsim_example/hardware/chisel/src/main/scala/accel/Compute.scala diff --git a/vta/apps/tsim_example/hardware/chisel/src/main/scala/accel/RegFile.scala b/vta/vta-hw/apps/tsim_example/hardware/chisel/src/main/scala/accel/RegFile.scala similarity index 100% rename from vta/apps/tsim_example/hardware/chisel/src/main/scala/accel/RegFile.scala rename to vta/vta-hw/apps/tsim_example/hardware/chisel/src/main/scala/accel/RegFile.scala diff --git a/vta/apps/tsim_example/hardware/chisel/src/test/scala/dut/TestAccel.scala b/vta/vta-hw/apps/tsim_example/hardware/chisel/src/test/scala/dut/TestAccel.scala similarity index 100% rename from vta/apps/tsim_example/hardware/chisel/src/test/scala/dut/TestAccel.scala rename to vta/vta-hw/apps/tsim_example/hardware/chisel/src/test/scala/dut/TestAccel.scala diff --git a/vta/apps/tsim_example/hardware/verilog/Makefile b/vta/vta-hw/apps/tsim_example/hardware/verilog/Makefile similarity index 98% rename from vta/apps/tsim_example/hardware/verilog/Makefile rename to vta/vta-hw/apps/tsim_example/hardware/verilog/Makefile index 9617a07ad565..72b0a2a14eba 100644 --- a/vta/apps/tsim_example/hardware/verilog/Makefile +++ b/vta/vta-hw/apps/tsim_example/hardware/verilog/Makefile @@ -38,7 +38,7 @@ USE_TRACE = 0 LIBNAME = libhw vta_dir = $(abspath ../../../../) -tvm_dir = $(abspath ../../../../../) +tvm_dir = $(abspath ../../../../../../) build_dir = $(abspath .)/$(BUILD_NAME) verilator_opt = --cc diff --git a/vta/apps/tsim_example/hardware/verilog/src/Accel.v b/vta/vta-hw/apps/tsim_example/hardware/verilog/src/Accel.v similarity index 100% rename from vta/apps/tsim_example/hardware/verilog/src/Accel.v rename to vta/vta-hw/apps/tsim_example/hardware/verilog/src/Accel.v diff --git a/vta/apps/tsim_example/hardware/verilog/src/Compute.v b/vta/vta-hw/apps/tsim_example/hardware/verilog/src/Compute.v similarity index 100% rename from vta/apps/tsim_example/hardware/verilog/src/Compute.v rename to vta/vta-hw/apps/tsim_example/hardware/verilog/src/Compute.v diff --git a/vta/apps/tsim_example/hardware/verilog/src/RegFile.v b/vta/vta-hw/apps/tsim_example/hardware/verilog/src/RegFile.v similarity index 100% rename from vta/apps/tsim_example/hardware/verilog/src/RegFile.v rename to vta/vta-hw/apps/tsim_example/hardware/verilog/src/RegFile.v diff --git a/vta/apps/tsim_example/hardware/verilog/src/TestAccel.v b/vta/vta-hw/apps/tsim_example/hardware/verilog/src/TestAccel.v similarity index 100% rename from vta/apps/tsim_example/hardware/verilog/src/TestAccel.v rename to vta/vta-hw/apps/tsim_example/hardware/verilog/src/TestAccel.v diff --git a/vta/apps/tsim_example/python/__init__.py b/vta/vta-hw/apps/tsim_example/python/__init__.py similarity index 100% rename from vta/apps/tsim_example/python/__init__.py rename to vta/vta-hw/apps/tsim_example/python/__init__.py diff --git a/vta/apps/tsim_example/python/tsim.py b/vta/vta-hw/apps/tsim_example/python/tsim.py similarity index 100% rename from vta/apps/tsim_example/python/tsim.py rename to vta/vta-hw/apps/tsim_example/python/tsim.py diff --git a/vta/apps/tsim_example/src/driver.cc b/vta/vta-hw/apps/tsim_example/src/driver.cc similarity index 100% rename from vta/apps/tsim_example/src/driver.cc rename to vta/vta-hw/apps/tsim_example/src/driver.cc diff --git a/vta/apps/tsim_example/tests/python/chisel_accel.py b/vta/vta-hw/apps/tsim_example/tests/python/chisel_accel.py similarity index 100% rename from vta/apps/tsim_example/tests/python/chisel_accel.py rename to vta/vta-hw/apps/tsim_example/tests/python/chisel_accel.py diff --git a/vta/apps/tsim_example/tests/python/verilog_accel.py b/vta/vta-hw/apps/tsim_example/tests/python/verilog_accel.py similarity index 100% rename from vta/apps/tsim_example/tests/python/verilog_accel.py rename to vta/vta-hw/apps/tsim_example/tests/python/verilog_accel.py diff --git a/vta/config/README.md b/vta/vta-hw/config/README.md similarity index 100% rename from vta/config/README.md rename to vta/vta-hw/config/README.md diff --git a/vta/config/de10nano_sample.json b/vta/vta-hw/config/de10nano_sample.json similarity index 100% rename from vta/config/de10nano_sample.json rename to vta/vta-hw/config/de10nano_sample.json diff --git a/vta/config/fsim_sample.json b/vta/vta-hw/config/fsim_sample.json similarity index 100% rename from vta/config/fsim_sample.json rename to vta/vta-hw/config/fsim_sample.json diff --git a/vta/config/pynq_sample.json b/vta/vta-hw/config/pynq_sample.json similarity index 100% rename from vta/config/pynq_sample.json rename to vta/vta-hw/config/pynq_sample.json diff --git a/vta/config/tsim_sample.json b/vta/vta-hw/config/tsim_sample.json similarity index 100% rename from vta/config/tsim_sample.json rename to vta/vta-hw/config/tsim_sample.json diff --git a/vta/config/ultra96_sample.json b/vta/vta-hw/config/ultra96_sample.json similarity index 100% rename from vta/config/ultra96_sample.json rename to vta/vta-hw/config/ultra96_sample.json diff --git a/vta/config/vta_config.json b/vta/vta-hw/config/vta_config.json similarity index 100% rename from vta/config/vta_config.json rename to vta/vta-hw/config/vta_config.json diff --git a/vta/config/vta_config.py b/vta/vta-hw/config/vta_config.py similarity index 97% rename from vta/config/vta_config.py rename to vta/vta-hw/config/vta_config.py index 1c2f050463c4..549ce0ad77af 100644 --- a/vta/config/vta_config.py +++ b/vta/vta-hw/config/vta_config.py @@ -23,7 +23,7 @@ def get_pkg_config(cfg): """Get the pkg config object.""" curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) - proj_root = os.path.abspath(os.path.join(curr_path, "../../")) + proj_root = os.path.abspath(os.path.join(curr_path, "../../../")) pkg_config_py = os.path.join(proj_root, "vta/python/vta/pkg_config.py") libpkg = {"__file__": pkg_config_py} exec(compile(open(pkg_config_py, "rb").read(), pkg_config_py, "exec"), libpkg, libpkg) @@ -107,9 +107,9 @@ def main(): curr_path = os.path.dirname( os.path.abspath(os.path.expanduser(__file__))) - proj_root = os.path.abspath(os.path.join(curr_path, "../../")) + proj_root = os.path.abspath(os.path.join(curr_path, "../../../")) path_list = [ - os.path.join(proj_root, "vta/config/vta_config.json") + os.path.join(proj_root, "vta/vta-hw/config/vta_config.json") ] if args.use_cfg: path_list = [args.use_cfg] diff --git a/vta/hardware/chisel/.gitignore b/vta/vta-hw/hardware/chisel/.gitignore similarity index 100% rename from vta/hardware/chisel/.gitignore rename to vta/vta-hw/hardware/chisel/.gitignore diff --git a/vta/hardware/chisel/Makefile b/vta/vta-hw/hardware/chisel/Makefile similarity index 75% rename from vta/hardware/chisel/Makefile rename to vta/vta-hw/hardware/chisel/Makefile index 21149dfb83e3..dfb598e74f90 100644 --- a/vta/hardware/chisel/Makefile +++ b/vta/vta-hw/hardware/chisel/Makefile @@ -21,15 +21,15 @@ endif # Change VERILATOR_INC_DIR if Verilator is installed on a different location ifeq (, $(VERILATOR_INC_DIR)) - ifeq (, $(wildcard /usr/local/share/verilator/include/*)) - ifeq (, $(wildcard /usr/share/verilator/include/*)) - $(error "Verilator include directory is not set properly") - else - VERILATOR_INC_DIR := /usr/share/verilator/include - endif - else - VERILATOR_INC_DIR := /usr/local/share/verilator/include - endif + ifeq (, $(wildcard /usr/local/share/verilator/include/*)) + ifeq (, $(wildcard /usr/share/verilator/include/*)) + $(error "Verilator include directory is not set properly") + else + VERILATOR_INC_DIR := /usr/share/verilator/include + endif + else + VERILATOR_INC_DIR := /usr/local/share/verilator/include + endif endif CONFIG = DefaultDe10Config @@ -49,7 +49,7 @@ USE_TRACE_FST = 0 # This will significantly increase the trace size and should only be used # on a per need basis for difficult debug problems. USE_TRACE_DETAILED = 0 -USE_THREADS = $(shell nproc) +USE_THREADS = 0 VTA_LIBNAME = libvta_hw UNITTEST_NAME = all CXX = g++ @@ -65,7 +65,7 @@ CXX_HAS_ALIGN_NEW := $(shell [ $(CXX_MAJOR) -ge 7 ] && echo true) config_test = $(TOP_TEST)$(CONFIG) vta_dir = $(abspath ../../) -tvm_dir = $(abspath ../../../) +tvm_dir = $(abspath ../../../../) verilator_build_dir = $(vta_dir)/$(BUILD_NAME)/verilator chisel_build_dir = $(vta_dir)/$(BUILD_NAME)/chisel @@ -81,14 +81,14 @@ verilator_opt += -Mdir ${verilator_build_dir} verilator_opt += -I$(chisel_build_dir) ifeq ($(DEBUG), 0) - cxx_flags = -O2 -Wall -fvisibility=hidden + cxx_flags = -O2 -Wall -fvisibility=hidden else - cxx_flags = -O0 -g -Wall + cxx_flags = -O0 -g -Wall endif cxx_flags += -std=c++11 -Wno-maybe-uninitialized ifeq ($(CXX_HAS_ALIGN_NEW),true) - cxx_flags += -faligned-new + cxx_flags += -faligned-new endif cxx_flags += -DVL_TSIM_NAME=V$(TOP_TEST) cxx_flags += -DVL_PRINTF=printf @@ -107,50 +107,50 @@ cxx_flags += -I$(tvm_dir)/3rdparty/dlpack/include ld_flags = -fPIC -shared ifeq ($(SANITIZE), 1) - ifeq ($(DEBUG), 1) - cxx_flags += -fno-omit-frame-pointer -fsanitize=address -fsanitize-recover=address - ld_flags += -fno-omit-frame-pointer -fsanitize=address -fsanitize-recover=address - endif + ifeq ($(DEBUG), 1) + cxx_flags += -fno-omit-frame-pointer -fsanitize=address -fsanitize-recover=address + ld_flags += -fno-omit-frame-pointer -fsanitize=address -fsanitize-recover=address + endif endif cxx_objs = $(verilator_build_dir)/verilated.o $(verilator_build_dir)/verilated_dpi.o $(verilator_build_dir)/tsim_device.o ifneq ($(USE_TRACE), 0) - cxx_flags += -DVM_TRACE=1 - ifeq ($(USE_TRACE_FST), 1) - cxx_flags += -DVM_TRACE_FST - verilator_opt += --trace-fst - else - verilator_opt += --trace - endif - ifeq ($(USE_TRACE_DETAILED), 1) - verilator_opt += --trace-underscore --trace-structs - endif - ifeq ($(USE_TRACE_FST), 1) - cxx_flags += -DTSIM_TRACE_FILE=$(verilator_build_dir)/$(TOP_TEST).fst - cxx_objs += $(verilator_build_dir)/verilated_fst_c.o - else - cxx_flags += -DTSIM_TRACE_FILE=$(verilator_build_dir)/$(TOP_TEST).vcd - cxx_objs += $(verilator_build_dir)/verilated_vcd_c.o - endif + cxx_flags += -DVM_TRACE=1 + ifeq ($(USE_TRACE_FST), 1) + cxx_flags += -DVM_TRACE_FST + verilator_opt += --trace-fst + else + verilator_opt += --trace + endif + ifeq ($(USE_TRACE_DETAILED), 1) + verilator_opt += --trace-underscore --trace-structs + endif + ifeq ($(USE_TRACE_FST), 1) + cxx_flags += -DTSIM_TRACE_FILE=$(verilator_build_dir)/$(TOP_TEST).fst + cxx_objs += $(verilator_build_dir)/verilated_fst_c.o + else + cxx_flags += -DTSIM_TRACE_FILE=$(verilator_build_dir)/$(TOP_TEST).vcd + cxx_objs += $(verilator_build_dir)/verilated_vcd_c.o + endif else - cxx_flags += -DVM_TRACE=0 + cxx_flags += -DVM_TRACE=0 endif ifneq ($(USE_THREADS), 0) - verilator_opt += --threads $(USE_THREADS) - cxx_flags += -DVL_THREADED - cxx_objs += $(verilator_build_dir)/verilated_threads.o + verilator_opt += --threads $(USE_THREADS) + cxx_flags += -DVL_THREADED + cxx_objs += $(verilator_build_dir)/verilated_threads.o endif VPATH = $(VERILATOR_INC_DIR):$(verilator_build_dir):$(vta_dir)/hardware/dpi # The following is to be consistent with cmake ifeq ($(shell uname), Darwin) - lib_path = $(vta_dir)/$(BUILD_NAME)/$(VTA_LIBNAME).dylib - cxx_flags += -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk + lib_path = $(vta_dir)/$(BUILD_NAME)/$(VTA_LIBNAME).dylib + cxx_flags += -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk else - lib_path = $(vta_dir)/$(BUILD_NAME)/$(VTA_LIBNAME).so + lib_path = $(vta_dir)/$(BUILD_NAME)/$(VTA_LIBNAME).so endif default: lint lib @@ -193,4 +193,5 @@ clean: cleanall: -rm -rf $(vta_dir)/$(BUILD_NAME)/chisel -rm -rf $(vta_dir)/$(BUILD_NAME)/libvta_hw.so + -rm -rf $(vta_dir)/$(BUILD_NAME)/libvta_hw.dylib -rm -rf $(vta_dir)/$(BUILD_NAME)/verilator diff --git a/vta/hardware/chisel/README.md b/vta/vta-hw/hardware/chisel/README.md similarity index 98% rename from vta/hardware/chisel/README.md rename to vta/vta-hw/hardware/chisel/README.md index 24e3531537d6..40c43220c5e1 100644 --- a/vta/hardware/chisel/README.md +++ b/vta/vta-hw/hardware/chisel/README.md @@ -15,16 +15,16 @@ -VTA in Chisel +VTA in Chisel =================================================== For contributors who wants to test a chisel module: - + - You can add your test files in `src/test/scala/unitttest` - Add your test name and tests to the `test` object in `src/test/scala/unitttest/Launcher.scala` - Check out the provided sample test `mvm` which tests the MatrixVectorComputation module in `src/main/scala/core/TensorGemm.scala` - Running unit tests: `make test test_name=your_own test_name` - + diff --git a/vta/hardware/chisel/build.sbt b/vta/vta-hw/hardware/chisel/build.sbt similarity index 98% rename from vta/hardware/chisel/build.sbt rename to vta/vta-hw/hardware/chisel/build.sbt index 45fbf00dd66c..7efd59db3486 100644 --- a/vta/hardware/chisel/build.sbt +++ b/vta/vta-hw/hardware/chisel/build.sbt @@ -62,7 +62,7 @@ resolvers ++= Seq( val defaultVersions = Map( "chisel3" -> "3.1.7", - "chisel-iotesters" -> "[1.2.5,1.3-SNAPSHOT[" + "chisel-iotesters" -> "1.2.4" ) libraryDependencies ++= Seq("chisel3","chisel-iotesters").map { diff --git a/vta/hardware/chisel/project/build.properties b/vta/vta-hw/hardware/chisel/project/build.properties similarity index 97% rename from vta/hardware/chisel/project/build.properties rename to vta/vta-hw/hardware/chisel/project/build.properties index 7e2b74b51a4f..fc7998eb3eac 100644 --- a/vta/hardware/chisel/project/build.properties +++ b/vta/vta-hw/hardware/chisel/project/build.properties @@ -17,4 +17,4 @@ * under the License. */ -sbt.version = 1.1.1 +sbt.version = 1.3.2 diff --git a/vta/hardware/chisel/project/plugins.sbt b/vta/vta-hw/hardware/chisel/project/plugins.sbt similarity index 100% rename from vta/hardware/chisel/project/plugins.sbt rename to vta/vta-hw/hardware/chisel/project/plugins.sbt diff --git a/vta/hardware/chisel/scalastyle-config.xml b/vta/vta-hw/hardware/chisel/scalastyle-config.xml similarity index 100% rename from vta/hardware/chisel/scalastyle-config.xml rename to vta/vta-hw/hardware/chisel/scalastyle-config.xml diff --git a/vta/hardware/chisel/src/main/resources/verilog/VTAHostDPI.v b/vta/vta-hw/hardware/chisel/src/main/resources/verilog/VTAHostDPI.v similarity index 100% rename from vta/hardware/chisel/src/main/resources/verilog/VTAHostDPI.v rename to vta/vta-hw/hardware/chisel/src/main/resources/verilog/VTAHostDPI.v diff --git a/vta/hardware/chisel/src/main/resources/verilog/VTAMemDPI.v b/vta/vta-hw/hardware/chisel/src/main/resources/verilog/VTAMemDPI.v similarity index 100% rename from vta/hardware/chisel/src/main/resources/verilog/VTAMemDPI.v rename to vta/vta-hw/hardware/chisel/src/main/resources/verilog/VTAMemDPI.v diff --git a/vta/hardware/chisel/src/main/resources/verilog/VTASimDPI.v b/vta/vta-hw/hardware/chisel/src/main/resources/verilog/VTASimDPI.v similarity index 100% rename from vta/hardware/chisel/src/main/resources/verilog/VTASimDPI.v rename to vta/vta-hw/hardware/chisel/src/main/resources/verilog/VTASimDPI.v diff --git a/vta/hardware/chisel/src/main/scala/core/Compute.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/Compute.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/Compute.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/Compute.scala diff --git a/vta/hardware/chisel/src/main/scala/core/Configs.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/Configs.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/Configs.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/Configs.scala diff --git a/vta/hardware/chisel/src/main/scala/core/Core.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/Core.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/Core.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/Core.scala diff --git a/vta/hardware/chisel/src/main/scala/core/Decode.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/Decode.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/Decode.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/Decode.scala diff --git a/vta/hardware/chisel/src/main/scala/core/EventCounters.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/EventCounters.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/EventCounters.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/EventCounters.scala diff --git a/vta/hardware/chisel/src/main/scala/core/Fetch.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/Fetch.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/Fetch.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/Fetch.scala diff --git a/vta/hardware/chisel/src/main/scala/core/ISA.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/ISA.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/ISA.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/ISA.scala diff --git a/vta/hardware/chisel/src/main/scala/core/Load.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/Load.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/Load.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/Load.scala diff --git a/vta/hardware/chisel/src/main/scala/core/LoadUop.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/LoadUop.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/LoadUop.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/LoadUop.scala diff --git a/vta/hardware/chisel/src/main/scala/core/Semaphore.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/Semaphore.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/Semaphore.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/Semaphore.scala diff --git a/vta/hardware/chisel/src/main/scala/core/Store.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/Store.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/Store.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/Store.scala diff --git a/vta/hardware/chisel/src/main/scala/core/TensorAlu.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/TensorAlu.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/TensorAlu.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/TensorAlu.scala diff --git a/vta/hardware/chisel/src/main/scala/core/TensorGemm.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/TensorGemm.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/TensorGemm.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/TensorGemm.scala diff --git a/vta/hardware/chisel/src/main/scala/core/TensorLoad.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/TensorLoad.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/TensorLoad.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/TensorLoad.scala diff --git a/vta/hardware/chisel/src/main/scala/core/TensorStore.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/TensorStore.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/TensorStore.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/TensorStore.scala diff --git a/vta/hardware/chisel/src/main/scala/core/TensorUtil.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/TensorUtil.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/TensorUtil.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/TensorUtil.scala diff --git a/vta/hardware/chisel/src/main/scala/core/package.scala b/vta/vta-hw/hardware/chisel/src/main/scala/core/package.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/core/package.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/core/package.scala diff --git a/vta/hardware/chisel/src/main/scala/dpi/VTAHostDPI.scala b/vta/vta-hw/hardware/chisel/src/main/scala/dpi/VTAHostDPI.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/dpi/VTAHostDPI.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/dpi/VTAHostDPI.scala diff --git a/vta/hardware/chisel/src/main/scala/dpi/VTAMemDPI.scala b/vta/vta-hw/hardware/chisel/src/main/scala/dpi/VTAMemDPI.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/dpi/VTAMemDPI.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/dpi/VTAMemDPI.scala diff --git a/vta/hardware/chisel/src/main/scala/dpi/VTASimDPI.scala b/vta/vta-hw/hardware/chisel/src/main/scala/dpi/VTASimDPI.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/dpi/VTASimDPI.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/dpi/VTASimDPI.scala diff --git a/vta/hardware/chisel/src/main/scala/interface/axi/AXI.scala b/vta/vta-hw/hardware/chisel/src/main/scala/interface/axi/AXI.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/interface/axi/AXI.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/interface/axi/AXI.scala diff --git a/vta/hardware/chisel/src/main/scala/shell/Configs.scala b/vta/vta-hw/hardware/chisel/src/main/scala/shell/Configs.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/shell/Configs.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/shell/Configs.scala diff --git a/vta/hardware/chisel/src/main/scala/shell/IntelShell.scala b/vta/vta-hw/hardware/chisel/src/main/scala/shell/IntelShell.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/shell/IntelShell.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/shell/IntelShell.scala diff --git a/vta/hardware/chisel/src/main/scala/shell/SimShell.scala b/vta/vta-hw/hardware/chisel/src/main/scala/shell/SimShell.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/shell/SimShell.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/shell/SimShell.scala diff --git a/vta/hardware/chisel/src/main/scala/shell/VCR.scala b/vta/vta-hw/hardware/chisel/src/main/scala/shell/VCR.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/shell/VCR.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/shell/VCR.scala diff --git a/vta/hardware/chisel/src/main/scala/shell/VME.scala b/vta/vta-hw/hardware/chisel/src/main/scala/shell/VME.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/shell/VME.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/shell/VME.scala diff --git a/vta/hardware/chisel/src/main/scala/shell/VTAShell.scala b/vta/vta-hw/hardware/chisel/src/main/scala/shell/VTAShell.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/shell/VTAShell.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/shell/VTAShell.scala diff --git a/vta/hardware/chisel/src/main/scala/shell/XilinxShell.scala b/vta/vta-hw/hardware/chisel/src/main/scala/shell/XilinxShell.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/shell/XilinxShell.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/shell/XilinxShell.scala diff --git a/vta/hardware/chisel/src/main/scala/test/Test.scala b/vta/vta-hw/hardware/chisel/src/main/scala/test/Test.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/test/Test.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/test/Test.scala diff --git a/vta/hardware/chisel/src/main/scala/util/Config.scala b/vta/vta-hw/hardware/chisel/src/main/scala/util/Config.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/util/Config.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/util/Config.scala diff --git a/vta/hardware/chisel/src/main/scala/util/GenericParameterizedBundle.scala b/vta/vta-hw/hardware/chisel/src/main/scala/util/GenericParameterizedBundle.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/util/GenericParameterizedBundle.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/util/GenericParameterizedBundle.scala diff --git a/vta/hardware/chisel/src/main/scala/vta/Configs.scala b/vta/vta-hw/hardware/chisel/src/main/scala/vta/Configs.scala similarity index 100% rename from vta/hardware/chisel/src/main/scala/vta/Configs.scala rename to vta/vta-hw/hardware/chisel/src/main/scala/vta/Configs.scala diff --git a/vta/hardware/chisel/src/test/scala/unittest/AluTest.scala b/vta/vta-hw/hardware/chisel/src/test/scala/unittest/AluTest.scala similarity index 96% rename from vta/hardware/chisel/src/test/scala/unittest/AluTest.scala rename to vta/vta-hw/hardware/chisel/src/test/scala/unittest/AluTest.scala index 13b857833a14..56d81b874dd7 100644 --- a/vta/hardware/chisel/src/test/scala/unittest/AluTest.scala +++ b/vta/vta-hw/hardware/chisel/src/test/scala/unittest/AluTest.scala @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ - + package unittest import chisel3._ @@ -27,7 +27,7 @@ import unittest.util._ import vta.core._ class TestAluVector(c: AluVector) extends PeekPokeTester(c) { - + /* alu_ref * * This is a software function used as a reference for the hardware @@ -36,11 +36,11 @@ class TestAluVector(c: AluVector) extends PeekPokeTester(c) { val size = a.length val mask = helper.getMask(log2Ceil(width)) val res = Array.fill(size) {0} - + if (opcode == 1) { for (i <- 0 until size) { res(i) = if (a(i) < b(i)) b(i) else a(i) - } + } } else if (opcode == 2) { for (i <- 0 until size) { res(i) = a(i) + b(i) @@ -62,7 +62,7 @@ class TestAluVector(c: AluVector) extends PeekPokeTester(c) { } } return res - } + } val num_ops = ALU_OP_NUM for (i <- 0 until num_ops) { @@ -73,18 +73,18 @@ class TestAluVector(c: AluVector) extends PeekPokeTester(c) { val in_a = dataGen.any val in_b = if (op != 4) dataGen.any else dataGen.negative val mask = helper.getMask(bits) - val res = aluRef(op, in_a, in_b, bits) - + val res = aluRef(op, in_a, in_b, bits) + for (i <- 0 until c.blockOut) { poke(c.io.acc_a.data.bits(0)(i), in_a(i) & mask) poke(c.io.acc_b.data.bits(0)(i), in_b(i) & mask) } - poke(c.io.opcode, op) + poke(c.io.opcode, op) poke(c.io.acc_a.data.valid, 1) poke(c.io.acc_b.data.valid, 1) poke(c.io.acc_y.data.valid, 1) - + step(1) poke(c.io.acc_a.data.valid, 0) @@ -94,11 +94,11 @@ class TestAluVector(c: AluVector) extends PeekPokeTester(c) { // wait for valid signal while (peek(c.io.acc_y.data.valid) == BigInt(0)) { step(1) // advance clock - } + } if (peek(c.io.acc_y.data.valid) == BigInt(1)) { for (i <- 0 until c.blockOut) { expect(c.io.acc_y.data.bits(0)(i), res(i) & mask) } } - } + } } diff --git a/vta/hardware/chisel/src/test/scala/unittest/Launcher.scala b/vta/vta-hw/hardware/chisel/src/test/scala/unittest/Launcher.scala similarity index 98% rename from vta/hardware/chisel/src/test/scala/unittest/Launcher.scala rename to vta/vta-hw/hardware/chisel/src/test/scala/unittest/Launcher.scala index 5c80a1edd2a5..2a1d201088ad 100644 --- a/vta/hardware/chisel/src/test/scala/unittest/Launcher.scala +++ b/vta/vta-hw/hardware/chisel/src/test/scala/unittest/Launcher.scala @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ - + package unittest // taken from https://github.com/freechipsproject/chisel-testers @@ -36,7 +36,7 @@ class TestConfig extends Config(new CoreConfig ++ new PynqConfig) * * How to Use: * When the user input: sbt 'test:runMain unittest.Launcher mvm' - * the TestRunner will look for 'mvm' in the map and executes the + * the TestRunner will look for 'mvm' in the map and executes the * test that 'mvm' is mapped to */ object Launcher { @@ -50,8 +50,8 @@ object Launcher { "alu" -> { (manager: TesterOptionsManager) => Driver.execute(() => new AluVector, manager) { (c) => new TestAluVector(c) - } - } + } + } ) def main(args: Array[String]): Unit = { diff --git a/vta/hardware/chisel/src/test/scala/unittest/MvmTest.scala b/vta/vta-hw/hardware/chisel/src/test/scala/unittest/MvmTest.scala similarity index 97% rename from vta/hardware/chisel/src/test/scala/unittest/MvmTest.scala rename to vta/vta-hw/hardware/chisel/src/test/scala/unittest/MvmTest.scala index 48f03d0ddeda..b8af87958067 100644 --- a/vta/hardware/chisel/src/test/scala/unittest/MvmTest.scala +++ b/vta/vta-hw/hardware/chisel/src/test/scala/unittest/MvmTest.scala @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ - + package unittest import chisel3._ @@ -27,7 +27,7 @@ import unittest.util._ import vta.core._ class TestMatrixVectorMultiplication(c: MatrixVectorMultiplication) extends PeekPokeTester(c) { - + /* mvm_ref * * This is a software function that computes dot product with a programmable shift @@ -53,11 +53,11 @@ class TestMatrixVectorMultiplication(c: MatrixVectorMultiplication) extends Peek val wgtGen = new RandomArray(c.size, c.wgtBits) val in_a = inpGen.any val in_b = Array.fill(c.size) { wgtGen.any } - val res = mvmRef(in_a, in_b, 0) + val res = mvmRef(in_a, in_b, 0) val inpMask = helper.getMask(c.inpBits) val wgtMask = helper.getMask(c.wgtBits) val accMask = helper.getMask(c.accBits) - + for (i <- 0 until c.size) { poke(c.io.inp.data.bits(0)(i), in_a(i) & inpMask) poke(c.io.acc_i.data.bits(0)(i), 0) @@ -65,13 +65,13 @@ class TestMatrixVectorMultiplication(c: MatrixVectorMultiplication) extends Peek poke(c.io.wgt.data.bits(i)(j), in_b(i)(j) & wgtMask) } } - + poke(c.io.reset, 0) - + poke(c.io.inp.data.valid, 1) poke(c.io.wgt.data.valid, 1) poke(c.io.acc_i.data.valid, 1) - + step(1) poke(c.io.inp.data.valid, 0) @@ -81,7 +81,7 @@ class TestMatrixVectorMultiplication(c: MatrixVectorMultiplication) extends Peek // wait for valid signal while (peek(c.io.acc_o.data.valid) == BigInt(0)) { step(1) // advance clock - } + } if (peek(c.io.acc_o.data.valid) == BigInt(1)) { for (i <- 0 until c.size) { expect(c.io.acc_o.data.bits(0)(i), res(i) & accMask) diff --git a/vta/hardware/chisel/src/test/scala/unittest/utils/Helper.scala b/vta/vta-hw/hardware/chisel/src/test/scala/unittest/utils/Helper.scala similarity index 100% rename from vta/hardware/chisel/src/test/scala/unittest/utils/Helper.scala rename to vta/vta-hw/hardware/chisel/src/test/scala/unittest/utils/Helper.scala diff --git a/vta/hardware/chisel/src/test/scala/unittest/utils/RandomArray.scala b/vta/vta-hw/hardware/chisel/src/test/scala/unittest/utils/RandomArray.scala similarity index 100% rename from vta/hardware/chisel/src/test/scala/unittest/utils/RandomArray.scala rename to vta/vta-hw/hardware/chisel/src/test/scala/unittest/utils/RandomArray.scala diff --git a/vta/hardware/chisel/src/test/scala/unittest/utils/TestRunner.scala b/vta/vta-hw/hardware/chisel/src/test/scala/unittest/utils/TestRunner.scala similarity index 100% rename from vta/hardware/chisel/src/test/scala/unittest/utils/TestRunner.scala rename to vta/vta-hw/hardware/chisel/src/test/scala/unittest/utils/TestRunner.scala diff --git a/vta/hardware/dpi/tsim_device.cc b/vta/vta-hw/hardware/dpi/tsim_device.cc similarity index 100% rename from vta/hardware/dpi/tsim_device.cc rename to vta/vta-hw/hardware/dpi/tsim_device.cc diff --git a/vta/hardware/intel/Makefile b/vta/vta-hw/hardware/intel/Makefile similarity index 100% rename from vta/hardware/intel/Makefile rename to vta/vta-hw/hardware/intel/Makefile diff --git a/vta/hardware/intel/README.md b/vta/vta-hw/hardware/intel/README.md similarity index 100% rename from vta/hardware/intel/README.md rename to vta/vta-hw/hardware/intel/README.md diff --git a/vta/hardware/intel/scripts/compile_design.tcl b/vta/vta-hw/hardware/intel/scripts/compile_design.tcl similarity index 99% rename from vta/hardware/intel/scripts/compile_design.tcl rename to vta/vta-hw/hardware/intel/scripts/compile_design.tcl index 0bce2ef4cc0f..2297e6340147 100644 --- a/vta/hardware/intel/scripts/compile_design.tcl +++ b/vta/vta-hw/hardware/intel/scripts/compile_design.tcl @@ -67,7 +67,7 @@ if {$make_assignments} { set_global_assignment -name VERILOG_FILE ${PROJECT_NAME}.v set_global_assignment -name SIGNALTAP_FILE ${PROJECT_NAME}.stp set_global_assignment -name USE_SIGNALTAP_FILE ${PROJECT_NAME}.stp - + set_location_assignment PIN_V11 -to FPGA_CLK1_50 set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to FPGA_CLK1_50 set_location_assignment PIN_Y13 -to FPGA_CLK2_50 @@ -91,7 +91,7 @@ if {$make_assignments} { set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[6] set_location_assignment PIN_AA23 -to LED[7] set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[7] - + for {set i 0} {$i < 32} {incr i} { set_instance_assignment -name IO_STANDARD "SSTL-15 CLASS I" -to HPS_DDR3_DQ[$i] set_instance_assignment -name INPUT_TERMINATION "PARALLEL 50 OHM WITH CALIBRATION" -to HPS_DDR3_DQ[$i] -tag __hps_sdram_p0 @@ -161,13 +161,13 @@ if {$make_assignments} { set_instance_assignment -name PACKAGE_SKEW_COMPENSATION OFF -to HPS_DDR3_RESET_N -tag __hps_sdram_p0 set_instance_assignment -name PACKAGE_SKEW_COMPENSATION OFF -to HPS_DDR3_CK_P -tag __hps_sdram_p0 set_instance_assignment -name PACKAGE_SKEW_COMPENSATION OFF -to HPS_DDR3_CK_N -tag __hps_sdram_p0 - + set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top # Commit assignments export_assignments - - load_package flow + + load_package flow execute_flow -compile # Close project diff --git a/vta/hardware/intel/scripts/de10_nano_top.v b/vta/vta-hw/hardware/intel/scripts/de10_nano_top.v similarity index 100% rename from vta/hardware/intel/scripts/de10_nano_top.v rename to vta/vta-hw/hardware/intel/scripts/de10_nano_top.v diff --git a/vta/hardware/intel/scripts/ip/vta/vta_hw.tcl b/vta/vta-hw/hardware/intel/scripts/ip/vta/vta_hw.tcl similarity index 100% rename from vta/hardware/intel/scripts/ip/vta/vta_hw.tcl rename to vta/vta-hw/hardware/intel/scripts/ip/vta/vta_hw.tcl diff --git a/vta/hardware/intel/scripts/set_attrs.py b/vta/vta-hw/hardware/intel/scripts/set_attrs.py similarity index 100% rename from vta/hardware/intel/scripts/set_attrs.py rename to vta/vta-hw/hardware/intel/scripts/set_attrs.py diff --git a/vta/hardware/intel/scripts/set_clocks.sdc b/vta/vta-hw/hardware/intel/scripts/set_clocks.sdc similarity index 100% rename from vta/hardware/intel/scripts/set_clocks.sdc rename to vta/vta-hw/hardware/intel/scripts/set_clocks.sdc diff --git a/vta/hardware/intel/scripts/soc_system.tcl b/vta/vta-hw/hardware/intel/scripts/soc_system.tcl similarity index 100% rename from vta/hardware/intel/scripts/soc_system.tcl rename to vta/vta-hw/hardware/intel/scripts/soc_system.tcl diff --git a/vta/hardware/xilinx/.gitignore b/vta/vta-hw/hardware/xilinx/.gitignore similarity index 100% rename from vta/hardware/xilinx/.gitignore rename to vta/vta-hw/hardware/xilinx/.gitignore diff --git a/vta/hardware/xilinx/Makefile b/vta/vta-hw/hardware/xilinx/Makefile similarity index 92% rename from vta/hardware/xilinx/Makefile rename to vta/vta-hw/hardware/xilinx/Makefile index 77d5d4413f6c..2651583bea33 100644 --- a/vta/hardware/xilinx/Makefile +++ b/vta/vta-hw/hardware/xilinx/Makefile @@ -17,8 +17,8 @@ # Directories ROOTDIR = $(CURDIR) -VTA_DIR = $(CURDIR)/../.. -BUILD_DIR = $(VTA_DIR)/build/hardware/xilinx +VTA_HW_DIR = $(CURDIR)/../.. +BUILD_DIR = $(VTA_HW_DIR)/build/hardware/xilinx SCRIPT_DIR = $(CURDIR)/scripts SRC_DIR = $(CURDIR)/src @@ -27,7 +27,7 @@ VIVADO_HLS = vivado_hls VIVADO = vivado # Process VTA JSON config -VTA_CONFIG := $(CURDIR)/../../config/vta_config.py +VTA_CONFIG := $(VTA_HW_DIR)/config/vta_config.py # Derive config name CONF := $(shell python ${VTA_CONFIG} --cfg-str) @@ -52,7 +52,7 @@ $(IP_PATH): $(SRC_DIR)/* $(VIVADO_HLS) \ -f $(SCRIPT_DIR)/hls.tcl \ -tclargs \ - $(VTA_DIR) \ + $(VTA_HW_DIR) \ ${VTA_CONFIG} $(BIT_PATH): $(IP_PATH) diff --git a/vta/hardware/xilinx/README.md b/vta/vta-hw/hardware/xilinx/README.md similarity index 94% rename from vta/hardware/xilinx/README.md rename to vta/vta-hw/hardware/xilinx/README.md index a49dae87cc3b..6d289cff0a6e 100644 --- a/vta/hardware/xilinx/README.md +++ b/vta/vta-hw/hardware/xilinx/README.md @@ -15,4 +15,4 @@ -Complete instructions on how to build custom FPGA hardware designs are available on the [TVM documentation webpage](https://docs.tvm.ai/vta/install.html#vta-fpga-toolchain-installation). \ No newline at end of file +Complete instructions on how to build custom FPGA hardware designs are available on the [TVM documentation webpage](https://docs.tvm.ai/vta/install.html#vta-fpga-toolchain-installation). diff --git a/vta/hardware/xilinx/scripts/hls.tcl b/vta/vta-hw/hardware/xilinx/scripts/hls.tcl similarity index 99% rename from vta/hardware/xilinx/scripts/hls.tcl rename to vta/vta-hw/hardware/xilinx/scripts/hls.tcl index f371d905113b..724bdbf2d2ac 100644 --- a/vta/hardware/xilinx/scripts/hls.tcl +++ b/vta/vta-hw/hardware/xilinx/scripts/hls.tcl @@ -5,9 +5,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/vta/hardware/xilinx/scripts/hsi.tcl b/vta/vta-hw/hardware/xilinx/scripts/hsi.tcl similarity index 99% rename from vta/hardware/xilinx/scripts/hsi.tcl rename to vta/vta-hw/hardware/xilinx/scripts/hsi.tcl index 509be7561955..712a7586aca2 100644 --- a/vta/hardware/xilinx/scripts/hsi.tcl +++ b/vta/vta-hw/hardware/xilinx/scripts/hsi.tcl @@ -5,9 +5,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/vta/hardware/xilinx/scripts/vivado.tcl b/vta/vta-hw/hardware/xilinx/scripts/vivado.tcl similarity index 99% rename from vta/hardware/xilinx/scripts/vivado.tcl rename to vta/vta-hw/hardware/xilinx/scripts/vivado.tcl index 3be575749c27..1f8f1dac2f0b 100644 --- a/vta/hardware/xilinx/scripts/vivado.tcl +++ b/vta/vta-hw/hardware/xilinx/scripts/vivado.tcl @@ -5,9 +5,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/vta/hardware/xilinx/sim/vta_test.cc b/vta/vta-hw/hardware/xilinx/sim/vta_test.cc similarity index 99% rename from vta/hardware/xilinx/sim/vta_test.cc rename to vta/vta-hw/hardware/xilinx/sim/vta_test.cc index b7f0b73b0ea4..90cef3a3c125 100644 --- a/vta/hardware/xilinx/sim/vta_test.cc +++ b/vta/vta-hw/hardware/xilinx/sim/vta_test.cc @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/vta/hardware/xilinx/src/vta.cc b/vta/vta-hw/hardware/xilinx/src/vta.cc similarity index 99% rename from vta/hardware/xilinx/src/vta.cc rename to vta/vta-hw/hardware/xilinx/src/vta.cc index fba9b4febcf8..d9fe6f111303 100644 --- a/vta/hardware/xilinx/src/vta.cc +++ b/vta/vta-hw/hardware/xilinx/src/vta.cc @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/vta/hardware/xilinx/src/vta.h b/vta/vta-hw/hardware/xilinx/src/vta.h similarity index 99% rename from vta/hardware/xilinx/src/vta.h rename to vta/vta-hw/hardware/xilinx/src/vta.h index d796e2265d4f..d4a2a2dd98f8 100644 --- a/vta/hardware/xilinx/src/vta.h +++ b/vta/vta-hw/hardware/xilinx/src/vta.h @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -32,7 +32,7 @@ #include /*! -* Define HLS stream depth +* Define HLS stream depth */ #define PRAGMA_SUB(x) _Pragma (#x) #define PRAGMA_HLS(x) PRAGMA_SUB(x) diff --git a/vta/include/vta/dpi/module.h b/vta/vta-hw/include/vta/dpi/module.h similarity index 100% rename from vta/include/vta/dpi/module.h rename to vta/vta-hw/include/vta/dpi/module.h diff --git a/vta/include/vta/dpi/tsim.h b/vta/vta-hw/include/vta/dpi/tsim.h similarity index 100% rename from vta/include/vta/dpi/tsim.h rename to vta/vta-hw/include/vta/dpi/tsim.h diff --git a/vta/include/vta/driver.h b/vta/vta-hw/include/vta/driver.h similarity index 100% rename from vta/include/vta/driver.h rename to vta/vta-hw/include/vta/driver.h diff --git a/vta/include/vta/hw_spec.h b/vta/vta-hw/include/vta/hw_spec.h similarity index 99% rename from vta/include/vta/hw_spec.h rename to vta/vta-hw/include/vta/hw_spec.h index 9751b2f137c8..2294ae90ffde 100644 --- a/vta/include/vta/hw_spec.h +++ b/vta/vta-hw/include/vta/hw_spec.h @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/vta/include/vta/sim_tlpp.h b/vta/vta-hw/include/vta/sim_tlpp.h similarity index 99% rename from vta/include/vta/sim_tlpp.h rename to vta/vta-hw/include/vta/sim_tlpp.h index 1e56c48cbb1e..531dceb09d5b 100644 --- a/vta/include/vta/sim_tlpp.h +++ b/vta/vta-hw/include/vta/sim_tlpp.h @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -49,7 +49,7 @@ class TlppVerify { /*! Return TlppVefiy class instance.*/ static TlppVerify *Global() { static TlppVerify Cls; return &Cls;} - /*! + /*! * \brief Loop to process instruction and verify tlpp logic. * \param run_function function pointer to excute instruction . * \param fsim_handle class pointer of function simulator class Device. diff --git a/vta/src/de10nano/cma_api.cc b/vta/vta-hw/src/de10nano/cma_api.cc similarity index 100% rename from vta/src/de10nano/cma_api.cc rename to vta/vta-hw/src/de10nano/cma_api.cc diff --git a/vta/src/de10nano/cma_api.h b/vta/vta-hw/src/de10nano/cma_api.h similarity index 100% rename from vta/src/de10nano/cma_api.h rename to vta/vta-hw/src/de10nano/cma_api.h diff --git a/vta/src/de10nano/de10nano_driver.cc b/vta/vta-hw/src/de10nano/de10nano_driver.cc similarity index 100% rename from vta/src/de10nano/de10nano_driver.cc rename to vta/vta-hw/src/de10nano/de10nano_driver.cc diff --git a/vta/src/de10nano/de10nano_driver.h b/vta/vta-hw/src/de10nano/de10nano_driver.h similarity index 100% rename from vta/src/de10nano/de10nano_driver.h rename to vta/vta-hw/src/de10nano/de10nano_driver.h diff --git a/vta/src/de10nano/de10nano_mgr.h b/vta/vta-hw/src/de10nano/de10nano_mgr.h similarity index 100% rename from vta/src/de10nano/de10nano_mgr.h rename to vta/vta-hw/src/de10nano/de10nano_mgr.h diff --git a/vta/src/dpi/module.cc b/vta/vta-hw/src/dpi/module.cc similarity index 100% rename from vta/src/dpi/module.cc rename to vta/vta-hw/src/dpi/module.cc diff --git a/vta/src/pynq/pynq_driver.cc b/vta/vta-hw/src/pynq/pynq_driver.cc similarity index 100% rename from vta/src/pynq/pynq_driver.cc rename to vta/vta-hw/src/pynq/pynq_driver.cc diff --git a/vta/src/pynq/pynq_driver.h b/vta/vta-hw/src/pynq/pynq_driver.h similarity index 100% rename from vta/src/pynq/pynq_driver.h rename to vta/vta-hw/src/pynq/pynq_driver.h diff --git a/vta/src/sim/sim_driver.cc b/vta/vta-hw/src/sim/sim_driver.cc similarity index 100% rename from vta/src/sim/sim_driver.cc rename to vta/vta-hw/src/sim/sim_driver.cc diff --git a/vta/src/sim/sim_tlpp.cc b/vta/vta-hw/src/sim/sim_tlpp.cc similarity index 100% rename from vta/src/sim/sim_tlpp.cc rename to vta/vta-hw/src/sim/sim_tlpp.cc diff --git a/vta/src/tsim/tsim_driver.cc b/vta/vta-hw/src/tsim/tsim_driver.cc similarity index 100% rename from vta/src/tsim/tsim_driver.cc rename to vta/vta-hw/src/tsim/tsim_driver.cc diff --git a/vta/src/vmem/virtual_memory.cc b/vta/vta-hw/src/vmem/virtual_memory.cc similarity index 100% rename from vta/src/vmem/virtual_memory.cc rename to vta/vta-hw/src/vmem/virtual_memory.cc diff --git a/vta/src/vmem/virtual_memory.h b/vta/vta-hw/src/vmem/virtual_memory.h similarity index 100% rename from vta/src/vmem/virtual_memory.h rename to vta/vta-hw/src/vmem/virtual_memory.h diff --git a/vta/tests/hardware/common/test_lib.cc b/vta/vta-hw/tests/hardware/common/test_lib.cc similarity index 99% rename from vta/tests/hardware/common/test_lib.cc rename to vta/vta-hw/tests/hardware/common/test_lib.cc index 7c47c2c3e012..ae4adf91d7db 100644 --- a/vta/tests/hardware/common/test_lib.cc +++ b/vta/vta-hw/tests/hardware/common/test_lib.cc @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/vta/tests/hardware/common/test_lib.h b/vta/vta-hw/tests/hardware/common/test_lib.h similarity index 99% rename from vta/tests/hardware/common/test_lib.h rename to vta/vta-hw/tests/hardware/common/test_lib.h index e4ba9c9944fb..f1dbdc807fcf 100644 --- a/vta/tests/hardware/common/test_lib.h +++ b/vta/vta-hw/tests/hardware/common/test_lib.h @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/vta/tests/hardware/metal_test/Makefile b/vta/vta-hw/tests/hardware/metal_test/Makefile similarity index 100% rename from vta/tests/hardware/metal_test/Makefile rename to vta/vta-hw/tests/hardware/metal_test/Makefile diff --git a/vta/tests/hardware/metal_test/metal_test.cc b/vta/vta-hw/tests/hardware/metal_test/metal_test.cc similarity index 100% rename from vta/tests/hardware/metal_test/metal_test.cc rename to vta/vta-hw/tests/hardware/metal_test/metal_test.cc