Commit 8dcceb6c authored by Sydney Hauke's avatar Sydney Hauke

incorrect indexing fixed, and 4x2 debug matrix added

parent 9c87a640
CC=g++
CFLAGS= -g -I../cpp_src -W -Wall -O3 \
CFLAGS= -g -I../cpp_src -W -Wall -O0 \
-fopenmp -finline -funroll-loops -opt-prefetch -unroll-aggressive \
-m64 -DMKL_ILP64 -I../src -msse4a -march=native -I${MKL_ROOT}/include/
......
......@@ -99,7 +99,7 @@ void CDecoder_MS_fixed_reds::decode(
/* FIXME : in DVB-S2, the H matrix has one row with different degree:
* the last one. */
cn_deg = cn_idx == (nb_cn-1) ? DEG_2 : cn_deg;
cn_deg = cn_idx == (nb_cn-1) ? DEG_2 : cn_deg_max;
/* We compute a different estimate (the message sent), for each
* neighbouring VN */
......@@ -108,13 +108,13 @@ void CDecoder_MS_fixed_reds::decode(
char minLLR = 127;
for(size_t other_edge_idx = 0; other_edge_idx < cn_deg; other_edge_idx++) {
if(other_edge_idx == edge_idx) continue;
char msg = *p_vn_addr[cn_idx*cn_deg + other_edge_idx];
char msg = *p_vn_addr[cn_idx*cn_deg_max + other_edge_idx];
char abs_msg = (msg >= 0 ? msg : -msg);
sign *= (msg >= 0) ? 1 : -1;
sign *= (msg >= 0) ? -1 : 1;
minLLR = minLLR > abs_msg ? abs_msg : minLLR;
}
cn_msgs[cn_idx*cn_deg + edge_idx] = (sign * minLLR);
cn_msgs[cn_idx*cn_deg_max + edge_idx] = (sign * minLLR);
}
}
......@@ -127,10 +127,10 @@ void CDecoder_MS_fixed_reds::decode(
vn[vn_idx] = llr_vn[vn_idx];
for(
size_t edge_idx = 0;
edge_idx < vn_deg && p_cn_addr[vn_idx*vn_deg + edge_idx] != NULL;
edge_idx < vn_deg_max && p_cn_addr[vn_idx*vn_deg_max + edge_idx] != NULL;
edge_idx++)
{
int a = *p_cn_addr[vn_idx*vn_deg + edge_idx];
int a = *p_cn_addr[vn_idx*vn_deg_max + edge_idx];
int b = vn[vn_idx];
int c = a + b;
// 8 bit signed saturation
......@@ -141,16 +141,16 @@ void CDecoder_MS_fixed_reds::decode(
for(
size_t edge_idx = 0;
edge_idx < vn_deg && p_cn_addr[vn_idx*vn_deg + edge_idx] != NULL;
edge_idx < vn_deg_max && p_cn_addr[vn_idx*vn_deg_max + edge_idx] != NULL;
edge_idx++)
{
int a = *p_cn_addr[vn_idx*vn_deg + edge_idx];
int a = *p_cn_addr[vn_idx*vn_deg_max + edge_idx];
int b = vn[vn_idx];
int c = b - a;
//8 bit signed saturation
if(c > 127) c = 127;
else if(c < -128) c = -128;
vn_msgs[vn_idx*vn_deg + edge_idx] = (char)c;
vn_msgs[vn_idx*vn_deg_max + edge_idx] = (char)c;
}
}
}
......
/**
Copyright (c) 2012-2015 "Bordeaux INP, Bertrand LE GAL"
[http://legal.vvv.enseirb-matmeca.fr]
This file is part of LDPC_C_Simulator.
LDPC_C_Simulator is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONSTANTES
#define CONSTANTES
#include <math.h>
#define NB_DEGRES 2
#define _N 4 // Nombre de Variables
#define _K 2 // Nombre de Checks
#define _M 5 // Nombre de Messages
#define NOEUD _N
#define MESSAGE _M
#define NmoinsK (_N-_K)
#define DEG_1 3
#define DEG_2 2
#define DEG_1_COMPUTATIONS 1
#define DEG_2_COMPUTATIONS 1
#define NB_ITERATIONS 20
#define NB_BITS_VARIABLES 8 //8 ???
#define NB_BITS_MESSAGES 6 //6 ???
#define SAT_POS_VAR ( (0x0001<<(NB_BITS_VARIABLES-1))-1)
#define SAT_NEG_VAR (-(0x0001<<(NB_BITS_VARIABLES-1))+1)
#define SAT_POS_MSG ( (0x0001<<(NB_BITS_MESSAGES -1))-1)
#define SAT_NEG_MSG (-(0x0001<<(NB_BITS_MESSAGES -1))+1)
#endif
#ifndef _PosNoeudsVariable_
#define _PosNoeudsVariable_
const unsigned short PosNoeudsVariable[5] ={
/* msg = 0, deg = 3 */ 0, 1, 2,
/* msg = 1, deg = 2 */ 1, 3
};
#endif
#include "./64800x32400.dvb-s2/constantes.h"
#include "./4x2.debug/constantes.h"
#include "./64800x32400.dvb-s2/constantes_sse.h"
#include "./4x2.debug/constantes_sse.h"
......@@ -456,7 +456,7 @@ int main(int argc, char* argv[]) {
FILE *in = fopen("encoded.txt", "w+");
FILE *out = fopen("decoded.txt", "w+");
for(size_t i = 0; i < 64800; i++) {
for(size_t i = 0; i < NOEUD; i++) {
fprintf(in, "%d ", simu_data[0]->get_t_coded_bits()[i]);
fprintf(out, "%d ", simu_data[0]->get_t_decode_data()[i]);
}
......
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