Commit Graph
23 Commits
Author SHA1 Message Date
Wade Fife 79add58c25 fpga: tools: Add UHD_FPGA_DIR definition to synthesis
This adds a Verilog definition named `UHD_FPGA_DIR that corresponds to
the location of the UHD "fpga" directory. This allows you to include
files in your out-of-tree modules relative to the FPGA directory. For
example, you could include the library header file rfnoc_chdr_utils.vh
using the following:

`include `"`UHD_FPGA_DIR/usrp3/lib/rfnoc/core/rfnoc_chdr_utils.vh`"

Some simulators may not support `" outside of the context of a `define,
in which case you can do the following:

`define RFNOC_CHDR_UTILS_PATH \
  `"`UHD_FPGA_DIR/usrp3/lib/rfnoc/core/rfnoc_chdr_utils.vh`"
`include `RFNOC_CHDR_UTILS_PATH


Original-commit: 66267f515802ff3f965fd44e1f0d3097ada7484f
2021-09-08 08:36:05 -05:00
Martin Braun 13633dd543 fpga: Fix Xilinx bitfile parser for Python 3
The script was previously only Python 2 compatible.

Python 2 support is now removed, so we don't maintain backwards
compatibility with Python 2.

This also fixes all linter warnings.


Original-commit: 6046e1a812ba2065d6ae13b4c4afdce8abc99d4f
2021-08-24 09:45:36 -05:00
Wade Fife bdc67122b8 fpga: tools: Detect assertions in ModelSim simulation
This change allows assertion errors/failures in ModelSim to be
detected and causes ModelSim to return a non-zero value when such
an assertion error occurs. This allows the return value of ModelSim
to be used to determine whether or not the testbench passed.


Original-commit: 574146ec8909da367c3441189c2877a287892f7e
2021-06-17 08:16:59 -05:00
Wade Fife d37cc533a7 fpga: tools: Put SIM_SRCS at end of compile order
VHDL depends on the compile order. This commit changes the order so
that SIM_SRCS are compiled last with ModelSim to avoid issues with
dependencies.


Original-commit: b85b796cbc1f897a69ded1f3ecfba8ec92684c11
2021-06-17 08:16:59 -05:00
Wade Fife 4baf8139c8 fpga: tools: Add modelsim.ini to ModelSim calls
This adds the MSIM_VIV_COMPLIBDIR environment variable to specify
a non-default location for the compilation libraries.

This also allows a modelsim.ini other than the one in the ModelSim
installation folder to be used. By default, the one in the simulation
libraries compilation directory will be used. This can be changed by
setting MSIM_MODELSIM_INI to the one you want to use, or set it to an
empty string to use the one in the ModelSim installation folder.


Original-commit: 08473776b28a949027ec8cf2596d8d1b438b979b
2021-06-17 08:16:59 -05:00
Sam O'Brien 235703e806 fpga: tools: Fix part selection in setupenv
The script setupenv_base.sh, which is used to setup the development
environmnet in the open source toolchain, adds some functions to the
shell that are used to interact with vivado. Some of the functions were
looking in the wrong argument for the product name. This commit fixes
the bug.

In addition, supplying an incorrect part name returned a rather opaque
error message. This commit also fixes the error handling so that the
intended error message is displayed.

Signed-off-by: Sam O'Brien <sam.obrien@ni.com>


Original-commit: 471de61e4d9e53a038942f21f61d4b481b5f9853
2021-06-10 08:33:22 -05:00
Wade Fife d6397f8f5e fpga: tools: Add ability to run commands before route
Original-commit: a617ff132fef4a28370d8b10b42463a459d44f6b
2021-06-03 10:22:04 -05:00
Wade Fife cfb4ba7f0b fpga: tools: Add ability to patch IP during generation
This adds the ability to call BUILD_VIVADO_IP, as before, followed by
REBUILD_VIVADO_IP_WITH_PATCH to patch a file generated by the IP and
then rebuild the IP with the patched file.


Original-commit: 78315eca698333ad4dc32818e24c7bf6a740c0cb
2021-06-03 10:22:04 -05:00
Humberto Jimenez ad6b7bdee8 fpga: tools: Add support for RFSoC
This commit includes the following changes to the tools:
- Change part definition in XCI and BD editors for the RFSoC family
- Resolve part name in Vivado IP management utilities with
  viv_gen_part_id.py


Original-commit: fba23eb42c91ca1bc1108b5ba50c1b567cb9b59d
2021-06-03 10:22:04 -05:00
Martin Braun ec4fab0340 fpga: Remove Python2 support from build system
- 2to3 was used to convert the Python scripts, except where the tool
  choked and manual intervention was required
- All references to "python" where replaced with "python3"
- buffer() was replaced by memoryview()


