dev/ [Mythen3] Check bad-channel flags before shifting the channel register (#1626)
Build on RHEL9 docker image / build (push) Successful in 4m15s
Build on RHEL8 docker image / build (push) Successful in 5m13s
Build and Deploy on local RHEL9 / build (push) Successful in 2m1s
Build and Deploy on local RHEL8 / build (push) Successful in 5m10s
Run Simulator Tests on local RHEL9 / build (push) Successful in 20m43s
Run Simulator Tests on local RHEL8 / build (push) Successful in 24m8s

* [Mythen3] Check bad-channel flags before shifting the channel register

The bad-channel test in setChannelRegisterChip ran after the register
was divided by two, so the mask 0x38 hit the LSB of the counter 0 trim
instead of the flags. Every channel with an odd trim value was logged
as a bad channel, 1280 lines per module, which made setAllTrimbits
about 190 ms slower for odd values. Test the flags where they were set.

Also remove an unused message buffer in validate_writePatternWord and
log the client pattern file name at debug level instead of printing it
on every pattern load.

* check is back

* m3 binary in

---------

Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
Erik Fröjdhandmaliakal_d authored and GitHub committed 2026-10-22 16:31:10 +02:00
1 parent c87cc7e515
commit 7aeb199bf6
8 files changed
+44 -42

No files matched your search

@@ -304,8 +304,6 @@ patternParameters *setChannelRegisterChip(int ichip, char *mask,
chanReg |= (0x1 << (3 + icounter));
}
}
chanReg /= 2;
// deserialize
if (chanReg & CHAN_REG_BAD_CHANNEL_MSK) {
LOG(logINFOBLUE,
("badchannel [chanReg:0x%x modCounter:%d, modChan:%d, "
@@ -313,6 +311,8 @@ patternParameters *setChannelRegisterChip(int ichip, char *mask,
chanReg, ichip * NCHAN + ich * NCOUNTERS,
ichip * NCHAN_1_COUNTER + ich, ichip, ich));
}
chanReg /= 2;
// deserialize
for (int i = 0; i < 23; i++) {
patword = clearBit(SIGNAL_clk, patword);
pat->word[iaddr++] = patword;
@@ -149,10 +149,12 @@ int validate_writePatternWord(char *message, int addr, uint64_t word) {
uint64_t retval = readPatternWord(addr);
LOG(logDEBUG1, ("Pattern word (addr:0x%x) retval: 0x%llx\n", addr,
(long long int)retval));
char mode[128];
memset(mode, 0, sizeof(mode));
sprintf(mode, "set pattern word for addr 0x%x", addr);
validate64(&ret, message, word, retval, "set pattern word", HEX);
// runs for every pattern word: only build the message on a mismatch
if (retval != word) {
char mode[64];
sprintf(mode, "set pattern word for addr 0x%x", addr);
validate64(&ret, message, word, retval, mode, HEX);
}
#endif
return ret;
}
@@ -700,7 +702,7 @@ int loadPattern(char *message, enum TLogLevel printLevel,
int ret = OK;
memset(clientPatternfile, 0, MAX_STR_LENGTH);
memcpy(clientPatternfile, patfname, MAX_STR_LENGTH);
printf("Client Pattern File:%s\n", clientPatternfile);
LOG(logDEBUG1, ("Client Pattern File:%s\n", clientPatternfile));
#ifdef MYTHEN3D
trimmingPrint = printLevel;
#endif
@@ -542,30 +542,30 @@ int main(int argc, char *argv[]) {
for (int i = 0; i != f.numReceivers; ++i) {
uint16_t port = f.port + i;
sem_t *semaphore = &semaphores[i];
threads.emplace_back(
[i, semaphore, port, user_data, &threadException]() {
LOG(sls::logINFOBLUE) << "Thread " << i << " [ Tid: "
<< sls::getThreadId() << ']';
try {
sls::Receiver receiver(port);
receiver.registerCallBackStartAcquisition(
StartAcquisitionCallback, user_data);
receiver.registerCallBackAcquisitionFinished(
AcquisitionFinishedCallback, user_data);
receiver.registerCallBackRawDataReady(GetDataCallback,
user_data);
threads.emplace_back([i, semaphore, port, user_data,
&threadException]() {
LOG(sls::logINFOBLUE)
<< "Thread " << i << " [ Tid: " << sls::getThreadId() << ']';
try {
sls::Receiver receiver(port);
receiver.registerCallBackStartAcquisition(
StartAcquisitionCallback, user_data);
receiver.registerCallBackAcquisitionFinished(
AcquisitionFinishedCallback, user_data);
receiver.registerCallBackRawDataReady(GetDataCallback,
user_data);
/** - as long as no Ctrl+C */
// each child shares the common semaphore
sem_wait(semaphore);
} catch (...) {
// capture exception and raise SIGINT to exit gracefully
threadException = std::current_exception();
raise(SIGINT);
}
LOG(sls::logINFOBLUE) << "Exiting Thread " << i << " [ Tid: "
<< sls::getThreadId() << " ]";
});
/** - as long as no Ctrl+C */
// each child shares the common semaphore
sem_wait(semaphore);
} catch (...) {
// capture exception and raise SIGINT to exit gracefully
threadException = std::current_exception();
raise(SIGINT);
}
LOG(sls::logINFOBLUE) << "Exiting Thread " << i
<< " [ Tid: " << sls::getThreadId() << " ]";
});
}
for (auto &t : threads) {
+8 -7
View File
@@ -177,9 +177,8 @@ int main(int argc, char *argv[]) {
/** - if child process */
else if (pid == 0) {
LOG(sls::logINFOBLUE)
<< "Child process " << i << " [ Tid: " << sls::getThreadId()
<< ']';
LOG(sls::logINFOBLUE) << "Child process " << i
<< " [ Tid: " << sls::getThreadId() << ']';
try {
uint16_t port = m.port + i;
@@ -210,13 +209,15 @@ int main(int argc, char *argv[]) {
// each child process gets a copy of the semaphore
sem_wait(&semaphore);
sem_destroy(&semaphore);
LOG(sls::logINFOBLUE) << "Exiting Child Process [ Tid: "
<< sls::getThreadId() << ']';
LOG(sls::logINFOBLUE)
<< "Exiting Child Process [ Tid: " << sls::getThreadId()
<< ']';
exit(EXIT_SUCCESS);
} catch (...) {
sem_destroy(&semaphore);
LOG(sls::logINFOBLUE) << "Exiting Child Process [ Tid: "
<< sls::getThreadId() << " ]";
LOG(sls::logINFOBLUE)
<< "Exiting Child Process [ Tid: " << sls::getThreadId()
<< " ]";
exit(EXIT_FAILURE);
}
}
+1 -2
View File
@@ -352,8 +352,7 @@ T StringTo(const std::string &f, const std::string &unit) {
}
}
template <typename T,
std::enable_if_t<!is_container<T>::value, int> = 0>
template <typename T, std::enable_if_t<!is_container<T>::value, int> = 0>
T StringTo(const std::string &t) {
std::string tmp{t};
auto unit = RemoveUnit(tmp);
+1 -1
View File
@@ -9,5 +9,5 @@
#define APIEIGER "0.0.0 0x260807"
#define APIXILINXCTB "0.0.0 0x260813"
#define APIJUNGFRAU "0.0.0 0x261002"
#define APIMYTHEN3 "0.0.0 0x260506"
#define APIMYTHEN3 "0.0.0 0x261022"
#define APIMATTERHORN "0.0.0 0x260529"
+2 -2
View File
@@ -415,10 +415,10 @@ TEST_CASE("string to timingInfoDecoder") {
defs::timingInfoDecoder::SHINE);
}
TEST_CASE("Convert string to vector of ints") {
REQUIRE(StringTo<std::vector<int>>("1, 2, 3") == std::vector<int>{1, 2, 3});
REQUIRE(StringTo<std::vector<int>>(" 4 ,5,6 ") == std::vector<int>{4, 5, 6});
REQUIRE(StringTo<std::vector<int>>(" 4 ,5,6 ") ==
std::vector<int>{4, 5, 6});
REQUIRE(StringTo<std::vector<int>>("[8]") == std::vector<int>{8});
REQUIRE(StringTo<std::vector<int>>("9, ") == std::vector<int>{9});
REQUIRE(StringTo<std::vector<int>>("") == std::vector<int>{});