From eab2df2a38b1d0a4e1d6d574bd77074f01f08d3d Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 7 Sep 2012 11:57:27 +0200 Subject: [PATCH] [pipepar] Compute a CRC 8bit in lattice.c * Change number of bits in CRC to 8 * Avoid q to be higher than 2^CRC_BIT * Increase the number of packets when benchmarking lattice.c --- pipepar/Makefile | 4 ++-- pipepar/lattice.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pipepar/Makefile b/pipepar/Makefile index 487e02d..e4092a3 100644 --- a/pipepar/Makefile +++ b/pipepar/Makefile @@ -46,8 +46,8 @@ lattice-prog-%: lattice.c runlattice%: lattice-% mkdir -p logs - ./$< -p 50 2>/dev/null - $(call runntimesandlog,10,./$< -p 50,logs/$<-$$(date +%Y-%m-%d_%H-%M-%S).log) + ./$< -p 10000 2>/dev/null + $(call runntimesandlog,10,./$< -p 10000,logs/$<-$$(date +%Y-%m-%d_%H-%M-%S).log) pipeline_template-prog-%: pipeline_template.c NUM=$*;OPT=-$*;gcc $(CFLAGS) -DNB_CORES=$${NUM##*-} $${OPT%-*} -o $@ $< -lrt diff --git a/pipepar/lattice.c b/pipepar/lattice.c index 7973654..19ffc96 100644 --- a/pipepar/lattice.c +++ b/pipepar/lattice.c @@ -24,8 +24,8 @@ #define AAC_SCE_PROT_BIT 192 #define AAC_SCE_PROT_PER_CORE_BIT (AAC_SCE_PROT_BIT / NB_CORES) -/* CRC CCITT-16 size */ -#define CRC_BIT 16 +/* CRC CCITT-8 size? */ +#define CRC_BIT 8 #define DATA_BITS_PER_CORE ((AAC_SCE_PROT_BIT - 1) / NB_CORES) @@ -202,7 +202,7 @@ inline void compute_cumulative_metrics_column( for(jf = 0; jf < (1 << CRC_BIT); jf++) { uint_fast16_t j = (uint_fast16_t) jf; - uint_fast16_t q = j ^ p_matrix; + uint_fast16_t q = (j ^ p_matrix) & ((1 << CRC_BIT) - 1); lattice_metrics_out[j] = jacolog(lattice_metrics_in[j] + bit_metrics, lattice_metrics_out[j]); lattice_metrics_out[q] = jacolog(lattice_metrics_in[j] - bit_metrics, lattice_metrics_out[q]); n = jacolog(lattice_metrics_out[j], n);