mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
Dev/xilinx acq (#901)
* period and exptime(patternwaittime level 0) * added new regsieterdefs and updated api version and fixedpattern reg * autogenerate commands * formatting * minor * wip resetflow, readout mode, transceiver mask, transceiver enable * acquisition, but streaming done bit and busy (exposing + read chip to fifo) not known yet from fw * programming fpga and device tree done * most configuration done, need to connect configuretransceiver to client * stuck at resetting transciever timed out * minor * fixed virtual, added chip busyto fifo, streaming busy, set/getnext framenumber * configuretransceiver from client, added help in client * make formatt and command generation * tests for xilinx ctb works * command generation * dacs added and tested, power not done * power added * added temp_fpga * binaries in * ctrlreg is 0 to enable chip=fixed, high dac val = min val= fixed, power regulators in weird order=fixed, device tree could be loaded with dacs before adcs=fixed * start works * virtual server sends * receiver works * tests * python function and enum generation, commands generatorn and autocomplete, formatting, tests * tests fail at start(transceiver not aligned) * tests passed * all binaries compiled * eiger binary in * added --nomodule cehck for xilinx
This commit is contained in:
@ -372,7 +372,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
arg.additionalStorageCells);
|
||||
}
|
||||
|
||||
if (detType == CHIPTESTBOARD) {
|
||||
if (detType == CHIPTESTBOARD || detType == XILINX_CHIPTESTBOARD) {
|
||||
impl()->setNumberofAnalogSamples(arg.analogSamples);
|
||||
impl()->setNumberofDigitalSamples(arg.digitalSamples);
|
||||
impl()->setNumberofTransceiverSamples(arg.transceiverSamples);
|
||||
@ -409,12 +409,14 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
detType == MYTHEN3) {
|
||||
impl()->setTenGigaEnable(arg.tenGiga);
|
||||
}
|
||||
if (detType == CHIPTESTBOARD) {
|
||||
if (detType == CHIPTESTBOARD || detType == XILINX_CHIPTESTBOARD) {
|
||||
impl()->setReadoutMode(arg.roMode);
|
||||
impl()->setADCEnableMask(arg.adcMask);
|
||||
impl()->setTenGigaADCEnableMask(arg.adc10gMask);
|
||||
impl()->setTransceiverEnableMask(arg.transceiverMask);
|
||||
}
|
||||
if (detType == CHIPTESTBOARD) {
|
||||
impl()->setADCEnableMask(arg.adcMask);
|
||||
}
|
||||
if (detType == GOTTHARD) {
|
||||
impl()->setDetectorROI(arg.roi);
|
||||
}
|
||||
@ -448,6 +450,7 @@ void ClientInterface::setDetectorType(detectorType arg) {
|
||||
case GOTTHARD:
|
||||
case EIGER:
|
||||
case CHIPTESTBOARD:
|
||||
case XILINX_CHIPTESTBOARD:
|
||||
case JUNGFRAU:
|
||||
case MOENCH:
|
||||
case MYTHEN3:
|
||||
@ -568,7 +571,7 @@ int ClientInterface::set_burst_mode(Interface &socket) {
|
||||
int ClientInterface::set_num_analog_samples(Interface &socket) {
|
||||
auto value = socket.Receive<int>();
|
||||
LOG(logDEBUG1) << "Setting num analog samples to " << value;
|
||||
if (detType != CHIPTESTBOARD) {
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
try {
|
||||
@ -584,7 +587,7 @@ int ClientInterface::set_num_analog_samples(Interface &socket) {
|
||||
int ClientInterface::set_num_digital_samples(Interface &socket) {
|
||||
auto value = socket.Receive<int>();
|
||||
LOG(logDEBUG1) << "Setting num digital samples to " << value;
|
||||
if (detType != CHIPTESTBOARD) {
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
try {
|
||||
@ -1249,7 +1252,7 @@ int ClientInterface::get_padding_enable(Interface &socket) {
|
||||
int ClientInterface::set_readout_mode(Interface &socket) {
|
||||
auto arg = socket.Receive<readoutMode>();
|
||||
|
||||
if (detType != CHIPTESTBOARD)
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD)
|
||||
functionNotImplemented();
|
||||
|
||||
if (arg >= 0) {
|
||||
@ -1294,7 +1297,7 @@ int ClientInterface::set_adc_mask(Interface &socket) {
|
||||
int ClientInterface::set_dbit_list(Interface &socket) {
|
||||
StaticVector<int, MAX_RX_DBIT> args;
|
||||
socket.Receive(args);
|
||||
if (detType != CHIPTESTBOARD)
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD)
|
||||
functionNotImplemented();
|
||||
LOG(logDEBUG1) << "Setting DBIT list";
|
||||
for (auto &it : args) {
|
||||
@ -1307,7 +1310,7 @@ int ClientInterface::set_dbit_list(Interface &socket) {
|
||||
}
|
||||
|
||||
int ClientInterface::get_dbit_list(Interface &socket) {
|
||||
if (detType != CHIPTESTBOARD)
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD)
|
||||
functionNotImplemented();
|
||||
StaticVector<int, MAX_RX_DBIT> retval;
|
||||
retval = impl()->getDbitList();
|
||||
@ -1317,7 +1320,7 @@ int ClientInterface::get_dbit_list(Interface &socket) {
|
||||
|
||||
int ClientInterface::set_dbit_offset(Interface &socket) {
|
||||
auto arg = socket.Receive<int>();
|
||||
if (detType != CHIPTESTBOARD)
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD)
|
||||
functionNotImplemented();
|
||||
if (arg < 0) {
|
||||
throw RuntimeError("Invalid dbit offset: " + std::to_string(arg));
|
||||
@ -1329,7 +1332,7 @@ int ClientInterface::set_dbit_offset(Interface &socket) {
|
||||
}
|
||||
|
||||
int ClientInterface::get_dbit_offset(Interface &socket) {
|
||||
if (detType != CHIPTESTBOARD)
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD)
|
||||
functionNotImplemented();
|
||||
int retval = impl()->getDbitOffset();
|
||||
LOG(logDEBUG1) << "Dbit offset retval: " << retval;
|
||||
@ -1735,7 +1738,7 @@ int ClientInterface::get_receiver_roi(Interface &socket) {
|
||||
|
||||
int ClientInterface::set_receiver_roi(Interface &socket) {
|
||||
auto arg = socket.Receive<ROI>();
|
||||
if (detType == CHIPTESTBOARD)
|
||||
if (detType == CHIPTESTBOARD || detType == XILINX_CHIPTESTBOARD)
|
||||
functionNotImplemented();
|
||||
LOG(logDEBUG1) << "Set Receiver ROI: " << ToString(arg);
|
||||
verifyIdle(socket);
|
||||
@ -1751,7 +1754,7 @@ int ClientInterface::set_receiver_roi(Interface &socket) {
|
||||
|
||||
int ClientInterface::set_receiver_roi_metadata(Interface &socket) {
|
||||
auto arg = socket.Receive<ROI>();
|
||||
if (detType == CHIPTESTBOARD)
|
||||
if (detType == CHIPTESTBOARD || detType == XILINX_CHIPTESTBOARD)
|
||||
functionNotImplemented();
|
||||
LOG(logDEBUG1) << "Set Receiver ROI Metadata: " << ToString(arg);
|
||||
verifyIdle(socket);
|
||||
@ -1768,7 +1771,7 @@ int ClientInterface::set_receiver_roi_metadata(Interface &socket) {
|
||||
int ClientInterface::set_num_transceiver_samples(Interface &socket) {
|
||||
auto value = socket.Receive<int>();
|
||||
LOG(logDEBUG1) << "Setting num transceiver samples to " << value;
|
||||
if (detType != CHIPTESTBOARD) {
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
try {
|
||||
|
@ -480,6 +480,7 @@ void DataProcessor::PadMissingPackets(sls_receiver_header header, char *data) {
|
||||
memset(data + (pnum * dsize), 0xFF, dsize + 2);
|
||||
break;
|
||||
case CHIPTESTBOARD:
|
||||
case XILINX_CHIPTESTBOARD:
|
||||
if (pnum == (pperFrame - 1))
|
||||
memset(data + (pnum * dsize), 0xFF, corrected_dsize);
|
||||
else
|
||||
|
@ -648,4 +648,122 @@ class ChipTestBoardData : public GeneralData {
|
||||
};
|
||||
};
|
||||
|
||||
class XilinxChipTestBoardData : public GeneralData {
|
||||
private:
|
||||
const int NCHAN_DIGITAL = 64;
|
||||
const int NUM_BYTES_PER_ANALOG_CHANNEL = 2;
|
||||
const int NUM_BYTES_PER_TRANSCEIVER_CHANNEL = 8;
|
||||
int nAnalogBytes = 0;
|
||||
int nDigitalBytes = 0;
|
||||
int nTransceiverBytes = 0;
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
XilinxChipTestBoardData() {
|
||||
detType = slsDetectorDefs::XILINX_CHIPTESTBOARD;
|
||||
nPixelsY = 1; // number of samples
|
||||
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
|
||||
frameIndexMask = 0xFFFFFF; // 10g
|
||||
frameIndexOffset = 8; // 10g
|
||||
packetIndexMask = 0xFF; // 10g
|
||||
framesPerFile = XILINX_CTB_MAX_FRAMES_PER_FILE;
|
||||
fifoDepth = 2500;
|
||||
standardheader = true;
|
||||
dataSize = 8144;
|
||||
packetSize = headerSizeinPacket + dataSize;
|
||||
tengigaEnable = true;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
public:
|
||||
int GetNumberOfAnalogDatabytes() { return nAnalogBytes; };
|
||||
|
||||
int GetNumberOfDigitalDatabytes() { return nDigitalBytes; };
|
||||
|
||||
int GetNumberOfTransceiverDatabytes() { return nTransceiverBytes; };
|
||||
|
||||
void SetNumberOfAnalogSamples(int n) {
|
||||
nAnalogSamples = n;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
void SetNumberOfDigitalSamples(int n) {
|
||||
nDigitalSamples = n;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
void SetNumberOfTransceiverSamples(int n) {
|
||||
nTransceiverSamples = n;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
void SetOneGigaAdcEnableMask(int n) {
|
||||
adcEnableMaskOneGiga = n;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
void SetTenGigaAdcEnableMask(int n) {
|
||||
adcEnableMaskTenGiga = n;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
void SetTransceiverEnableMask(int n) {
|
||||
transceiverMask = n;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
void SetReadoutMode(slsDetectorDefs::readoutMode r) {
|
||||
readoutType = r;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
private:
|
||||
void UpdateImageSize() {
|
||||
nAnalogBytes = 0;
|
||||
nDigitalBytes = 0;
|
||||
nTransceiverBytes = 0;
|
||||
int nAnalogChans = 0, nDigitalChans = 0, nTransceiverChans = 0;
|
||||
|
||||
// analog channels (normal, analog/digital readout)
|
||||
if (readoutType == slsDetectorDefs::ANALOG_ONLY ||
|
||||
readoutType == slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
uint32_t adcEnableMask = adcEnableMaskTenGiga;
|
||||
nAnalogChans = __builtin_popcount(adcEnableMask);
|
||||
|
||||
nAnalogBytes =
|
||||
nAnalogChans * NUM_BYTES_PER_ANALOG_CHANNEL * nAnalogSamples;
|
||||
LOG(logDEBUG1) << " Number of Analog Channels:" << nAnalogChans
|
||||
<< " Databytes: " << nAnalogBytes;
|
||||
}
|
||||
// digital channels
|
||||
if (readoutType == slsDetectorDefs::DIGITAL_ONLY ||
|
||||
readoutType == slsDetectorDefs::ANALOG_AND_DIGITAL ||
|
||||
readoutType == slsDetectorDefs::DIGITAL_AND_TRANSCEIVER) {
|
||||
nDigitalChans = NCHAN_DIGITAL;
|
||||
nDigitalBytes = (sizeof(uint64_t) * nDigitalSamples);
|
||||
LOG(logDEBUG1) << "Number of Digital Channels:" << nDigitalChans
|
||||
<< " Databytes: " << nDigitalBytes;
|
||||
}
|
||||
// transceiver channels
|
||||
if (readoutType == slsDetectorDefs::TRANSCEIVER_ONLY ||
|
||||
readoutType == slsDetectorDefs::DIGITAL_AND_TRANSCEIVER) {
|
||||
nTransceiverChans = __builtin_popcount(transceiverMask);
|
||||
;
|
||||
nTransceiverBytes = nTransceiverChans *
|
||||
NUM_BYTES_PER_TRANSCEIVER_CHANNEL *
|
||||
nTransceiverSamples;
|
||||
LOG(logDEBUG1) << "Number of Transceiver Channels:"
|
||||
<< nTransceiverChans
|
||||
<< " Databytes: " << nTransceiverBytes;
|
||||
}
|
||||
nPixelsX = nAnalogChans + nDigitalChans + nTransceiverChans;
|
||||
|
||||
imageSize = nAnalogBytes + nDigitalBytes + nTransceiverBytes;
|
||||
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
|
||||
|
||||
LOG(logDEBUG1) << "Total Number of Channels:" << nPixelsX
|
||||
<< " Databytes: " << imageSize;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace sls
|
||||
|
@ -116,6 +116,7 @@ void Implementation::setDetectorType(const detectorType d) {
|
||||
case JUNGFRAU:
|
||||
case MOENCH:
|
||||
case CHIPTESTBOARD:
|
||||
case XILINX_CHIPTESTBOARD:
|
||||
case MYTHEN3:
|
||||
case GOTTHARD2:
|
||||
LOG(logINFO) << " ***** " << ToString(d) << " Receiver *****";
|
||||
@ -145,6 +146,9 @@ void Implementation::setDetectorType(const detectorType d) {
|
||||
case CHIPTESTBOARD:
|
||||
generalData = new ChipTestBoardData();
|
||||
break;
|
||||
case XILINX_CHIPTESTBOARD:
|
||||
generalData = new XilinxChipTestBoardData();
|
||||
break;
|
||||
case MYTHEN3:
|
||||
generalData = new Mythen3Data();
|
||||
break;
|
||||
|
@ -471,6 +471,7 @@ void Listener::CopyPacket(char *dst, char *src, uint32_t dataSize,
|
||||
memcpy(dst + dataSize - 2, &src[detHeaderSize], dataSize + 2);
|
||||
break;
|
||||
case CHIPTESTBOARD:
|
||||
case XILINX_CHIPTESTBOARD:
|
||||
if (pnum == (generalData->packetsPerFrame - 1))
|
||||
memcpy(dst + (pnum * dataSize), &src[detHeaderSize],
|
||||
correctedDataSize);
|
||||
|
@ -31,6 +31,9 @@ void MasterAttributes::GetBinaryAttributes(
|
||||
case slsDetectorDefs::CHIPTESTBOARD:
|
||||
GetCtbBinaryAttributes(w);
|
||||
break;
|
||||
case slsDetectorDefs::XILINX_CHIPTESTBOARD:
|
||||
GetXilinxCtbBinaryAttributes(w);
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Unknown Detector type to get master attributes");
|
||||
}
|
||||
@ -63,6 +66,9 @@ void MasterAttributes::WriteHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
case slsDetectorDefs::CHIPTESTBOARD:
|
||||
WriteCtbHDF5Attributes(fd, group);
|
||||
break;
|
||||
case slsDetectorDefs::XILINX_CHIPTESTBOARD:
|
||||
WriteXilinxCtbHDF5Attributes(fd, group);
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Unknown Detector type to get master attributes");
|
||||
}
|
||||
@ -814,4 +820,49 @@ void MasterAttributes::WriteCtbHDF5Attributes(H5::H5File *fd,
|
||||
}
|
||||
#endif
|
||||
|
||||
void MasterAttributes::GetXilinxCtbBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w) {
|
||||
w->Key("Exptime");
|
||||
w->String(ToString(exptime).c_str());
|
||||
w->Key("Period");
|
||||
w->String(ToString(period).c_str());
|
||||
w->Key("ADC Mask");
|
||||
w->String(ToStringHex(adcmask).c_str());
|
||||
w->Key("Analog Flag");
|
||||
w->Uint(analog);
|
||||
w->Key("Analog Samples");
|
||||
w->Uint(analogSamples);
|
||||
w->Key("Digital Flag");
|
||||
w->Uint(digital);
|
||||
w->Key("Digital Samples");
|
||||
w->Uint(digitalSamples);
|
||||
w->Key("Dbit Offset");
|
||||
w->Uint(dbitoffset);
|
||||
w->Key("Dbit Bitset");
|
||||
w->Uint64(dbitlist);
|
||||
w->Key("Transceiver Mask");
|
||||
w->String(ToStringHex(transceiverMask).c_str());
|
||||
w->Key("Transceiver Flag");
|
||||
w->Uint(transceiver);
|
||||
w->Key("Transceiver Samples");
|
||||
w->Uint(transceiverSamples);
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteXilinxCtbHDF5Attributes(H5::H5File *fd,
|
||||
H5::Group *group) {
|
||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||
MasterAttributes::WriteHDF5Period(fd, group);
|
||||
MasterAttributes::WriteHDF5AdcMask(fd, group);
|
||||
MasterAttributes::WriteHDF5AnalogFlag(fd, group);
|
||||
MasterAttributes::WriteHDF5AnalogSamples(fd, group);
|
||||
MasterAttributes::WriteHDF5DigitalFlag(fd, group);
|
||||
MasterAttributes::WriteHDF5DigitalSamples(fd, group);
|
||||
MasterAttributes::WriteHDF5DbitOffset(fd, group);
|
||||
MasterAttributes::WriteHDF5DbitList(fd, group);
|
||||
MasterAttributes::WriteHDF5TransceiverMask(fd, group);
|
||||
MasterAttributes::WriteHDF5TransceiverFlag(fd, group);
|
||||
MasterAttributes::WriteHDF5TransceiverSamples(fd, group);
|
||||
}
|
||||
#endif
|
||||
} // namespace sls
|
||||
|
@ -152,6 +152,12 @@ class MasterAttributes {
|
||||
#ifdef HDF5C
|
||||
void WriteCtbHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
|
||||
void GetXilinxCtbBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteXilinxCtbHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace sls
|
||||
|
@ -22,14 +22,15 @@ namespace sls {
|
||||
#define HDF5_WRITER_VERSION (6.6) // 1 decimal places
|
||||
#define BINARY_WRITER_VERSION (7.2) // 1 decimal places
|
||||
|
||||
#define MAX_FRAMES_PER_FILE 20000
|
||||
#define SHORT_MAX_FRAMES_PER_FILE 100000
|
||||
#define EIGER_MAX_FRAMES_PER_FILE 10000
|
||||
#define JFRAU_MAX_FRAMES_PER_FILE 10000
|
||||
#define MOENCH_MAX_FRAMES_PER_FILE 100000
|
||||
#define CTB_MAX_FRAMES_PER_FILE 20000
|
||||
#define MYTHEN3_MAX_FRAMES_PER_FILE 10000
|
||||
#define GOTTHARD2_MAX_FRAMES_PER_FILE 20000
|
||||
#define MAX_FRAMES_PER_FILE 20000
|
||||
#define SHORT_MAX_FRAMES_PER_FILE 100000
|
||||
#define EIGER_MAX_FRAMES_PER_FILE 10000
|
||||
#define JFRAU_MAX_FRAMES_PER_FILE 10000
|
||||
#define MOENCH_MAX_FRAMES_PER_FILE 100000
|
||||
#define CTB_MAX_FRAMES_PER_FILE 20000
|
||||
#define XILINX_CTB_MAX_FRAMES_PER_FILE 20000
|
||||
#define MYTHEN3_MAX_FRAMES_PER_FILE 10000
|
||||
#define GOTTHARD2_MAX_FRAMES_PER_FILE 20000
|
||||
|
||||
#define STATISTIC_FRAMENUMBER_INFINITE (20000)
|
||||
|
||||
|
Reference in New Issue
Block a user