Commit cea540e6 authored by Kevin JOLY's avatar Kevin JOLY

Update MS flooded decoder

Use XOR to compute sign for future optimization
parent ad5e37e1
......@@ -102,7 +102,7 @@ void CDecoder_MS_fixed_flooded::decode(
int cn_offset = cn_idx*cn_deg_max;
char signGlobal = -1;
char signGlobal = 0;
char minLLR1 = 127;
char minLLR2 = 127;
......@@ -111,18 +111,22 @@ void CDecoder_MS_fixed_flooded::decode(
/* We compute a different estimate (the message sent), for each
* neighbouring VN */
for(size_t edge_idx = 0; edge_idx < DEG_1; edge_idx++) {
char msg = *p_vn_addr[cn_offset + edge_idx];
signGlobal *= (msg >= 0) ? -1 : 1;
abs[edge_idx] = (msg >= 0 ? msg : -msg);
char vn = *p_vn_addr[cn_offset + edge_idx];
signGlobal ^= vn;
abs[edge_idx] = (vn >= 0 ? vn : -vn);
char tmp = minLLR1;
minLLR1 = minLLR1 < abs[edge_idx] ? minLLR1 : abs[edge_idx];
minLLR2 = minLLR2 < abs[edge_idx] ? minLLR2 : abs[edge_idx] > tmp ? abs[edge_idx] : tmp;
}
#if (DEG_1 & 0x1)
signGlobal ^= 0x80;
#endif
for(size_t edge_idx = 0; edge_idx < DEG_1; edge_idx++) {
char sign = *p_vn_addr[cn_offset + edge_idx] >= 0 ? -signGlobal : signGlobal;
char sign = *p_vn_addr[cn_offset + edge_idx] ^ signGlobal;
char min = abs[edge_idx] == minLLR1 ? minLLR2 : minLLR1;
_cn_msgs[cn_offset + edge_idx] = (sign * min);
_cn_msgs[cn_offset + edge_idx] = sign < 0 ? -min : min;
}
}
......@@ -133,7 +137,7 @@ void CDecoder_MS_fixed_flooded::decode(
int cn_offset = cn_idx*cn_deg_max;
char signGlobal = -1;
char signGlobal = 0;
char minLLR1 = 127;
char minLLR2 = 127;
......@@ -142,18 +146,22 @@ void CDecoder_MS_fixed_flooded::decode(
/* We compute a different estimate (the message sent), for each
* neighbouring VN */
for(size_t edge_idx = 0; edge_idx < DEG_2; edge_idx++) {
char msg = *p_vn_addr[cn_offset + edge_idx];
signGlobal *= (msg >= 0) ? -1 : 1;
abs[edge_idx] = (msg >= 0 ? msg : -msg);
char vn = *p_vn_addr[cn_offset + edge_idx];
signGlobal ^= vn;
abs[edge_idx] = (vn >= 0 ? vn : -vn);
char tmp = minLLR1;
minLLR1 = minLLR1 < abs[edge_idx] ? minLLR1 : abs[edge_idx];
minLLR2 = minLLR2 < abs[edge_idx] ? minLLR2 : abs[edge_idx] > tmp ? abs[edge_idx] : tmp;
}
#if (DEG_2 & 0x1)
signGlobal ^= 0x80;
#endif
for(size_t edge_idx = 0; edge_idx < DEG_2; edge_idx++) {
char sign = *p_vn_addr[cn_offset + edge_idx] >= 0 ? -signGlobal : signGlobal;
char sign = *p_vn_addr[cn_offset + edge_idx] ^ signGlobal;
char min = abs[edge_idx] == minLLR1 ? minLLR2 : minLLR1;
_cn_msgs[cn_offset + edge_idx] = (sign * min);
_cn_msgs[cn_offset + edge_idx] = sign < 0 ? -min : min;
}
}
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment