scc
2022.4.0
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, sc_core::sc_object *obj=nullptr) |
void | dump_configuration (std::string const &file_name, bool with_description=false) |
template<typename T > | |
void | set_value (std::string const &hier_name, T 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} |
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 627 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 683 of file configurer.cpp.
void scc::configurer::dump_configuration | ( | std::ostream & | os = std::cout , |
bool | as_yaml = true , |
||
bool | with_description = false , |
||
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 661 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 115 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 685 of file configurer.cpp.
|
inline |
set a value of some property (sc_attribute or cci_param) from programmatically
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 101 of file configurer.h.