From d4d009e12a78f6938cdd146dfcde788b47a41b2a Mon Sep 17 00:00:00 2001 From: John Romein <romein@astron.nl> Date: Mon, 24 Apr 2006 08:01:32 +0000 Subject: [PATCH] BugID: 225 Extra sanity checks. --- Appl/CEP/CS1/CS1_BGLProc/src/Correlator.S | 9 +++++++++ Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h | 7 +++++++ Appl/CEP/CS1/CS1_BGLProc/src/FIR.S | 8 ++++++++ Appl/CEP/CS1/CS1_BGLProc/src/FIR.h | 8 ++++++++ Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc | 15 +++++++++++---- 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.S b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.S index 8247eb1f43d..a1940ca0192 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.S +++ b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.S @@ -28,6 +28,15 @@ # fxcpnsma 1,16,21,1 # f1r += f21r*f16r, f1i -= f21i*f16r # fxcxma 1,16,21,1 # f1r += f21i*f16i, f1i += f21r*f16i + +.global _correlator_constants_used +_correlator_constants_used: + .long NR_STATIONS + .long NR_SAMPLES_PER_INTEGRATION + .long NR_SUBBAND_CHANNELS + .long NR_POLARIZATIONS + + .align 5 zero: .long 0,0 diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h index 5eaa5863fe4..433c5aabc47 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h +++ b/Appl/CEP/CS1/CS1_BGLProc/src/Correlator.h @@ -78,6 +78,13 @@ extern "C" { DH_Visibilities::AllNrValidSamplesType *nrValidSamplesCounted, const float correlationWeights[NR_SAMPLES_PER_INTEGRATION + 1], const float thresholds[NR_BASELINES][NR_SUBBAND_CHANNELS]); + + struct { + unsigned nr_stations; + unsigned nr_samples_per_integration; + unsigned nr_subband_channels; + unsigned nr_polarizations; + } _correlator_constants_used; }; } diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.S b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.S index 812684d22f7..48f53e02ac7 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.S +++ b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.S @@ -26,6 +26,14 @@ #define FCOMPLEX_SIZE 8 #define DCOMPLEX_SIZE 16 +.global _FIR_constants_used +_FIR_constants_used: + .long INPUT_TYPE + .long NR_STATIONS + .long NR_SAMPLES_PER_INTEGRATION + .long NR_SUBBAND_CHANNELS + .long NR_POLARIZATIONS + .align 5 .global _bgl_mutex_lock diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.h b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.h index 42656c2806c..12640c2dba0 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/FIR.h +++ b/Appl/CEP/CS1/CS1_BGLProc/src/FIR.h @@ -64,6 +64,14 @@ extern "C" { void _memzero(void *dst, size_t bytes); // bytes must be multiple of 128 void _prefetch(const void *src, size_t count, size_t stride); + struct { + unsigned input_type; + unsigned nr_stations; + unsigned nr_samples_per_integration; + unsigned nr_subband_channels; + unsigned nr_polarizations; + } _FIR_constants_used; + void _bgl_mutex_lock(BGL_Mutex *), _bgl_mutex_unlock(BGL_Mutex *); unsigned long long _rdtsc(); }; diff --git a/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc b/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc index 8f5679dd317..e2166636455 100644 --- a/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc +++ b/Appl/CEP/CS1/CS1_BGLProc/src/WH_BGL_Processing.cc @@ -1194,6 +1194,17 @@ void WH_BGL_Processing::preprocess() } #if defined HAVE_BGL && !defined C_IMPLEMENTATION + ASSERT(_FIR_constants_used.input_type == INPUT_TYPE); + ASSERT(_FIR_constants_used.nr_stations == NR_STATIONS); + ASSERT(_FIR_constants_used.nr_samples_per_integration == NR_SAMPLES_PER_INTEGRATION); + ASSERT(_FIR_constants_used.nr_subband_channels == NR_SUBBAND_CHANNELS); + ASSERT(_FIR_constants_used.nr_polarizations == NR_POLARIZATIONS); + + ASSERT(_correlator_constants_used.nr_stations == NR_STATIONS); + ASSERT(_correlator_constants_used.nr_samples_per_integration == NR_SAMPLES_PER_INTEGRATION); + ASSERT(_correlator_constants_used.nr_subband_channels == NR_SUBBAND_CHANNELS); + ASSERT(_correlator_constants_used.nr_polarizations == NR_POLARIZATIONS); + mutex = rts_allocate_mutex(); #endif } @@ -1212,7 +1223,6 @@ void WH_BGL_Processing::computeFlags() computeFlagsTimer.start(); -#if 1 || defined C_IMPLEMENTATION memset(flags, 0, sizeof flags); for (int stat = 0; stat < NR_STATIONS; stat ++) { @@ -1234,9 +1244,6 @@ void WH_BGL_Processing::computeFlags() } } } -#else - _compute_flags(input, &flags); // broken -#endif #endif for (int stat2 = 0; stat2 < NR_STATIONS; stat2 ++) { -- GitLab