Original-commit: ca68195b5d12c5410cfac8d459a0b0902c4c72c7
2021-01-04 13:28:36 -06:00
Wade Fife 5f792ad48e fpga: tools: Highlight suppressible errors from vlint
Original-commit: 5244c06ae71589a08f337371d91798a6ac3d292b
2020-06-29 13:41:15 -05:00
Wade Fife 7b1174ffd9 fpga: tools: Fix ModelSim return status
Original-commit: 05137529261bf9eae2a8b72cdf67e86a8ff96927
2020-06-18 15:26:07 -05:00
Wade Fife 76a1cfa60e fpga: tools: Improve detection of setupenv sourcing
This change allows detection of attempting to execute setupenv.sh
rather than sourcing it, which is required.


Original-commit: 6faec1d4a14a1af52681aabf19c9040dcee772ff
2020-05-28 15:11:29 -05:00
Wade Fife d3615aefe0 fpga: tools: Improve native ModelSim support
This adds support for colored output and support for directories added
to the list of source files (for HLS support).


Original-commit: 5b3d66e5b7cedb7098de3e4dbbee70af04a3626e
2020-05-26 13:36:55 -05:00
Wade Fife 98463e99d0 fpga: tools: Add contents of directories for HDL source
For HLS builds, the output file names aren't known in advance. This
makes it difficult to write the Makefile to pull in the files and pass
them to the build tools. This change allows you to add a directory as
your HDL source so that all files in the directory will be pulled in by
the build process.


Original-commit: 90933d9b2faf392fd26f3f7ca32f73719614a40a
2020-05-26 13:36:55 -05:00
Martin Braun 17bafa621e fpga: tools: Remove uhd_image_builder
The image builder was replaced by rfnoc_image_builder, and has been
obsolete since then.


Original-commit: 676c3a37867f0e19476e9dc8495127bb3208a1a0
2020-05-18 17:57:38 -05:00
Humberto Jimenez f5a79baba7 fpga: tools: Fix HLS IP build with Cygwin
Original-commit: be252febd001feac093b36c987d276720e4244ab
2020-05-12 13:47:20 -05:00
Humberto Jimenez 9e946be598 fpga: tools: Option to check for full Vivado version
This commits enables the FPGA build infrastructure to require a very
specific Vivado version, all the way to the patch level.

Vivado typically has the following version format:
  Year.release.update_patch

This commit enables setupenv_base.sh to optionally look for the
environment variable VIVADO_VER_FULL, which should contain the
full Vivado version in the format specified above.
Vivado is directly used to retrieve the installed version, returning
an error if the requested version is not found.

Example in setupenv.sh (which calls setupenv_base.sh):

  VIVADO_VER=2019.1
  VIVADO_VER_FULL=2019.1.1_AR73068

The setupenv.sh script will setup Vivado 2019.1, but it will also
verify that both Update 1 and patch AR73068 are installed.


Original-commit: 932b7cbb040cef7fce0c83f81839722fd8ad5bdf
2020-04-14 10:43:51 -05:00
Paul Butler ce701301d0 fpga: tools: Add support for .sdc in Vivado
viv_utils.tcl will now read files with the .sdc suffix using the
read_xdc Vivado command. This is especially useful when I/O timing
constraints in the FPGA and CPLD need to depend on a common constant.


Original-commit: b47b1a467ee5796dbce359ff34c9d55a6acebc82
2020-04-02 08:13:35 -05:00
Wade Fife dcbc6a9c78 fpga: tools: Add default Vivado install location
Xilinx changed the default Vivado install location from /opt/Xilix to
/tools/Xilinx. This commit adds support for finding Vivado in either
the new location or the old location.


Original-commit: 156d714b8fb288100d242ea200ae1d1dcd6bcd57
2020-04-01 08:45:41 -05:00
Andrew Moch 09751b661e fpga: tools: Add modelsim to make sim targets
This adds a simulation make target that allows you to run ModelSim
natively rather than through Vivado.

Adds or modifies the following simulation make targets:
make vlint    - Brake up compilation to Verilog/SystemVerilog/VHDL
make modelsim - Depends on make vlint and invokes modelsim

Adds the following variables:
MODELSIM_ARGS - Added to invocation of ModelSim
SVLOG_ARGS    - Added to SystemVerilog invocation of vlog
VLOG_ARGS     - Added to Verilog invocation of vlog
VHDL_ARGS     - Added to VHDL invocation of vcom


Original-commit: b296b26053d4437b8ae97e3df415a3d041b7b51e
2020-03-20 10:34:59 -05:00
Humberto Jimenez 5367ec6006 fpga: tools: Ignore BD layout info for TCL-based BD
When using viv_modify_tcl_bd, two Vivado instances are open:
1. GUI-mode Vivado that opens a TCL-based BD for the user to edit.
2. Batch-mode Vivado that saves changes from (1) and rewrites the TCL
   source file.

