pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
pflib::ROC Class Reference
Collaboration diagram for pflib::ROC:
[legend]

Classes

class  TestParameters
 test certain parameters before setting them back to old values More...
 

Public Member Functions

 ROC (I2C &i2c, uint8_t roc_base_addr, const std::string &type_version)
 
void setRunMode (bool active=true)
 
bool isRunMode ()
 
const std::stringtype () const
 
std::vector< uint8_t > readPage (int ipage, int len)
 
uint8_t getValue (int page, int offset)
 
void setValue (int page, int offset, uint8_t value)
 
std::vector< std::stringgetDirectAccessParameters ()
 
bool getDirectAccess (const std::string &name)
 
bool getDirectAccess (int reg, int bit)
 
void setDirectAccess (const std::string &name, bool val)
 
void setDirectAccess (int reg, int bit, bool val)
 
void setRegisters (const std::map< int, std::map< int, uint8_t > > &registers)
 set registers on the HGCROC to specific values
 
std::map< int, std::map< int, uint8_t > > getRegisters (const std::map< int, std::map< int, uint8_t > > &selected={})
 get registers from the HGCROC
 
void loadRegisters (const std::string &file_path)
 set registers on the HGCROC to specific values
 
std::map< std::string, uint64_t > getParameters (const std::string &page)
 Get the parameters for the input page.
 
std::map< std::string, std::map< std::string, uint64_t > > defaults ()
 Retrieve all of the manual-documented defaults for all parameters.
 
std::map< int, std::map< int, uint8_t > > applyParameters (const std::map< std::string, std::map< std::string, uint64_t > > &parameters)
 Apply the input parameter mapping onto the chip.
 
void loadParameters (const std::string &file_path, bool prepend_defaults)
 Load the input parameters onto the chip.
 
void applyParameter (const std::string &page, const std::string &param, const uint64_t &val)
 Short-hand for applying a single parameter.
 
void dumpSettings (const std::string &filepath, bool decompile)
 Dump the settings of the HGCROC into the input filepath.
 
TestParameters::Builder testParameters ()
 start a set of test parameters
 

Private Attributes

I2Ci2c_
 
uint8_t roc_base_
 
std::string type_version_
 
Compiler compiler_
 
mutable::pflib::logging::logger the_log_ {::pflib::logging::get("roc")}
 

Static Private Attributes

static const int N_REGISTERS_PER_PAGE = 32
 

Member Function Documentation

◆ applyParameter()

void pflib::ROC::applyParameter ( const std::string & page,
const std::string & param,
const uint64_t & val )

Short-hand for applying a single parameter.

We construct a small std::map and use the applyParameters function above.

Parameters
[in]pagename of page
[in]paramname of parameter in that page
[in]valvalue to set parameter to

◆ applyParameters()

std::map< int, std::map< int, uint8_t > > pflib::ROC::applyParameters ( const std::map< std::string, std::map< std::string, uint64_t > > & parameters)

Apply the input parameter mapping onto the chip.

Parameters
[in]parametersmapping of parameters to apply where the first key is the page name, the second key is the parameter in that page and the value is the parameter value
Returns
chip registers that were on the chip before the application of these parameters, helpful if users want to unset them later with ROC::TestParameters
  1. get registers YAML file contains by compiling without defaults
  1. get the current register values on the chip which is
  1. compile this parameter onto those register values we can use the lower-level compile here because the compile in step 1 checks that all of the page and param names are correct
  1. put these updated values onto the chip

◆ defaults()

std::map< std::string, std::map< std::string, uint64_t > > pflib::ROC::defaults ( )

Retrieve all of the manual-documented defaults for all parameters.

The values are not very interesting (they are all zero in v3 chips), but this can be helpful for looking through a parameter listing organized by page.

Returns
mapping of page->param->value

◆ dumpSettings()

void pflib::ROC::dumpSettings ( const std::string & filepath,
bool decompile )

Dump the settings of the HGCROC into the input filepath.

Parameters
[in]filepathfile to which to dump settings into
[in]decompileif true, decompile the registers into parameters and write a YAML file, else just write a CSV file of the registers

decompile while being careful since we knowingly are attempting to read ALL of the parameters on the chip

◆ getParameters()

std::map< std::string, uint64_t > pflib::ROC::getParameters ( const std::string & page)

Get the parameters for the input page.

Parameters
[in]pagename of page to get parameters for

get registers corresponding to a page

Get the values of these registers from the chip

De-compile the registers back into the parameter mapping

We don't be careful here since we are skipping pages

◆ getRegisters()

std::map< int, std::map< int, uint8_t > > pflib::ROC::getRegisters ( const std::map< int, std::map< int, uint8_t > > & selected = {})

get registers from the HGCROC

Parameters
[in]selectedregisters to get values for, all registers if empty
Returns
register values currently on the chip

When the input map is empty, then read all registers.

When the input map is not empty, only read the registers that are within that mapping.

◆ loadParameters()

void pflib::ROC::loadParameters ( const std::string & file_path,
bool prepend_defaults )

Load the input parameters onto the chip.

Parameters
[in]file_pathpath to YAML file containing parameters to load
[in]prepend_defaultsif true, use the default values for all parameters before applying the YAML file itself, else only apply the parameters contained in the YAML file

If we prepend defaults, then ALL of the parameters will be touched and so we do need to bother reading the current values and overlaying the new ones, instead we jump straight to setting the registers.

If we don't prepend the defaults, then we use the other applyParameters function to overlay the parameters we passed on top of the ones currently on the chip after extracting them from the YAML file.

◆ loadRegisters()

void pflib::ROC::loadRegisters ( const std::string & file_path)

set registers on the HGCROC to specific values

Parameters
[in]file_pathpath to CSV file containing register values, the first column is the page, the second column is the register in that page, and then the last column is the value of the register

◆ setRegisters()

void pflib::ROC::setRegisters ( const std::map< int, std::map< int, uint8_t > > & registers)

set registers on the HGCROC to specific values

Parameters
[in]registersThe input map has the page as the first key and the register in the page as the second key and then the 8-bit register value.

◆ testParameters()

ROC::TestParameters::Builder pflib::ROC::testParameters ( )

start a set of test parameters

Use when you want to temporarily set parameters on the chip which will then be re-set back to their previous values later.

example

// PAGE.PARAM1 and PAGE.PARAM2 have some values from
// previous settings that were applied
{
auto test_parameter_handle = roc.testParameters()
.add("PAGE", "PARAM1", 42)
.add("PAGE", "PARAM2", 32);
.apply();
// PAGE.PARAM1 == 42 and PAGE.PARAM2 == 32
}
// PAGE.PARAM1 restored to previous settings
static void roc(const std::string &cmd, Target *pft)
ROC menu commands.
Definition roc.cxx:119

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