scc
2024.06
SystemC components library
|
design configuration reader More...
#include <configurer.h>
Classes | |
struct | ConfigHolder |
Public Member Functions | |
configurer (std::string const &filename, unsigned sc_attr_config_phases=BEFORE_END_OF_ELABORATION) | |
configurer (const configurer &)=delete | |
configurer (configurer &&)=delete | |
configurer & | operator= (const configurer &)=delete |
configurer & | operator= (configurer &&)=delete |
void | read_input_file (std::string const &filename) |
void | configure () |
void | dump_configuration (std::ostream &os=std::cout, bool as_yaml=true, bool with_description=false, bool complete=true, sc_core::sc_object *obj=nullptr) |
void | dump_configuration (std::string const &file_name, bool with_description=false, bool complete=true, std::vector< std::string > stop_list=std::vector< std::string >{}) |
template<typename T > | |
void | set_value (std::string const &hier_name, T value) |
void | set_value_from_str (const std::string &hier_name, const std::string &value) |
void | set_configuration_value (sc_core::sc_attr_base *attr_base, sc_core::sc_object *owner) |
Static Public Member Functions | |
static configurer & | get () |
Protected Attributes | |
unsigned const | config_phases |
std::string | dump_file_name {""} |
bool | with_description {false} |
bool | complete {true} |
std::vector< std::string > | stop_list {} |
broker_t | cci_broker |
cci_param_cln | cci2sc_attr |
cci::cci_originator | cci_originator |
std::unique_ptr< ConfigHolder > | root |
design configuration reader
A class to configure a design hierarchy using a JSON input file. It reads a file and and stores its values into a CCI broker. It can apply the value also to sc_attribute once the design is installed.
Definition at line 41 of file configurer.h.
scc::configurer::configurer | ( | std::string const & | filename, |
unsigned | sc_attr_config_phases = BEFORE_END_OF_ELABORATION |
||
) |
create a configurer using an input file
filename | the input file to read containing the values to apply |
sc_attr_config_phases | defines when to apply the values to sc_attribute instances |
Definition at line 652 of file configurer.cpp.
void scc::configurer::configure | ( | ) |
configure the design hierarchy using the input file. Apply the values to sc_core::sc_attribute in th edsign hierarchy
Definition at line 711 of file configurer.cpp.
void scc::configurer::dump_configuration | ( | std::ostream & | os = std::cout , |
bool | as_yaml = true , |
||
bool | with_description = false , |
||
bool | complete = true , |
||
sc_core::sc_object * | obj = nullptr |
||
) |
dump the parameters of a design hierarchy to output stream immediately
os | the output stream, std::cout by default |
obj | if not null specifies the root object of the dump |
Definition at line 686 of file configurer.cpp.
|
inline |
schedule the dump the parameters of a design hierarchy to a file during start_of_simulation()
file_name | the output stream, std::cout by default |
Definition at line 88 of file configurer.h.
|
inlinestatic |
find the configurer in the design hierarchy
Definition at line 130 of file configurer.h.
void scc::configurer::set_configuration_value | ( | sc_core::sc_attr_base * | attr_base, |
sc_core::sc_object * | owner | ||
) |
set a value of an sc_attribute from given configuration. This is being used by the scc::ext_attribute which allows to use config values during construction
attr_base | |
owner |
Definition at line 713 of file configurer.cpp.
|
inline |
set a value of some property (sc_attribute or cci_param) directly
In case the configurer is being used without CCI the function can only be called after the simulation objects are instantiated since the sc_attributes have to exist.
hier_name | the hierarchical name of the property |
value | the value to put |
Definition at line 104 of file configurer.h.
void scc::configurer::set_value_from_str | ( | const std::string & | hier_name, |
const std::string & | value | ||
) |
set a value of some property (sc_attribute or cci_param) directly
this version automatically converts the string into the needed target data type
In case the configurer is being used without CCI the function can only be called after the simulation objects are instantiated since the sc_attributes have to exist.
hier_name | the hierarchical name of the property |
value | the value to put |
Definition at line 745 of file configurer.cpp.