2022-02-17 20:22:12 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright 2022 Camille "DrasLorus" Monière.
|
|
|
|
*
|
|
|
|
* This file is part of CORDIC_Rotate_APFX.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License along with this program.
|
|
|
|
* If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
2022-02-11 18:17:13 +01:00
|
|
|
|
2022-02-18 21:33:59 +01:00
|
|
|
#ifndef C_CORDIC_ROTATE_ROM_TEMPLATE
|
|
|
|
#define C_CORDIC_ROTATE_ROM_TEMPLATE
|
|
|
|
|
|
|
|
enum rom_types {
|
2022-03-14 14:07:10 +01:00
|
|
|
ml,
|
2022-02-18 21:33:59 +01:00
|
|
|
cst
|
|
|
|
};
|
|
|
|
|
2022-03-14 14:07:10 +01:00
|
|
|
template <unsigned TIn_I, rom_types type, unsigned TIn_W, unsigned Tnb_stages, unsigned Tq, unsigned divider = 2>
|
2022-02-18 21:33:59 +01:00
|
|
|
class CCordicRotateRom {
|
|
|
|
static_assert(TIn_W > 0, "Inputs can't be on zero bits.");
|
|
|
|
static_assert(Tnb_stages < 8, "7 stages of CORDIC is the maximum supported.");
|
|
|
|
static_assert(Tnb_stages > 1, "2 stages of CORDIC is the minimum.");
|
2022-03-14 14:07:10 +01:00
|
|
|
static_assert(((divider - 1) & divider) == 0, "divider must be a power of 2.");
|
2022-02-18 21:33:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // C_CORDIC_ROTATE_ROM_TEMPLATE
|