commands code generation (#871)

* commands code generation  (#803)

* commands code generation for only frames command

* fix cmake file and add Caller files

* working exptime, fully extended commands file and its variants

* start adding template commands

* add INT_CMD_VEC_ID template

* add list command, generate multiple bins, format code

* reach 208 commands using the cpp macros

* add tests for command parser

* start adding tests for commands parser

* fix typo to use commands.yaml

* add more tests for command_parser

* add all template functions (up to 218 commands)

* finish template functions and add more CmdProxy.cpp functions (250+)

* 257 commands

* 300 commands the rest are very special commands

* add special commands without generation

* separate special functions from generated c++ file

* implementing one command for put and get (buggy)

* add infer action in a separate file

* generate header for special commands from yaml

* allow only 0 or 1 for bool inputs

* group all commands in gen_commands.py

* add help to gen_commands.py

* add autocomplete bash script

* autocompletion: add support for module levels and help

* remove debugging line

* add autocompletion, help to commands, change int [0,1] to bool

* copy tests for Caller.cpp. Tests pass

* update with the new developer branch changes

* fix errors after merging (there is problems with tests)

* fixed port/stopport in yaml (intput typo), added '_caller' to the test dac and test on chip dac command in global test for cmdcaller

* undo previous test simulator debug change

* add documentation for the generated code

* reducing the comment to be replaced in length so formatting does not split into 2 lines

* removed formatting specific style of C++11 in gen_commands.py to keep with the top level clang format of the project
* regeneratign code for commands

* automation generated

* Redirect deprecated commands (#872)

* working implementation, need to fix dac

* fixed deprecation redirect for dac command

* Detector specific autocomplete (#873)

* working implementation, need to fix dac

* fixed deprecation redirect for dac command

* detector specific completion for dac

* added autocomplete using detector specific

* fixed error when autocompleting partial words

* Generate commands/fix commands (#875)

* fix vm_a, im_a etc have deg Celsius suffix, also help missing or changed in some places

* dac: require det id for all, arg0 to be printed at output, help for onchip dac and dac, onchipdac: spacing

* getscan detid and blocking trigger help

* udp_Dstlist det_id fixed, but rx_id invalid

* cmdApp in line with cmdLineApp (missing version, receiver_id, not creating det object in help action

* added set_command to differentiate between check_det_id and require_det_id (mixed up), args: -1 needs to check for at least one argument

* reordering

* reordering and checked till integer_command_hex

* fixed a lot more commands

* fix caller tests for eiger

* changes to tests after Bechir left

* changing .cmd to .cmdcall for the caller commands

* fixed tests for caller, still warning for setexptime about cast input

* autocomplete ran

* add moench test

* regenerating autocomplete and commands

* fixing other things from merge conflicts (renaming slsDetectorDefs to defs in commands.yaml)

* formatting

* added code injection to help (#876)

* updated 3 commands to have get output that can be put into put (#877)

* updated some commands to have get output that can be put into put

* fix tests for clkdiv

* adding help to free (#878)

* removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy) (#879)

* More helpful error messages for unsupported actions (#880)

* removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy)

* Added specific help for unsupported actions

* fixed a vetofile get special exception message. more specific warning for special exception message instead of no function warning

* added condition checking true in exceptions for special message

---------
Co-authored-by: Bechir Brahem <bachbrahem@gmail.com>
Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
2023-12-13 14:43:38 +01:00
committed by GitHub
parent d72c9e29a4
commit ce7270e8a2
63 changed files with 180123 additions and 9134 deletions

View File

@ -0,0 +1,319 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "sls/string_utils.h"
#include "sls/sls_detector_defs.h"
#include <sstream>
namespace sls {
std::string GetHelpDac(std::string dac) {
if (sls::is_int(dac)) {
return std::string("[dac name] [dac or mV value] [(optional unit) mV] "
"\n\t[Ctb] Use dac index for dac name.");
}
if (dac == "vthreshold") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] "
"Detector threshold voltage for single photon counters.\n\t[Eiger] "
"Sets vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr and vcp to the same "
"value. \n\t[Mythen3] Sets vth1, vth2 and vth3 to the same value "
"for enabled counters.");
}
if (dac == "vsvp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? ");
}
if (dac == "vsvn") {
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
"Dac for ?? \n\t[Mythen3] voltage to define "
"feedback resistance of the first shaper");
}
if (dac == "vtrim") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? "
"\n\t[Mythen3] Dac for the voltage defining the trim bit size.");
}
if (dac == "vrpreamp") {
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
"Dac for ?? \n\t[Mythen3] voltage to define the "
"preamplifier feedback resistance.");
}
if (dac == "vrshaper") {
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
"Dac for ?? \n\t[Mythen3] voltage to define "
"feedback resistance of the first shaper");
}
if (dac == "vtgstv") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_ll") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_lr") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcal") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_rl") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_rr") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "rxb_rb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "rxb_lb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcn") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vishaper") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "iodelay") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vref_ds") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ??");
}
if (dac == "vcascn_pb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vcascp_pb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vout_cm") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 5");
}
if (dac == "vcasc_out") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vin_cm") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 2");
}
if (dac == "vref_comp") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ??");
}
if (dac == "ib_test_c") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vrshaper_n") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] voltage to "
"define feedback resistance of the second shaper.");
}
if (dac == "vipre") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's input transistor current.\n\t[Moench] Dac for 1");
}
if (dac == "vdcsh") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"reference (DC) voltage for the shaper.");
}
if (dac == "vth1") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for first "
"detector threshold voltage. Overwrites even if counter disabled.");
}
if (dac == "vth2") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"second detector threshold voltage. Overwrites even if counter "
"disabled.");
}
if (dac == "vth3") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for third "
"detector threshold voltage. Overwrites even if counter disabled.");
}
if (dac == "vcal_n") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"low voltage for analog pulsing.");
}
if (dac == "vcal_p") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"high voltage for analog pulsing.");
}
if (dac == "vcassh") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"shaper's cascode voltage.");
}
if (dac == "vcas") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's cascode voltage.");
}
if (dac == "vicin") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"bias current for the comparator.");
}
if (dac == "vipre_out") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"preamplifier's output transistor current.");
}
if (dac == "vref_h_adc") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage high of ADC.");
}
if (dac == "vb_comp_fe") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of analogue front end.");
}
if (dac == "vb_comp_adc") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of ADC.");
}
if (dac == "vcom_cds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of CDS stage.");
}
if (dac == "vref_rstore") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard2] Dac for reference charging voltage "
"of temparory storage cell in high gain.");
}
if (dac == "vb_opa_1st") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] dac dac for "
"opa current for driving the other DACs in chip.");
}
if (dac == "vref_comp_fe") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of the comparator of analogue front end.");
}
if (dac == "vcom_adc1") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 1.");
}
if (dac == "vref_prech") {
return std::string(
"[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard2][Jungfrau] "
"Dac for reference votlage for precharing the preamplifier.");
}
if (dac == "vref_l_adc") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage low for ADC.");
}
if (dac == "vref_cds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of CDS applied to the temporary storage cell in "
"medium and low gain.");
}
if (dac == "vb_cs") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current injection into preamplifier.");
}
if (dac == "vb_opa_fd") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current for CDS opa stage.");
}
if (dac == "vcom_adc2") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 2.");
}
if (dac == "vb_ds") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vb_comp") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vb_pixbuf") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vin_com") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vdd_prot") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Jungfrau] Dac for ??");
}
if (dac == "vbp_colbuf") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0");
}
if (dac == "vb_sda") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3");
}
if (dac == "vcasc_sfp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4");
}
if (dac == "vipre_cds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6");
}
if (dac == "ibias_sfp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 7");
}
// clang-format off
if (dac == "vtgstv") { return std::string(""); }
// clang-format on
throw sls::RuntimeError("Unknown dac command");
}
std::string GetHelpDacWrapper(const std::string &cmd,
const std::vector<std::string> &args) {
std::ostringstream os;
os << cmd << ' ';
if (args.size() == 0) {
os << GetHelpDac(std::to_string(0)) << '\n';
} else {
os << args[0] << ' ' << GetHelpDac(args[0]) << '\n';
}
return os.str();
}
} // namespace sls