#include <L1Trigger/L1TCalorimeter/src/firmware/CordicXilinx.cc>
Public Member Functions | |
CordicXilinx (int inputBits, int outputBits, bool debug=false) | |
int | encodeAngle (const double angleFloat) const |
void | operator() (int32_t xInput, int32_t yInput, int32_t &aPhi, uint32_t &aMagnitude) const |
Private Types | |
enum | { Pi, HalfPi, NHalfPi } |
Private Attributes | |
const bool | debug_ |
std::array< int, 3 > | encodedAngles_ |
const int | inputBits_ |
int | internalBits_ |
int | iterations_ |
const int | outputBits_ |
std::vector< int > | rotations_ |
int | scaleFactor_ |
Description: Emulates parts of the Xilinx DSP IP CORDIC routine, as described in http://www.xilinx.com/support/documentation/ip_documentation/cordic/v6_0/pg105-cordic.pdf This class only implements the vector translation, returning magnitude and phase, given signed x and y inputs. The inputs and outputs are not packed, so that normal signed integer arithmetic works as expected. They can easily be packed into a fixed width by abs() and placing a sign bit at the appropriate offset. The applicable configuration parameters that are being emulated are the following:
Tests: Full circle at various magnitudes, including maximum; a few billion random inputs Limited hardware comparisons have shown agreement as well. Test framework: https://github.com/nsmith-/cordic_test
Original Author: Nick Smith ( nick. ) smit h@cer n.ch
Definition at line 8 of file CordicXilinx.h.
|
private |
Enumerator | |
---|---|
Pi | |
HalfPi | |
NHalfPi |
Definition at line 30 of file CordicXilinx.h.
CordicXilinx::CordicXilinx | ( | int | inputBits, |
int | outputBits, | ||
bool | debug = false |
||
) |
Definition at line 34 of file CordicXilinx.cc.
References debug_, encodeAngle(), encodedAngles_, HalfPi, i, internalBits_, iterations_, dqm-mbProfile::log, M_PI, NHalfPi, Pi, funct::pow(), idealTransformation::rotation, rotations_, and scaleFactor_.
int CordicXilinx::encodeAngle | ( | const double | angleFloat | ) | const |
Definition at line 61 of file CordicXilinx.cc.
References assert(), internalBits_, M_PI, and funct::pow().
Referenced by CordicXilinx().
void CordicXilinx::operator() | ( | int32_t | xInput, |
int32_t | yInput, | ||
int32_t & | aPhi, | ||
uint32_t & | aMagnitude | ||
) | const |
Definition at line 68 of file CordicXilinx.cc.
References funct::abs(), assert(), gather_cfg::cout, debug_, encodedAngles_, HalfPi, i, inputBits_, internalBits_, iterations_, NHalfPi, outputBits_, Pi, funct::pow(), idealTransformation::rotation, rotations_, scaleFactor_, jetcorrextractor::sign(), x, and y.
|
private |
Definition at line 25 of file CordicXilinx.h.
Referenced by CordicXilinx(), and operator()().
|
private |
Definition at line 29 of file CordicXilinx.h.
Referenced by CordicXilinx(), and operator()().
|
private |
Definition at line 23 of file CordicXilinx.h.
Referenced by operator()().
|
private |
Definition at line 32 of file CordicXilinx.h.
Referenced by CordicXilinx(), encodeAngle(), and operator()().
|
private |
Definition at line 31 of file CordicXilinx.h.
Referenced by CordicXilinx(), and operator()().
|
private |
Definition at line 24 of file CordicXilinx.h.
Referenced by operator()().
|
private |
Definition at line 27 of file CordicXilinx.h.
Referenced by CordicXilinx(), and operator()().
|
private |
Definition at line 33 of file CordicXilinx.h.
Referenced by CordicXilinx(), and operator()().