pflib v2.7.0-1-gd371ab6a
Polarfire Interaction Library
|
Interface to a single polarfire. More...
#include <PolarfireTarget.h>
Public Member Functions | |
PolarfireTarget (WishboneInterface *wbi, Backend *be, bool same=false) | |
Define where the polarfire we will be talking to is. More... | |
template<class T > | |
PolarfireTarget (T *t) | |
If only a single pointer is provided, assume that object is BOTH the WBI and backend. More... | |
~PolarfireTarget () | |
Cleanup the wishbone interface and backend checking if they are the same. | |
std::pair< int, int > | getFirmwareVersion () |
deduce firmware major/minor version More... | |
std::vector< uint32_t > | elinksBigSpy (int ilink, int presamples, bool do_l1a) |
Entire ldmx_link function commented out pretty much. More... | |
void | elinkStatus (std::ostream &os) |
Print a decoded elink status to the input ostream MOVE TO ELINKS. | |
void | loadIntegerCSV (const std::string &file_name, const std::function< void(const std::vector< int > &)> &Action) |
Load an integer CSV and pass the rows one at a time to the input Action. More... | |
void | loadROCRegisters (int roc, const std::string &file_name) |
Load register values onto ROC chip from inptu file. More... | |
void | loadROCParameters (int roc, const std::string &file_name, bool prepend_defaults) |
Compile the input YAML file including the defaults if prepend_defaults is true, otherwise using current ROC settings as "base" settings, then writes register values onto chip. More... | |
void | findDefaultROCParameters (std::vector< std::string > paths) |
Stores paths of default ROC config files, as given by the pftoolrc. | |
void | loadDefaultROCParameters () |
Loads the default ROC config on boards where it is specified. | |
void | dumpSettings (int roc, const std::string &file_name, bool decompile) |
Request all of the ROC setting register values. More... | |
void | prepareNewRun () |
void | daqStatus (std::ostream &os) |
Print a decoded daq status to the input ostream MOVE TO DAQ. | |
void | enableZeroSuppression (int link, bool full_suppress) |
Enable zero suppression in the input link. More... | |
void | daqSoftReset () |
daq soft reset stays here becauses uses FC as well as DAQ | |
void | daqHardReset () |
daq hard reset stays here because uses backend | |
std::vector< uint32_t > | daqReadDirect () |
daq read direct uses backend | |
std::vector< uint32_t > | daqReadEvent () |
daq read event make sure to prepareNewRun before! | |
void | setBiasSetting (int board, bool led, int hdmi, int val) |
set a single bias setting | |
bool | loadBiasSettings (const std::string &file_name) |
void | elink_relink (int ilink, int min_delay=0, int max_delay=128) |
Carries out the standard elink alignment process. | |
void | delay_loop (int ilink, int min_delay, int max_delay) |
Go from min_delay up to max_delay stopping only if alignment is achieved. More... | |
bool | bitslip_loop (int ilink, int &best_slip, int &best_count) |
check all bitslip values and find the one with the most correct idle patterns More... | |
Public Attributes | |
bool | wb_be_same |
are the WBI and Backend the same object? | |
WishboneInterface * | wb |
handle to opened wishbone interface | |
Backend * | backend |
handle to opened backend connection | |
Hcal | hcal |
object representing hcal motherboard | |
Static Public Attributes | |
static const int | N_PAGES = 300 |
number of availabe pages on HGC ROC | |
static const int | N_REGISTERS_PER_PAGE = 16 |
number of registers per page of HGC ROC | |
static int | NLINKS = 8 |
number of links More... | |
Private Attributes | |
int | samples_per_event_ |
std::vector< std::string > | default_configs_ |
Interface to a single polarfire.
This class holds the objects that talk with the polarfire and defines higher-level functionality allowing for automatic initialization, configuration, and running.
In order to assist in developing the helpful debugging tool 'pftool', the members of this class will also be public.
pflib::PolarfireTarget::PolarfireTarget | ( | WishboneInterface * | wbi, |
Backend * | be, | ||
bool | same = false |
||
) |
Define where the polarfire we will be talking to is.
[in] | wbi | pointer to object to use as wishbone interface |
[in] | be | pointer to object to use as backend |
[in] | same | true if the object pointed to be wbi and be is a single object |
|
inline |
If only a single pointer is provided, assume that object is BOTH the WBI and backend.
This is templated so that this class does not need to change upon the addition of a new wishbone interface/backend combo object.
T | class that inherits from both WishboneInterface and Backend |
[in] | t | pointer to object that is both a wishbone interface and a backend |
bool pflib::PolarfireTarget::bitslip_loop | ( | int | ilink, |
int & | best_slip, | ||
int & | best_count | ||
) |
check all bitslip values and find the one with the most correct idle patterns
each spy returns 60 bytes (or 15 4-byte words), the idle pattern is 0x9c or 0xac followed by three 0xcc.
[in] | ilink | link index to loop over |
[out] | best_slip | set to best bitslip value |
[out] | best_count | set to number of idles that were correct for the best slip |
void pflib::PolarfireTarget::delay_loop | ( | int | ilink, |
int | min_delay, | ||
int | max_delay | ||
) |
Go from min_delay up to max_delay stopping only if alignment is achieved.
Using bitslip_loop to test each delay value.
[in] | ilink | link index to test |
[in] | min_delay | minimum value of delay parameter |
[in] | max_delay | maximum value of delay parameter |
void pflib::PolarfireTarget::dumpSettings | ( | int | roc, |
const std::string & | file_name, | ||
bool | decompile | ||
) |
Request all of the ROC setting register values.
The input lets you choose if you want the output to be "decompiled", i.e. the the registr values are unpacked into the parameter values.
std::vector< uint32_t > pflib::PolarfireTarget::elinksBigSpy | ( | int | ilink, |
int | presamples, | ||
bool | do_l1a | ||
) |
Entire ldmx_link function commented out pretty much.
Do a "big spy" on the input elinks. We optionally allow for the bigspy to be triggered with an L1A (do_l1a == true) or just spy immediately (do_l1a == false).
void pflib::PolarfireTarget::enableZeroSuppression | ( | int | link, |
bool | full_suppress | ||
) |
Enable zero suppression in the input link.
link == -1 is all links
std::pair< int, int > pflib::PolarfireTarget::getFirmwareVersion | ( | ) |
deduce firmware major/minor version
bool pflib::PolarfireTarget::loadBiasSettings | ( | const std::string & | file_name | ) |
Defines an Action with calls setBiasSetting if there are four columns. [board,0=SiPM/1=LED,hdmi#,value]
Prints a warning on non-four columns returns false if unable to open file
Prints a not-implemented error.
Prints a error.
void pflib::PolarfireTarget::loadIntegerCSV | ( | const std::string & | file_name, |
const std::function< void(const std::vector< int > &)> & | Action | ||
) |
Load an integer CSV and pass the rows one at a time to the input Action.
Action is a function that looks like:
or a lambda like
void pflib::PolarfireTarget::loadROCParameters | ( | int | roc, |
const std::string & | file_name, | ||
bool | prepend_defaults | ||
) |
Compile the input YAML file including the defaults if prepend_defaults is true, otherwise using current ROC settings as "base" settings, then writes register values onto chip.
void pflib::PolarfireTarget::loadROCRegisters | ( | int | roc, |
const std::string & | file_name | ||
) |
Load register values onto ROC chip from inptu file.
Defines an Action with calls ROC::setValue if there are three cells and prints a warning otherwise.
|
static |
number of links
need to read this eventually