Commit 650da479 authored by sydney's avatar sydney

Reds decoder now converges

parent 8dcceb6c
CC=g++ CC=g++
CFLAGS= -g -I../cpp_src -W -Wall -O0 \ CFLAGS= -g -I../cpp_src -W -Wall -O3 \
-fopenmp -finline -funroll-loops -opt-prefetch -unroll-aggressive \ -fopenmp -finline -funroll-loops -opt-prefetch -unroll-aggressive \
-m64 -DMKL_ILP64 -I../src -msse4a -march=native -I${MKL_ROOT}/include/ -m64 -DMKL_ILP64 -I../src -msse4a -march=native -I${MKL_ROOT}/include/
......
...@@ -10,16 +10,16 @@ CDecoder_MS_fixed_reds::CDecoder_MS_fixed_reds() ...@@ -10,16 +10,16 @@ CDecoder_MS_fixed_reds::CDecoder_MS_fixed_reds()
size_t vn_idx; size_t vn_idx;
// We allocate a max of cn_deg_max per CN // We allocate a max of cn_deg_max per CN
p_vn_addr = new char *[nb_cols * cn_deg_max]; p_vn_addr = new char *[nb_rows * cn_deg_max];
// We allocate a max of vn_deg_max per VN // We allocate a max of vn_deg_max per VN
p_cn_addr = new char *[nb_cols * vn_deg_max]; p_cn_addr = new char *[nb_cols * vn_deg_max];
for(size_t i = 0; i < nb_rows*cn_deg_max; i++) { for(size_t i = 0; i < nb_rows*cn_deg_max; i++) {
p_cn_addr[i] = NULL; p_vn_addr[i] = NULL;
} }
for(size_t i = 0; i < nb_cols*vn_deg_max; i++) { for(size_t i = 0; i < nb_cols*vn_deg_max; i++) {
p_vn_addr[i] = NULL; p_cn_addr[i] = NULL;
} }
/* Iterate over the entire matrix H */ /* Iterate over the entire matrix H */
...@@ -53,9 +53,9 @@ CDecoder_MS_fixed_reds::CDecoder_MS_fixed_reds() ...@@ -53,9 +53,9 @@ CDecoder_MS_fixed_reds::CDecoder_MS_fixed_reds()
} }
p_vn_addr[row*cn_deg_max + vn_slot_offset] = p_vn_addr[row*cn_deg_max + vn_slot_offset] =
&var_msgs[vn_idx*vn_deg_max + vn_slot_offset]; &var_msgs[vn_idx*vn_deg_max + cn_slot_offset];
p_cn_addr[vn_idx*vn_deg_max + cn_slot_offset] = p_cn_addr[vn_idx*vn_deg_max + cn_slot_offset] =
&check_msgs[row*cn_deg_max + cn_slot_offset]; &check_msgs[row*cn_deg_max + vn_slot_offset];
} }
} }
...@@ -104,7 +104,7 @@ void CDecoder_MS_fixed_reds::decode( ...@@ -104,7 +104,7 @@ void CDecoder_MS_fixed_reds::decode(
/* We compute a different estimate (the message sent), for each /* We compute a different estimate (the message sent), for each
* neighbouring VN */ * neighbouring VN */
for(size_t edge_idx = 0; edge_idx < cn_deg; edge_idx++) { for(size_t edge_idx = 0; edge_idx < cn_deg; edge_idx++) {
char sign = 1; char sign = -1;
char minLLR = 127; char minLLR = 127;
for(size_t other_edge_idx = 0; other_edge_idx < cn_deg; other_edge_idx++) { for(size_t other_edge_idx = 0; other_edge_idx < cn_deg; other_edge_idx++) {
if(other_edge_idx == edge_idx) continue; if(other_edge_idx == edge_idx) continue;
...@@ -124,33 +124,31 @@ void CDecoder_MS_fixed_reds::decode( ...@@ -124,33 +124,31 @@ void CDecoder_MS_fixed_reds::decode(
* 2) A new estimate to be kept to itself * 2) A new estimate to be kept to itself
*/ */
for(size_t vn_idx = 0; vn_idx < nb_vn; vn_idx++) { for(size_t vn_idx = 0; vn_idx < nb_vn; vn_idx++) {
vn[vn_idx] = llr_vn[vn_idx]; int estimate_acc = llr_vn[vn_idx];
for( for(
size_t edge_idx = 0; size_t edge_idx = 0;
edge_idx < vn_deg_max && p_cn_addr[vn_idx*vn_deg_max + edge_idx] != NULL; edge_idx < vn_deg_max && p_cn_addr[vn_idx*vn_deg_max + edge_idx] != NULL;
edge_idx++) edge_idx++)
{ {
int a = *p_cn_addr[vn_idx*vn_deg_max + edge_idx]; estimate_acc += *p_cn_addr[vn_idx*vn_deg_max + edge_idx];
int b = vn[vn_idx];
int c = a + b;
// 8 bit signed saturation
if(c > 127) c = 127;
else if(c < -128) c = -128;
vn[vn_idx] = (char)c;
} }
if(estimate_acc > 127) vn[vn_idx] = 127;
else if(estimate_acc < -127) vn[vn_idx] = -127;
else vn[vn_idx] = (char)estimate_acc;
for( for(
size_t edge_idx = 0; size_t edge_idx = 0;
edge_idx < vn_deg_max && p_cn_addr[vn_idx*vn_deg_max + edge_idx] != NULL; edge_idx < vn_deg_max && p_cn_addr[vn_idx*vn_deg_max + edge_idx] != NULL;
edge_idx++) edge_idx++)
{ {
int a = *p_cn_addr[vn_idx*vn_deg_max + edge_idx]; int msg = *p_cn_addr[vn_idx*vn_deg_max + edge_idx];
int b = vn[vn_idx]; int vn_msg = estimate_acc - msg;
int c = b - a;
//8 bit signed saturation if(vn_msg > 127) vn_msgs[vn_idx*vn_deg_max + edge_idx] = 127;
if(c > 127) c = 127; else if(vn_msg < -127) vn_msgs[vn_idx*vn_deg_max + edge_idx] = -127;
else if(c < -128) c = -128; else vn_msgs[vn_idx*vn_deg_max + edge_idx] = (char)vn_msg;
vn_msgs[vn_idx*vn_deg_max + edge_idx] = (char)c;
} }
} }
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
class CDecoder_fixed_reds : public CDecoder_fixed { class CDecoder_fixed_reds : public CDecoder_fixed {
protected: protected:
const size_t cn_deg_max = DEG_1; const size_t cn_deg_max = DEG_1;
const size_t vn_deg_max = 8; // FIXME : find this constant somewhere const size_t vn_deg_max = DEG_VN_MAX; // FIXME : find this constant somewhere
char *var_msgs; char *var_msgs;
char *check_msgs; char *check_msgs;
char *var_nodes; char *var_nodes;
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#define DEG_1 3 #define DEG_1 3
#define DEG_2 2 #define DEG_2 2
#define DEG_VN_MAX 2
#define DEG_1_COMPUTATIONS 1 #define DEG_1_COMPUTATIONS 1
#define DEG_2_COMPUTATIONS 1 #define DEG_2_COMPUTATIONS 1
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#define DEG_1 7 #define DEG_1 7
#define DEG_2 6 #define DEG_2 6
#define DEG_VN_MAX 8
#define DEG_1_COMPUTATIONS 32399 #define DEG_1_COMPUTATIONS 32399
#define DEG_2_COMPUTATIONS 1 #define DEG_2_COMPUTATIONS 1
#include "./4x2.debug/constantes.h" //#include "./4x2.debug/constantes.h"
#include "./64800x32400.dvb-s2/constantes.h"
#include "./4x2.debug/constantes_sse.h" //#include "./4x2.debug/constantes_sse.h"
#include "./64800x32400.dvb-s2/constantes_sse.h"
...@@ -452,7 +452,7 @@ int main(int argc, char* argv[]) { ...@@ -452,7 +452,7 @@ int main(int argc, char* argv[]) {
// TODO : remove after tests // TODO : remove after tests
decoder[0]->decode(simu_data[0]->get_t_fpoint_data(), simu_data[0]->get_t_decode_data(), NB_ITERATIONS); /*decoder[0]->decode(simu_data[0]->get_t_fpoint_data(), simu_data[0]->get_t_decode_data(), NB_ITERATIONS);
FILE *in = fopen("encoded.txt", "w+"); FILE *in = fopen("encoded.txt", "w+");
FILE *out = fopen("decoded.txt", "w+"); FILE *out = fopen("decoded.txt", "w+");
...@@ -461,7 +461,7 @@ int main(int argc, char* argv[]) { ...@@ -461,7 +461,7 @@ int main(int argc, char* argv[]) {
fprintf(out, "%d ", simu_data[0]->get_t_decode_data()[i]); fprintf(out, "%d ", simu_data[0]->get_t_decode_data()[i]);
} }
fclose(out); fclose(out);
fclose(in); fclose(in);*/
// //
// ON CREE UN OBJET POUR LA MESURE DU TEMPS DE SIMULATION (REMISE A ZERO POUR CHAQUE Eb/N0) // ON CREE UN OBJET POUR LA MESURE DU TEMPS DE SIMULATION (REMISE A ZERO POUR CHAQUE Eb/N0)
......
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