A free way to implement a CORDIC-based Complex Absolute Value using HLS, with bit-accurate precision.
Find a file
DrasLorus d9f80fc165
Enable support of GNU v4.6 and (consequently) of Vivado HLS 2019.1
- Also disable TCL unit COSIM test. Can be enable by turning 'true' to
  false in the CMakeLists,
- v4.6 doesn't support C++14, nor some C++11, so some hacky ways have
  been found. Unit test has been updated but still works and coverage is
  good (94%, the 6% beeing exeption handling, unrelevant in HLS).
2022-05-16 19:02:23 +02:00
.github First Working and tested release 2022-04-13 19:38:34 +02:00
data First Working and tested release 2022-04-13 19:38:34 +02:00
hls_files/cordicabs_16_4_6 Enable support of GNU v4.6 and (consequently) of Vivado HLS 2019.1 2022-05-16 19:02:23 +02:00
sources Enable support of GNU v4.6 and (consequently) of Vivado HLS 2019.1 2022-05-16 19:02:23 +02:00
.clang-format First Working and tested release 2022-04-13 19:38:34 +02:00
.gitignore Finalize a top level IP 2022-04-15 18:59:42 +02:00
cmake_format_conf.py First Working and tested release 2022-04-13 19:38:34 +02:00
CMakeLists.txt Enable support of GNU v4.6 and (consequently) of Vivado HLS 2019.1 2022-05-16 19:02:23 +02:00
lgpl-3.0.md First Working and tested release 2022-04-13 19:38:34 +02:00
LICENSE First Working and tested release 2022-04-13 19:38:34 +02:00
README.md Update README.md 2022-04-21 15:48:37 +02:00

CORDIC Abs APFX

CMakeDocker

A free way to implement a CORDIC-based Complex Absolute Value using HLS, with bit-accurate precision.

Goal

CORDIC (COordinate Rotation DIgital Computer) is an efficient way to implement hardware complex rotations (e.g. z * exp(jw), with z = x + jy a complex and w a real angle). It also can be used to approximate the module of a complex. It is also useful for microcontrollers or microprocessors lacking floating-point units, as such multiplications can consume a noticeable amount of CPU cycles.

Indeed, |z| = sqrt(x² + y²) = |exp(-j*angle(z)) * z|, thus the module of z is the absolute value of the real part of its rotated version. So, ... CORDIC!

This implementation in C++14 (-std=c++14) is suitable for hardware simulation and (with the right headers and maybe a few tweaks) for synthesis.

This repository defines one working CORDIC-based Absolute Value units class, CCordicAbs.

Test suite and dependencies

The Catch2 test framework has been used in conjunction with CTest to provides unit tests.

  • Has been tested successfully compiled with:
    • GNU GCC 6.2 (Xilinx bundled version), 6.5, 9.4, 10.1, 10.2 and 11.2,
    • LLVM Clang 12.0 and 13.0,
  • Uses Catch v2.13.7,
  • Depends on Xilinx HLS arbitrary precision types, available as FOSS here provided by Xilinx or here patched by myself. Note: Xilinx also provides proprietary versions of those headers, suitable for synthesis and implementation, bundled with their products.

A Xilinx C++ HLS testbench is also available, as well as a TCL script to run simulation, synthesis, co-simulation and IP export and implementation if wanted. Xilinx HLS v2020.2 can be directly called from CMake by the target run_hls if the options ENABLE_TESTING, ENABLE_XILINX and COSIM_XILINX are enabled. If CMake feels like black magic, It is advice to use tools like ccmake (NCurses terminal interface to cmake) or cmake-gui.

Copyright 2022 Camille "DrasLorus" Monière.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

A copy of the license is available here in Markdown or here in plain text.