75 <<
"x: " <<
x <<
" y: " <<
y;
79 const ap_fixed<l1tmetemu::Et_t::width + 1, 3>
pi =
M_PI;
80 const ap_fixed<l1tmetemu::Et_t::width + 2, 3>
pi2 =
M_PI / 2.;
85 ap_uint<2> signx = (
x > 0) ? 2 : (
x == 0) ? 1 : 0;
86 ap_uint<2> signy = (
y > 0) ? 2 : (
y == 0) ? 1 : 0;
89 if (signy == 1 && signx == 2) {
93 }
else if (signy == 1 && signx == 0) {
95 ret_etmiss.
Phi = pistep;
97 }
else if (signy == 2 && signx == 1) {
99 ret_etmiss.
Phi = pi2step;
101 }
else if (signy == 0 && signx == 1) {
103 ret_etmiss.
Phi = -pi2step;
108 ap_fixed<Et_t::width + 1, Et_t::iwidth + 1, Et_t::qmode, Et_t::omode> absx, absy;
123 <<
"abs(x): " << absx.to_double() <<
" abs(y): " << absy.to_double();
127 ap_fixed<Et_t::width + 1, 2, Et_t::qmode, Et_t::omode> absx_sft, absy_sft;
129 absx_sft[
i] = absx[
i];
130 absy_sft[
i] = absy[
i];
135 <<
"\n=====Normalized input=====\n" 136 <<
"norm(abs(x)): " << absx_sft.to_double() <<
" norm(abs(y)): " << absy_sft.to_double();
140 ap_fixed<Et_t::width + 7, 3, Et_t::qmode, Et_t::omode> cx, cy, cphi;
153 <<
"\n=====CORDIC function arguments=====\n" 154 <<
"x: " << cx.to_double() <<
" y: " << cy.to_double() <<
" phi: " << cphi.to_double();
165 ap_fixed<Et_t::width, 3, Et_t::qmode, Et_t::omode> ophi;
166 if (signx == 0 && signy == 2) {
168 }
else if (signx == 0 && signy == 0) {
170 }
else if (signx == 2 && signy == 0) {
177 Et_t magnitude = ((ap_fixed<Et_t::width + Et_t::iwidth + 3 + 1, Et_t::iwidth, Et_t::qmode, Et_t::omode>)cx)
178 << (Et_t::iwidth + 1 - 2);
184 <<
"\n=====toPolar output=====\n" 185 << std::setprecision(8) <<
"magnitude: " << magnitude.to_double() <<
" phi: " << ophi.to_double()
187 <<
"Et: " << ret_etmiss.
Et.to_double() <<
" phi (int): " << ret_etmiss.
Phi.to_int() <<
"\n";
Log< level::Info, true > LogVerbatim
ap_int< kMETPhiSize > METWordphi_t
ap_fixed< kMETSize+kEtExtra, kMETMagSize+kEtExtra, AP_RND_CONV, AP_SAT > Et_t
std::vector< l1tmetemu::atan_lut_fixed_t > magNormalisationLUT
void cordic_subfunc(T &x, T &y, T &z) const
const double kStepMETwordPhi
ap_ufixed< kMETPhiSize+kEtExtra+7, kMETPhiSize - 2, AP_RND_CONV, AP_SAT > pi_bins_fixed_t