A VHDL library for using the Redundant Residue Number System (RRNS). RNS (without the initial R) is an alternative number system that uses residues (remainders) of divisions by different moduli (divisors) to represent numbers. By adding more moduli without increasing the dynamic range of possible numbers, errors can be detected.
The main library requires full support of VHDL-2008, especially its feature of unconstrained record types.
This library supports:
- Unsigned integer, signed integer, and signed fixed-point numbers
- Conversion from and to conventional binary
- RRNS Addition, Subtraction, and Multiplication
- Integrity checking of the RRNS numbers
- Two moduli sets with one or two redundant moduli
The VHDL library can be found in the rtl
directory.
For this example add them to your synthesis project with the library set to rrns_arith_lib
.
To use the library in VHDL, use the following library use clause:
library rrns_arith_lib;
use rrns_arith_lib.rrns_arith_lib.all;
A full usage example can be found in the examples
folder.
The conventional binary numbers are of the standard IEEE types unsigned
or signed
for which the according libraries have to be included:
library ieee;
use ieee.numeric_std.all;
To use the signed fixed-point number data types, the standard IEEE library fixed_pkg
has to be used:
library ieee;
use ieee.fixed_pkg.all;
To create the library documentation install Doxygen.
Then change into the docs
directory and call:
doxygen Doxyfile
The documentation will then be generated in the same directory.
Read the HTML documentation by opening html/index.html
in your browser or generate the LaTeX version by calling make
in the latex
directory.
The unit tests are prepared in the testbenches
directory.
They are run using the Python-based VUnit test framework.
- Install VUnit using the guide on the VUnit website.
- Install a simulator that supports VHDL-2008 and is supported by VUnit.
- Run the following command on the top level directory of the repository:
python3 run_unit_tests.py
Please cite the ISFPGA25 abstract when using this library in scientific works: https://doi.org/10.1145/3706628.3708847
Please create an Issue in this repository.
The library is licensed under the CERN-OHL-P v2. Read the LICENSE file for more information.