/* * Copyright 2012-15 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD *
*/
/* * @brief * Arithmetic operations on real numbers * represented as fixed-point numbers. * There are: 1 bit for sign, * 31 bit for integer part, * 32 bits for fractional part. * * @note * Currently, overflows and underflows are asserted; * no special result returned.
*/
/* * @brief * result = reciprocal(arg) := 1 / arg * * @note * No special actions taken in case argument is zero.
*/ struct fixed31_32 dc_fixpt_recip(struct fixed31_32 arg);
/* * @brief * result = sin(arg) * * @note * Argument specified in radians, * internally it's normalized to [-2pi...2pi] range.
*/ struct fixed31_32 dc_fixpt_sin(struct fixed31_32 arg);
/* * @brief * result = cos(arg) * * @note * Argument specified in radians * and should be in [-2pi...2pi] range - * passing arguments outside that range * will cause incorrect result!
*/ struct fixed31_32 dc_fixpt_cos(struct fixed31_32 arg);
/* * @brief * Transcendent functions
*/
/* * @brief * result = exp(arg) * * @note * Currently, function is verified for abs(arg) <= 1.
*/ struct fixed31_32 dc_fixpt_exp(struct fixed31_32 arg);
/* * @brief * result = log(arg) * * @note * Currently, abs(arg) should be less than 1. * No normalization is done. * Currently, no special actions taken * in case of invalid argument(s). Take care!
*/ struct fixed31_32 dc_fixpt_log(struct fixed31_32 arg);
/* * @brief * Power function
*/
/* * @brief * result = pow(arg1, arg2) * * @note * Currently, abs(arg1) should be less than 1. Take care!
*/ staticinlinestruct fixed31_32 dc_fixpt_pow(struct fixed31_32 arg1, struct fixed31_32 arg2)
{ if (arg1.value == 0) return arg2.value == 0 ? dc_fixpt_one : dc_fixpt_zero;
/* the following two function are used in scaler hw programming to convert fixed * point value to format 2 bits from integer part and 19 bits from fractional * part. The same applies for u0d19, 0 bits from integer part and 19 bits from * fractional
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.