1. Ctb transceiver ro (#773)

*  transceiverenable, tsamples, romode for tranceiver and digital_transceiver

* 202 spec instr only for transceiver mode

* removed check for empty in trans readout and clean memory before reading from fifo

* ctb read fifo strobe for all after reading all channels, adding 1us after selecting channel, changing fw date

* updated 10gb transceiver enable

----
* added transceiver (tsamples, romode(transceiver, digital_transceiver), transceiverenable (mask)

* clean memory before reading from fifo (for analog and digital as well)

* read fifo then read strobe (also corresp fw) fixes number of reads (also for analg and digital)-> increases all pipelines by 1

* fixed bug in rearranging digital data in receiver

* fixed bug in streaming size of data after rearranging

* fixed bug in setbit, clearbit,and getbit

* status checks fifo before returning idle (transmitting if data in fifo if transceiver more enabled)

* soem matterhorn specifics that will need to be put into pattern in a month or two. this is temporary.

* NOTE: breaking api. rxParameters struct has transceiverenabel and tsamples given from det to receiver
This commit is contained in:
2023-07-14 16:29:21 +02:00
committed by GitHub
parent a56be25500
commit c628ae2192
30 changed files with 1118 additions and 238 deletions

View File

@ -2576,8 +2576,8 @@ std::string CmdProxy::Samples(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[n_samples]\n\t[CTB] Number of samples (both analog and "
"digitial) expected.\n"
os << "[n_samples]\n\t[CTB] Number of samples (analog, digitial and "
"transceiver) expected.\n"
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
@ -2587,11 +2587,15 @@ std::string CmdProxy::Samples(int action) {
// get also digital samples for ctb and compare with analog
if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) {
auto d = det->getNumberOfDigitalSamples(std::vector<int>{det_id});
auto t =
det->getNumberOfTransceiverSamples(std::vector<int>{det_id});
int as = a.squash(-1);
int ds = d.squash(-1);
if (as == -1 || ds == -1 || as != ds) { // check if a == d?
int ts = t.squash(-1);
if (as == -1 || ds == -1 || ts == -1 || as != ds ||
as != ts) { // check if a == d?
throw RuntimeError(
"Different samples. Use asamples or dsamples.");
"Different samples. Use asamples, dsamples or tsamples.");
}
}
os << OutString(a) << '\n';
@ -2605,6 +2609,8 @@ std::string CmdProxy::Samples(int action) {
if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) {
det->setNumberOfDigitalSamples(StringTo<int>(args[0]),
std::vector<int>{det_id});
det->setNumberOfTransceiverSamples(StringTo<int>(args[0]),
std::vector<int>{det_id});
}
os << args.front() << '\n';
} else {

View File

@ -1225,7 +1225,7 @@ class CmdProxy {
{"apulse", &CmdProxy::apulse},
{"dpulse", &CmdProxy::dpulse},
/* CTB/ Moench Specific */
/* CTB Specific */
{"samples", &CmdProxy::Samples},
{"asamples", &CmdProxy::asamples},
{"adcclk", &CmdProxy::adcclk},
@ -1235,9 +1235,9 @@ class CmdProxy {
{"v_limit", &CmdProxy::v_limit},
{"adcenable", &CmdProxy::adcenable},
{"adcenable10g", &CmdProxy::adcenable10g},
/* CTB Specific */
{"transceiverenable", &CmdProxy::transceiverenable},
{"dsamples", &CmdProxy::dsamples},
{"tsamples", &CmdProxy::tsamples},
{"romode", &CmdProxy::romode},
{"dbitclk", &CmdProxy::dbitclk},
{"adcvpp", &CmdProxy::AdcVpp},
@ -2435,18 +2435,26 @@ class CmdProxy {
"ADC channel. However, if any of a consecutive 4 bits are enabled, "
"the complete 4 bits are enabled.");
/* CTB Specific */
INTEGER_COMMAND_HEX(transceiverenable, getTransceiverEnableMask,
setTransceiverEnableMask, StringTo<uint32_t>,
"[bitmask]\n\t[Ctb] Transceiver Enable Mask. Enable "
"for each 4 Transceiver channel.");
INTEGER_COMMAND_VEC_ID(
dsamples, getNumberOfDigitalSamples, setNumberOfDigitalSamples,
StringTo<int>,
"[n_value]\n\t[CTB] Number of digital samples expected.");
INTEGER_COMMAND_VEC_ID(
tsamples, getNumberOfTransceiverSamples, setNumberOfTransceiverSamples,
StringTo<int>,
"[n_value]\n\t[CTB] Number of transceiver samples expected.");
INTEGER_COMMAND_VEC_ID(
romode, getReadoutMode, setReadoutMode,
StringTo<slsDetectorDefs::readoutMode>,
"[analog|digital|analog_digital]\n\t[CTB] Readout mode. "
"Default is analog.");
"[analog|digital|analog_digital|transceiver|digital_transceiver]\n\t["
"CTB] Readout mode. Default is analog.");
INTEGER_COMMAND_VEC_ID(dbitclk, getDBITClock, setDBITClock, StringTo<int>,
"[n_clk in MHz]\n\t[Ctb] Clock for latching the "

View File

@ -2114,6 +2114,13 @@ void Detector::setTenGigaADCEnableMask(uint32_t mask, Positions pos) {
pimpl->Parallel(&Module::setTenGigaADCEnableMask, pos, mask);
}
Result<uint32_t> Detector::getTransceiverEnableMask(Positions pos) const {
return pimpl->Parallel(&Module::getTransceiverEnableMask, pos);
}
void Detector::setTransceiverEnableMask(uint32_t mask, Positions pos) {
pimpl->Parallel(&Module::setTransceiverEnableMask, pos, mask);
}
// CTB Specific
Result<int> Detector::getNumberOfDigitalSamples(Positions pos) const {
@ -2124,12 +2131,18 @@ void Detector::setNumberOfDigitalSamples(int value, Positions pos) {
pimpl->Parallel(&Module::setNumberOfDigitalSamples, pos, value);
}
Result<int> Detector::getNumberOfTransceiverSamples(Positions pos) const {
return pimpl->Parallel(&Module::getNumberOfTransceiverSamples, pos);
}
void Detector::setNumberOfTransceiverSamples(int value, Positions pos) {
pimpl->Parallel(&Module::setNumberOfTransceiverSamples, pos, value);
}
Result<defs::readoutMode> Detector::getReadoutMode(Positions pos) const {
return pimpl->Parallel(&Module::getReadoutMode, pos);
}
/** Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL \n
* Default: ANALOG_ONLY */
void Detector::setReadoutMode(defs::readoutMode value, Positions pos) {
pimpl->Parallel(&Module::setReadoutMode, pos, value);
}

View File

@ -2387,6 +2387,19 @@ void Module::setTenGigaADCEnableMask(uint32_t mask) {
}
}
uint32_t Module::getTransceiverEnableMask() const {
return sendToDetector<uint32_t>(F_GET_TRANSCEIVER_ENABLE_MASK);
}
void Module::setTransceiverEnableMask(uint32_t mask) {
sendToDetector(F_SET_TRANSCEIVER_ENABLE_MASK, mask, nullptr);
// update #nchan, as it depends on #samples, adcmask,
updateNumberOfChannels();
if (shm()->useReceiverFlag) {
sendToReceiver<int>(F_RECEIVER_SET_TRANSCEIVER_MASK, mask);
}
}
// CTB Specific
int Module::getNumberOfDigitalSamples() const {
@ -2401,6 +2414,18 @@ void Module::setNumberOfDigitalSamples(int value) {
}
}
int Module::getNumberOfTransceiverSamples() const {
return sendToDetector<int>(F_GET_NUM_TRANSCEIVER_SAMPLES);
}
void Module::setNumberOfTransceiverSamples(int value) {
sendToDetector(F_SET_NUM_TRANSCEIVER_SAMPLES, value, nullptr);
updateNumberOfChannels(); // depends on samples and adcmask
if (shm()->useReceiverFlag) {
sendToReceiver(F_RECEIVER_SET_NUM_TRANSCEIVER_SAMPLES, value, nullptr);
}
}
slsDetectorDefs::readoutMode Module::getReadoutMode() const {
return sendToDetector<readoutMode>(F_GET_READOUT_MODE);
}
@ -2408,6 +2433,7 @@ slsDetectorDefs::readoutMode Module::getReadoutMode() const {
void Module::setReadoutMode(const slsDetectorDefs::readoutMode mode) {
auto arg = static_cast<uint32_t>(mode); // TODO! unit?
sendToDetector(F_SET_READOUT_MODE, arg, nullptr);
sendToDetectorStop(F_SET_READOUT_MODE, arg, nullptr);
// update #nchan, as it depends on #samples, adcmask,
if (shm()->detType == CHIPTESTBOARD) {
updateNumberOfChannels();

View File

@ -504,8 +504,12 @@ class Module : public virtual slsDetectorDefs {
void setADCEnableMask(uint32_t mask);
uint32_t getTenGigaADCEnableMask() const;
void setTenGigaADCEnableMask(uint32_t mask);
uint32_t getTransceiverEnableMask() const;
void setTransceiverEnableMask(uint32_t mask);
int getNumberOfDigitalSamples() const;
void setNumberOfDigitalSamples(int value);
int getNumberOfTransceiverSamples() const;
void setNumberOfTransceiverSamples(int value);
readoutMode getReadoutMode() const;
void setReadoutMode(const readoutMode mode);
int getExternalSamplingSource();