scc 2025.09
SystemC components library
scc::configurer Class Reference

design configuration reader More...

#include <configurer.h>

Inheritance diagram for scc::configurer:
Collaboration diagram for scc::configurer:

Classes

struct  ConfigHolder

Public Types

enum  { NEVER = 0 , BEFORE_END_OF_ELABORATION = 1 , END_OF_ELABORATION = 2 , START_OF_SIMULATION = 4 }
using base_type = sc_core::sc_module
using broker_t = cci::cci_broker_handle
using cci_param_cln = std::vector<std::pair<cci::cci_param_post_write_callback_untyped, std::unique_ptr<cci::cci_param_untyped>>>

Public Member Functions

 configurer (std::string const &filename, unsigned sc_attr_config_phases=BEFORE_END_OF_ELABORATION)
 configurer (const configurer &)=delete
 configurer (configurer &&)=delete
configureroperator= (const configurer &)=delete
configureroperator= (configurer &&)=delete
void read_input_file (std::string const &filename)
void configure ()
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 >{})
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)
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 configurerget ()

Protected Member Functions

 configurer (std::string const &filename, unsigned sc_attr_config_phases, sc_core::sc_module_name nm)
void config_check ()
void before_end_of_elaboration () override
void end_of_elaboration () override
void start_of_simulation () override
void set_value (const std::string &hier_name, cci::cci_value value)

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< ConfigHolderroot

Detailed Description

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.

Member Typedef Documentation

◆ base_type

using scc::configurer::base_type = sc_core::sc_module

Definition at line 45 of file configurer.h.

◆ broker_t

using scc::configurer::broker_t = cci::cci_broker_handle

Definition at line 46 of file configurer.h.

◆ cci_param_cln

using scc::configurer::cci_param_cln = std::vector<std::pair<cci::cci_param_post_write_callback_untyped, std::unique_ptr<cci::cci_param_untyped>>>

Definition at line 47 of file configurer.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Definition at line 48 of file configurer.h.

Constructor & Destructor Documentation

◆ configurer() [1/2]

scc::configurer::configurer ( std::string const & filename,
unsigned sc_attr_config_phases = BEFORE_END_OF_ELABORATION )

create a configurer using an input file

Parameters
filenamethe input file to read containing the values to apply
sc_attr_config_phasesdefines when to apply the values to sc_attribute instances

Definition at line 667 of file configurer.cpp.

◆ ~configurer()

scc::configurer::~configurer ( )

Definition at line 680 of file configurer.cpp.

◆ configurer() [2/2]

scc::configurer::configurer ( std::string const & filename,
unsigned sc_attr_config_phases,
sc_core::sc_module_name nm )
protected

Definition at line 670 of file configurer.cpp.

Member Function Documentation

◆ before_end_of_elaboration()

void scc::configurer::before_end_of_elaboration ( )
inlineoverrideprotected

Definition at line 154 of file configurer.h.

◆ config_check()

void scc::configurer::config_check ( )
protected

Definition at line 848 of file configurer.cpp.

◆ configure()

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 726 of file configurer.cpp.

◆ dump_configuration() [1/2]

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 )

Immediately dumps the parameters of a design hierarchy to the given output stream As this dumps the parameters immediately it should only be called during start_of_simulation since many parameters are created during before_end_of_elaboration or end_of_elaboration.

Parameters
osthe output stream, std::cout by default
as_yamlwrite in YAML format instead of JSON
with_descriptionif dumped to YAML write also the description of cci param as comments
completeincludes unused cci preset values liek log_level
objif not null specifies the root object of the dump

Definition at line 701 of file configurer.cpp.

◆ dump_configuration() [2/2]

void scc::configurer::dump_configuration ( std::string const & file_name,
bool with_description = false,
bool complete = true,
std::vector< std::string > stop_list = std::vector<std::string>{} )
inline

Schedule the dump of the parameters of a design hierarchy to a file during start_of_simulation()

Parameters
file_namethe output stream, std::cout by default
with_descriptionif dumped to YAML write also the description of cci param as comments
completeincludes unused cci preset values liek log_level
stop_lista list of hierarchy paths where dumping should stop

Definition at line 84 of file configurer.h.

◆ end_of_elaboration()

void scc::configurer::end_of_elaboration ( )
inlineoverrideprotected

Definition at line 158 of file configurer.h.

◆ get()

configurer & scc::configurer::get ( )
inlinestatic

find the configurer in the design hierarchy

Returns
reference to the singleton

Definition at line 139 of file configurer.h.

◆ read_input_file()

void scc::configurer::read_input_file ( std::string const & filename)

Definition at line 682 of file configurer.cpp.

◆ set_configuration_value()

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

Parameters
attr_base
owner

Definition at line 728 of file configurer.cpp.

◆ set_value() [1/2]

void scc::configurer::set_value ( const std::string & hier_name,
cci::cci_value value )
protected

Definition at line 742 of file configurer.cpp.

◆ set_value() [2/2]

template<typename T>
void scc::configurer::set_value ( std::string const & hier_name,
T value )
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.

Parameters
hier_namethe hierarchical name of the property
valuethe value to put

Definition at line 113 of file configurer.h.

◆ set_value_from_str()

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.

Parameters
hier_namethe hierarchical name of the property
valuethe value to put

Definition at line 760 of file configurer.cpp.

◆ start_of_simulation()

void scc::configurer::start_of_simulation ( )
overrideprotected

Definition at line 871 of file configurer.cpp.

Member Data Documentation

◆ cci2sc_attr

cci_param_cln scc::configurer::cci2sc_attr
protected

Definition at line 165 of file configurer.h.

◆ cci_broker

broker_t scc::configurer::cci_broker
protected

Definition at line 163 of file configurer.h.

◆ cci_originator

cci::cci_originator scc::configurer::cci_originator
protected

Definition at line 166 of file configurer.h.

◆ complete

bool scc::configurer::complete {true}
protected

Definition at line 150 of file configurer.h.

◆ config_phases

unsigned const scc::configurer::config_phases
protected

Definition at line 147 of file configurer.h.

◆ dump_file_name

std::string scc::configurer::dump_file_name {""}
protected

Definition at line 148 of file configurer.h.

◆ root

std::unique_ptr<ConfigHolder> scc::configurer::root
protected

Definition at line 167 of file configurer.h.

◆ stop_list

std::vector<std::string> scc::configurer::stop_list {}
protected

Definition at line 151 of file configurer.h.

◆ with_description

bool scc::configurer::with_description {false}
protected

Definition at line 149 of file configurer.h.


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