pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
Compile.h
Go to the documentation of this file.
1
7#ifndef PFLIB_COMPILE_H
8#define PFLIB_COMPILE_H
9
10#include <stdint.h>
11
12#include <map>
13#include <string>
14#include <vector>
15
16#include "pflib/logging/Logging.h"
18
19namespace YAML {
20class Node;
21}
22
30template <typename Key, typename Val>
31class NoCopyMap;
32class Parameter;
36
37namespace pflib {
38
43
55class Compiler {
56 public:
60 static Compiler get(const std::string& type_version);
61
94 void compile(const std::string& page, const std::string& param,
95 const uint64_t& val,
96 std::map<int, std::map<int, uint8_t>>& registers);
97
109 const std::string& param_name,
110 const uint64_t& val);
111
141
143
150
177 const std::map<int, std::map<int, uint8_t>>& compiled_config,
178 bool be_careful, bool little_endian = false);
179
186
196
235 void extract(
236 const std::vector<std::string>& setting_files,
238
250 const std::vector<std::string>& setting_files,
251 bool prepend_defaults = true);
252
264 bool prepend_defaults = true);
265
266 private:
271 Compiler(const ParameterLUT& parameter_lut, const PageLUT& page_lut);
272
284 void extract(
285 YAML::Node params,
287
288 private:
289 const ParameterLUT& parameter_lut_;
290 const PageLUT& page_lut_;
291 mutable ::pflib::logging::logger the_log_{::pflib::logging::get("compile")};
292};
293} // namespace pflib
294
295#endif
forward declare register map LUT types
Definition register_maps_types.h:96
The object that does the compiling.
Definition Compile.h:55
static Compiler get(const std::string &type_version)
Get an instance of the compiler for the input chip type_version string.
Definition Compile.cxx:24
void extract(const std::vector< std::string > &setting_files, std::map< std::string, std::map< std::string, uint64_t > > &settings)
Extract the page name, parameter name, and parameter values from the YAML files into the passed setti...
Definition Compile.cxx:400
std::vector< int > get_known_pages()
Get the known pages from the LUTs.
Definition Compile.cxx:207
Compiler(const ParameterLUT &parameter_lut, const PageLUT &page_lut)
Private constructor, only access Compiler instances from the static get method so that we can ensure ...
Definition Compile.cxx:35
void compile(const std::string &page, const std::string &param, const uint64_t &val, std::map< int, std::map< int, uint8_t > > &registers)
Overlay a single parameter onto the input register map.
Definition Compile.cxx:53
std::map< int, std::map< int, uint8_t > > getRegisters(const std::string &page)
get the registers corresponding to the input page
Definition Compile.cxx:374
std::map< std::string, std::map< std::string, uint64_t > > decompile(const std::map< int, std::map< int, uint8_t > > &compiled_config, bool be_careful, bool little_endian=false)
unpack register values into the page names, parameter names and parameter values mapping
Definition Compile.cxx:216
std::map< std::string, std::map< std::string, uint64_t > > defaults()
get the default parameter values as specified in the manual
Definition Compile.cxx:390
std::map< uint16_t, size_t > build_register_byte_lut()
Definition Compile.cxx:162
logger get(const std::string &name)
Gets a logger with the input name for its channel.
Definition Logging.cxx:24
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3
std::string upper_cp(const std::string &str)
Get a copy of the input string with all caps.
Definition Compile.cxx:18
definition of str_to_int function
A parameter for the HGC ROC includes one or more register locations and a default value defined in th...
Definition register_maps_types.h:47