30 double xlp_add_exper(
const WORD_T ma,
const WORD_T mb,
const WORD_T mc,
const WORD_T word_size);
31 double xlc_add(
const WORD_T ma,
const WORD_T mb,
const WORD_T mc,
const WORD_T word_size);
32 int xlc_add_sign(
const WORD_T ma,
const WORD_T mb,
const WORD_T mc,
const WORD_T word_size);
33 double xlp_add(
const WORD_T ma,
const WORD_T mb,
const WORD_T mc,
const WORD_T word_size);
34 double xlb_add(
const WORD_T ma,
const WORD_T mb,
const WORD_T mc,
const WORD_T word_size);
41 inline WORD_T
get_masks_rev_ibit(
const WORD_T ma,
const WORD_T mb,
const WORD_T mc,
const WORD_T word_size,
const WORD_T ibit)
43 WORD_T i = (word_size - ibit - 1);
47 return (((mc >> i) & 1) << 2) | (((mb >> i) & 1) << 1) | (((ma >> i) & 1) << 0);
54 inline double xlc_add(
const WORD_T ma,
const WORD_T mb,
const WORD_T mc,
const WORD_T word_size)
57 assert(word_size > 0);
60 printf(
"[%s:%d] Enter %s() %X %X %X %d\n", __FILE__, __LINE__, __FUNCTION__,
61 ma, mb, mc, word_size);
62 #endif // #if 1 // DEBUG
72 #endif // #if 1 // DEBUG
80 while(ibit < word_size) {
82 const WORD_T index = ibit;
88 printf(
"[%s:%d] ibit %d masks %X %X %X | word %X S %X\n", __FILE__, __LINE__, index, ma, mb, mc, word, S[index]);
91 #endif // #if 0 // DEBUG
97 assert(ibit == index);
104 w = w + (cnt_b7 >> 1);
110 assert((state == 0) || (state == 1));
122 if((S_index == 1) || (S_index == 2) || (S_index == 4)) {
128 assert((state == 0) || (state == 1));
133 if((S_index == 3) || (S_index == 5) || (S_index == 6)) {
150 double corr_abs = 0.0;
152 corr_abs = pow(2, -64);
154 corr_abs = (double) 1.0 / (
double)(1ULL << w);
158 printf(
"[%s:%d] Exit %s() %X %X %X %d %4.2f\n", __FILE__, __LINE__, __FUNCTION__,
159 ma, mb, mc, word_size, corr_abs);
160 #endif // #if 1 // DEBUG
191 inline int xlc_add_log2(
const uint32_t ma,
const uint32_t mb,
const uint32_t mc,
const uint32_t word_size)
194 assert(word_size > 0);
200 while (ibit < word_size)
202 const uint32_t index = ibit;
225 assert((state == 0) || (state == 1));
245 w = w - (cnt_b7 >> 1);
254 assert((state == 0) || (state == 1));
258 fprintf(stderr,
"-- S_index should never be %u. Exiting...\n", S_index);
267 #endif // #ifndef XLP_ADD_H
double xlp_add_exper(const WORD_T ma, const WORD_T mb, const WORD_T mc, const WORD_T word_size)
Definition: xlp-add.cc:54
int xlc_add_sign(const WORD_T ma, const WORD_T mb, const WORD_T mc, const WORD_T word_size)
Definition: xlp-add.cc:249
double xlc_add(const WORD_T ma, const WORD_T mb, const WORD_T mc, const WORD_T word_size)
Definition: xlp-add.hh:54
#define WORD_SIZE
Definition: common.hh:119
double xlb_add(const WORD_T ma, const WORD_T mb, const WORD_T mc, const WORD_T word_size)
Definition: xlp-add.cc:319
int xlc_add_log2(const uint32_t ma, const uint32_t mb, const uint32_t mc, const uint32_t word_size)
Definition: xlp-add.hh:191
WORD_T get_masks_rev_ibit(const WORD_T ma, const WORD_T mb, const WORD_T mc, const WORD_T word_size, const WORD_T ibit)
Definition: xlp-add.hh:41
double xlp_add(const WORD_T ma, const WORD_T mb, const WORD_T mc, const WORD_T word_size)
Definition: xlp-add.cc:287
void print_binary(const uint64_t n)
Definition: common.cc:218