During (2), the previous tool implementation was saving layout
information in the TCL source file. This layout info gets outdated
when the BD is reopened, because (1) regenerates the layout to provide
a clean BD diagram in the Vivado GUI.
Furthermore, each time the BD is open, the layout information will
vary due to Vivado's window size, thus creating untracked changes in
the source TCL file.

This commit removes the command option that requests Vivado to save
layout information.


Original-commit: feabc14cb5d5d26987d72b1a51638a83f8f39131
2020-03-12 10:33:24 -05:00
+18 6b67702ad7 Merge FPGA repository back into UHD repository
The FPGA codebase was removed from the UHD repository in 2014 to reduce
the size of the repository. However, over the last half-decade, the
split between the repositories has proven more burdensome than it has
been helpful. By merging the FPGA code back, it will be possible to
create atomic commits that touch both FPGA and UHD codebases. Continuous
integration testing is also simplified by merging the repositories,
because it was previously difficult to automatically derive the correct
UHD branch when testing a feature branch on the FPGA repository.

This commit also updates the license files and paths therein.

We are therefore merging the repositories again. Future development for
FPGA code will happen in the same repository as the UHD host code and
MPM code.

== Original Codebase and Rebasing ==

The original FPGA repository will be hosted for the foreseeable future
at its original local location: https://github.com/EttusResearch/fpga/

It can be used for bisecting, reference, and a more detailed history.

The final commit from said repository to be merged here is
05003794e2da61cabf64dd278c45685a7abad7ec. This commit is tagged as
v4.0.0.0-pre-uhd-merge.

If you have changes in the FPGA repository that you want to rebase onto
the UHD repository, simply run the following commands:

- Create a directory to store patches (this should be an empty
  directory):

    mkdir ~/patches

- Now make sure that your FPGA codebase is based on the same state as
  the code that was merged:

    cd src/fpga # Or wherever your FPGA code is stored
    git rebase v4.0.0.0-pre-uhd-merge

  Note: The rebase command may look slightly different depending on what
  exactly you're trying to rebase.

- Create a patch set for your changes versus v4.0.0.0-pre-uhd-merge:

    git format-patch v4.0.0.0-pre-uhd-merge -o ~/patches

  Note: Make sure that only patches are stored in your output directory.
  It should otherwise be empty. Make sure that you picked the correct
  range of commits, and only commits you wanted to rebase were exported
  as patch files.

- Go to the UHD repository and apply the patches:

    cd src/uhd # Or wherever your UHD repository is stored
    git am --directory fpga ~/patches/*
    rm -rf ~/patches # This is for cleanup

== Contributors ==

The following people have contributed mainly to these files (this list
is not complete):

Co-authored-by: Alex Williams <alex.williams@ni.com>
Co-authored-by: Andrej Rode <andrej.rode@ettus.com>
Co-authored-by: Ashish Chaudhari <ashish@ettus.com>
Co-authored-by: Ben Hilburn <ben.hilburn@ettus.com>
Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
Co-authored-by: Daniel Jepson <daniel.jepson@ni.com>
Co-authored-by: Derek Kozel <derek.kozel@ettus.com>
Co-authored-by: EJ Kreinar <ej@he360.com>
Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com>
Co-authored-by: Ian Buckley <ian.buckley@gmail.com>
Co-authored-by: Jörg Hofrichter <joerg.hofrichter@ni.com>
Co-authored-by: Jon Kiser <jon.kiser@ni.com>
Co-authored-by: Josh Blum <josh@joshknows.com>
Co-authored-by: Jonathon Pendlum <jonathan.pendlum@ettus.com>
Co-authored-by: Martin Braun <martin.braun@ettus.com>
Co-authored-by: Matt Ettus <matt@ettus.com>
Co-authored-by: Michael West <michael.west@ettus.com>
Co-authored-by: Moritz Fischer <moritz.fischer@ettus.com>
Co-authored-by: Nick Foster <nick@ettus.com>
Co-authored-by: Nicolas Cuervo <nicolas.cuervo@ettus.com>
Co-authored-by: Paul Butler <paul.butler@ni.com>
Co-authored-by: Paul David <paul.david@ettus.com>
Co-authored-by: Ryan Marlow <ryan.marlow@ettus.com>
Co-authored-by: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-authored-by: Sylvain Munaut <tnt@246tNt.com>
Co-authored-by: Trung Tran <trung.tran@ettus.com>
Co-authored-by: Vidush Vishwanath <vidush.vishwanath@ettus.com>
Co-authored-by: Wade Fife <wade.fife@ettus.com>


Original-commit: bafa9d95453387814ef25e6b6256ba8db2df612f
2020-01-28 09:35:36 -08:00