pflib v2.7.0-1-gd371ab6a
Polarfire Interaction Library
pflib::PolarfireTarget Struct Reference

Interface to a single polarfire. More...

#include <PolarfireTarget.h>

Collaboration diagram for pflib::PolarfireTarget:
[legend]

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?
 
WishboneInterfacewb
 handle to opened wishbone interface
 
Backendbackend
 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::stringdefault_configs_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PolarfireTarget() [1/2]

pflib::PolarfireTarget::PolarfireTarget ( WishboneInterface wbi,
Backend be,
bool  same = false 
)

Define where the polarfire we will be talking to is.

Note
This object takes ownership of the input pointers. If they are the same pointers to the same object (defined by same), then only one is deleted in the destructor.
Parameters
[in]wbipointer to object to use as wishbone interface
[in]bepointer to object to use as backend
[in]sametrue if the object pointed to be wbi and be is a single object

◆ PolarfireTarget() [2/2]

template<class T >
pflib::PolarfireTarget::PolarfireTarget ( T *  t)
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.

Template Parameters
Tclass that inherits from both WishboneInterface and Backend
Parameters
[in]tpointer to object that is both a wishbone interface and a backend

Member Function Documentation

◆ bitslip_loop()

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.

Parameters
[in]ilinklink index to loop over
[out]best_slipset to best bitslip value
[out]best_countset to number of idles that were correct for the best slip
Returns
true if best slip value is perfect (i.e. link is aligned) (all possible words were corect pattern)

◆ delay_loop()

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.

Parameters
[in]ilinklink index to test
[in]min_delayminimum value of delay parameter
[in]max_delaymaximum value of delay parameter

◆ dumpSettings()

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.

◆ elinksBigSpy()

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).

◆ enableZeroSuppression()

void pflib::PolarfireTarget::enableZeroSuppression ( int  link,
bool  full_suppress 
)

Enable zero suppression in the input link.

link == -1 is all links

◆ getFirmwareVersion()

std::pair< int, int > pflib::PolarfireTarget::getFirmwareVersion ( )

deduce firmware major/minor version

Returns
{major,minor} pair

◆ loadBiasSettings()

bool pflib::PolarfireTarget::loadBiasSettings ( const std::string file_name)

Files ending in .csv

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

Files ending in .yaml or .yml

Prints a not-implemented error.

Other extensions

Prints a error.

Returns
false if unable to open file

◆ loadIntegerCSV()

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:

void Action(const std::vector<int>&)

or a lambda like

[](const std::vector<int>&) {
//blah
}
Returns
false if unable to open file

◆ loadROCParameters()

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.

Returns
false if unable to open file

◆ loadROCRegisters()

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.

Returns
false if unable to open file

Member Data Documentation

◆ NLINKS

int pflib::PolarfireTarget::NLINKS = 8
static

number of links

need to read this eventually


The documentation for this struct was generated from the following files: