• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

c4e_mpvec.h (Version 579)

Go to the documentation of this file.
00001 /****************************** -*- mode: C -*- ******************************/
00013 #ifndef C4E_MPVEC_H
00014 #define C4E_MPVEC_H
00015 
00016 
00017 /* INCLUDES ******************************************************************/
00018 
00019 #include "c4e_sys.h"
00020 
00021 
00022 #ifdef  __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 
00027 /* TYPEDEFS ******************************************************************/
00028 
00029 
00030 /* DEFINES *******************************************************************/
00031 
00032 
00033 /* MACROS ********************************************************************/
00034 
00035 
00036 /* MACRO *********************************************************************/
00050 #define C4E_MPVEC_DIGIT_MAC(a, b, y, carry)                                    \
00051     do                                                                         \
00052     {                                                                          \
00053         C4eArchDigit2 tmp_ = C4E_ARCH_DIGIT2_ADD(C4E_ARCH_DIGIT2_MUL((a), (b)), \
00054                                                 (y), C4E_SYS_DIGIT_ZERO);      \
00055         (carry) = C4E_ARCH_DIGIT2_MSD(tmp_);                                   \
00056         (y) = C4E_ARCH_DIGIT2_LSD(tmp_);                                       \
00057     } while(C4E_FALSE)
00058 
00059 
00060 
00061 
00062 #ifdef C4E_CONFIG_ENABLE_COMBA /* MAC operations for Comba multiplication */
00063 
00064 /* MACRO *********************************************************************/
00076 #define C4E_MPVEC_MAC_DECL(mac)     C4eArchMac mac
00077 
00078 
00079 
00080 /* MACRO *********************************************************************/
00097 #define C4E_MPVEC_MAC_INIT(mac)     C4E_MPVEC_MAC_DECL(mac) =   \
00098     {                                                           \
00099         .acc = (C4eArchDigit2)C4E_SYS_DIGIT_ZERO,               \
00100         .cy = C4E_SYS_DIGIT_ZERO                                \
00101     }
00102 
00103 
00104 
00105 /* MACRO *********************************************************************/
00122 #define C4E_MPVEC_MAC_DIGIT(mac) C4E_ARCH_DIGIT2_LSD((mac).acc)
00123 
00124 
00125 
00126 /* MACRO *********************************************************************/
00139 #define C4E_MPVEC_MAC_ADD(mac, val)             \
00140     do                                          \
00141     {                                           \
00142         C4eArchDigit2 _tmp = (mac).acc;         \
00143         (mac).acc += val;                       \
00144                                                 \
00145         if ((mac).acc < _tmp)  /* overflow? */  \
00146         {                                       \
00147             ++(mac).cy;                         \
00148         }                                       \
00149     }                                           \
00150     while (C4E_FALSE)
00151 
00152 
00153 
00154 /* MACRO *********************************************************************/
00169 #define C4E_MPVEC_MAC_OP(mac, a, b)                             \
00170     C4E_MPVEC_MAC_ADD((mac), C4E_ARCH_DIGIT2_MUL((a), (b)))
00171 
00172 
00173 
00174 #endif /* C4E_CONFIG_ENABLE_COMBA */
00175 
00176 
00177 
00178 /* PROTOTYPES ****************************************************************/
00179 
00180 
00181 /* FUNCTION ******************************************************************/
00202     C4eArchDigit c4e_mpvec_add(C4E_CONST C4eArchDigit* pa,
00203                                C4E_CONST C4eArchDigit* pb,
00204                                C4eArchIdx len, C4eArchDigit* py);
00205 
00206 
00207 /* FUNCTION ******************************************************************/
00229     C4eArchDigit c4e_mpvec_cyadd(C4eArchDigit carry,
00230                                  C4E_CONST C4eArchDigit* px,
00231                                  C4eArchIdx len, C4eArchDigit* py);
00232 
00233 
00234 /* FUNCTION ******************************************************************/
00249     C4eArchDigit c4e_mpvec_cyacc(C4eArchDigit carry, C4eArchIdx len,
00250                                  C4eArchDigit* pxy);
00251 
00252 
00253 /* FUNCTION ******************************************************************/
00275     C4eArchDigit c4e_mpvec_sub(C4E_CONST C4eArchDigit* pa,
00276                                C4E_CONST C4eArchDigit* pb,
00277                                C4eArchIdx len, C4eArchDigit* py);
00278 
00279 
00280 /* FUNCTION ******************************************************************/
00301     C4eArchDigit c4e_mpvec_cysub(C4eArchDigit borrow,
00302                                  C4E_CONST C4eArchDigit* px,
00303                                  C4eArchIdx len, C4eArchDigit* py);
00304 
00305 
00306 /* FUNCTION ******************************************************************/
00325     C4eArchDigit c4e_mpvec_cpl(C4eArchDigit borrow,
00326                                C4E_CONST C4eArchDigit* px,
00327                                C4eArchIdx len, C4eArchDigit* py);
00328 
00329 
00330 
00331 /* FUNCTION ******************************************************************/
00346     C4eArchDigit c4e_mpvec_muladd(C4eArchDigit digit,
00347                                   C4E_CONST C4eArchDigit* px,
00348                                   C4eArchIdx len, C4eArchDigit* py);
00349 
00350 
00351 /* FUNCTION ******************************************************************/
00371     C4eArchDigit c4e_mpvec_dblmuladd(C4eArchDigit digit,
00372                                      C4E_CONST C4eArchDigit* px,
00373                                      C4eArchIdx len, C4eArchDigit* py);
00374 
00375 
00376 /* FUNCTION ******************************************************************/
00392     C4eArchDigit c4e_mpvec_mulsub(C4eArchDigit digit,
00393                                   C4E_CONST C4eArchDigit* px,
00394                                   C4eArchIdx len, C4eArchDigit* py);
00395 
00396 /* FUNCTION ******************************************************************/
00414     C4eArchDigit c4e_mpvec_sqr(C4E_CONST C4eArchDigit* px,
00415                                C4eArchIdx len, C4eArchDigit* py);
00416 
00417 
00418 #ifdef C4E_CONFIG_ENABLE_COMBA
00419 
00420 /* FUNCTION ******************************************************************/
00440     C4eArchDigit c4e_mpvec_imac(C4E_MPVEC_MAC_DECL(*mac),
00441                                 C4E_CONST C4eArchDigit* pUp,
00442                                 C4E_CONST C4eArchDigit* pDown,
00443                                 C4eArchIdx len);
00444 
00445 
00446 /* FUNCTION ******************************************************************/
00466     C4eArchDigit c4e_mpvec_dblimac(C4E_MPVEC_MAC_DECL(*mac),
00467                                    C4E_CONST C4eArchDigit* pUp,
00468                                    C4E_CONST C4eArchDigit* pDown,
00469                                    C4eArchIdx len);
00470 
00471 #endif /* C4E_CONFIG_ENABLE_COMBA */
00472 
00473 
00474 
00475 #ifdef  __cplusplus
00476 }
00477 #endif
00478 
00479 
00480 #endif /* C4E_MPVEC_H */
00481 
00482 
00483 /******************************************************************************/
00484 /* END OF FILE                                                                */
00485 /******************************************************************************/
00486 

Generated by Ralf Hoppe, Ginsterweg 49, 73230 Kirchheim unter Teck, Germany
on Sun Jun 7 14:10:49 2015 for CRY4E using doxygen 1.6.1