Home
GreenAV User's Guide
Contents
1. Before using an output plugin the user needs to get a default instance or create a new one Use the GAV user API see section2 3 Several functions are available to access output plugins See the code example for an example how to use Hi Recommended way accessing the default output plugin of the needed type Get the default output plugin by calling OutputPlugin_if get_default_output const 2 OutputPluginType type DEFAULT_OUT If the module does not care about the output type leave the type empty which will return the simulation wide default output plugin The returned output plugin pointer can be used to add parameters for observation or to control it see section Interface and how to use E When needing further output plugin instances a call of OutputPlugin_if 2 create_OutputPlugin OutputPluginType string ctor_par will create a new instance using the string as constructor parameter e g filename The user should store the returned pointer to be able to add parameters using the function add_to_output see below Observing Parameters with Output Plugins Observing a parameter with an output plugin means that the output plugin creates output each time the observed parameter s change This observation is realized using the parameter value change post_write callbacks GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge
2. add_to_default_output OutputPluginType type gs_param_base par add_to_default_output OutputPluginType type gs param_base amp par Adds a gs_param to be outputted by the implicit existing default output plugin of the specified type The type DEFAULT_OUT may be used to add to the simulation wide output plugin For each OutputPluginType type there is existing one object in the GAV plugin The object will be created at its first usage Returns a pointer to the output plugin See section 2 4 for details add_to_output OutputPlugin_if outputPluginID gs param_base par Adds a gs_param to be outputted by the specified output plugin The specified output plugin has to be created by calling create_OutputPlugin or has to be set by calling get_default_output See section 2 4 for details get_event_listener Returns an event listerner for triggers May be used for any further purposes See sections 2 5 3 and 2 6 1 for details 2 4 Output Plugins Output plugins are used to export any gs_param value over time to a specific output Such outputs can be the stdout text files csv files ved files SCV streams dedicated connections to tools e g TCP IP connections etc see Figure 2 3 Each output plugin is able to output multiple gs_params which can be added to the output during simulation runtime by a user or a tool The only assumption is to have access to a GAV User API see section 2 3 Before you are able to use one or
3. my_boolCalc scale WIR booll bool2 Listing 2 21 Example bool operations Calculator type bit bool formula bool1 bool2 Sliding window The sliding window feature can be enabled by calling enable_sliding_window 2 unsigned int window_size Use window_size 0 for disabling the sliding window The window size 37 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW Sreen ocs may be changed while the trigger runs You should not disable the sliding window because then the result parameter will change you have to call get_result_param again Listing 2 22 shows an example for creating a sliding window of size 5 that is recalculated each 10 ns Wgs avi Trigger tr 10 SC_NS gs av Calculator lt int gt calc my_SlWiCalc cale calc int_p 1nt_p2 calc enable_sliding_window 5 sliding window size 5 s gs av StatCalc lt int gt stc StatCalc tr calc Listing 2 22 Sliding window example formula inp_p inp_p2 sliding window size 5 Get result parameter S The result parameter is returned when get_result_param is called The type of the result pa rameter is the template type of the calculator E After having called get_result_param the formula must not be changed any longer including enable disable sliding window S The function get_result_param mu
4. object does not delete the Trigger and Calculator objects expect if the StatCalc created a trigger implicitly If needed they have to be deleted afterwards manually A Delete the trigger object after the StatCalc object was deleted not before See the GREENAV tutorial for an example 39 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW iia E Input parameter may be deleted before removing or deactivating the StatCalc E StatCalc objects are sc_objects To find these objects e g to activate deactivated ones a tool can search within the SystemC object hierarchy to find them In feature releases the enabling shall be possible with a configurable bool parameter 2 6 4 How to use Overview How to use the StatCalc the Trigger and the Calculator 1 Optional Create the Trigger if needed other activation than formula parameter value changes gs av Trigger stc_t my_event 2 Create the Calculator gs av Calculator lt int gt stc_c CordulaCalc 3 and specify the formula to be calculated stc_c calc int_par uint_par 4 Optional Create a sliding window stc_c enable_sliding_window 5 5 Create a StatCalc combining the Trigger and the Calculator gs av StatCalc lt int gt stc StatCalcCordula stc_t stc_c or using default trigger gs av StatCalc lt int gt stc StatCalcCordula
5. CB1 1HW giie There are two basically different ways adding a parameter for observation to an output plugin One way is calling GAV user API functions This assumes you have pointer access to the output plugin instance and the parameter which is no issue within the simulation Another way is creating and manipulating parameters belonging to special output plugins For this you need to know the name of the output plugin you want to observe a parameter and the name of the parameter Manipulate output plugins directly E See section Interface and how to use for various actions possible on output plugin pointers that you got by calling get_default_output or creating new ones see section Access Output Plugins Observe parameters by calling GAV user API functions S Adding a parameter for observation to a default or manually created output plugin can be done us ing the function OutputPlugin_if add_to_output OutputPlugin_if gs_param_base The output plugin first parameter is one of the pointers returned by the functions above get_default_output and create_outputPlugin E Another way observing a parameter with one of the default plugins is calling OutputPlugin_if 2 add_to_default_output OutputPluginType gs_param_base which adds a parameter to the default instance of the specified type It returns a pointer to the default output plugin too E The easiest way observing a parameter with the simulation wide default output is cal
6. Event listener The trigger needs the API s event listener templated to trigger_if During construction the trigger gets a GAV_Api instance and calls get_event_listener and stores the pointer Afterwards the trigger calls m_event_listener gt create_event_listener this amp 2 trigger_if event_callback ev where it is needed to create a dynamically spawned process that waits for the event ev How to use This section is about how to prepare the trigger in the user s code before giving it to the StatCalc object The specific constructors specify the way the trigger waits for calculation activation events The vector parameter takes manually chosen parameters There are constructors for many combinations of activation events explicit Trigger sc_event event sc_event event sc_ time ti double t sc_time_unit u bool on_changes explicit Trigger sc_event event gs_param lt bool gt cond n explicit Trigger explicit Trigger explicit Trigger explicit Trigger n explicit Trigger explicit Trigger sc_time amp ti gs_param lt bool gt cond double t sc_time_unit u gs_param lt bool gt cond bool on_changes gs_param lt bool gt amp cond j gs_param lt bool gt cond gs_param lt bool gt cond explicit Trigger explicit Trigger explicit Trigger explicit Trigger IE sc_event ev sc_time amp ti bool on_changes gs_param lt bool gt con
7. coded constants may be used Instead of giving parameters to the calc function numbers may be used See listing 2 19 for an example where 2 5 is a constant used with the calc syntax mixed with convenient operator syntax When using constants the calc syntax has to be used Convenient operators do not support con stants If convenient operators should be used instantiate gs_params for the constants This produces no additional overhead because within the Calculator constants will create parameters anyway gs av Calculator lt double gt c my_ConstCalc gs gs_param_base amp d dbl_p dbl_p gs_param lt double gt see example above c calc c c b1 b2 c d b2 2 5 using constant 2 5 Listing 2 19 Constants example Calculator type double formula b1 b2 dx b2 2 5 Bitwise operators and bool calculations When the bitwise operators amp are needed the Calculator_bit Calculator should be used This also applies to bool calculations Listing 2 20 shows an example using bitwise operators on integers the example in listing 2 21 shows bool operations gs av Calculator_bit lt int gt cbit my_BitwiseCalc cbit cale 1 cbit cale 1I5t_p 10t_p2 uint_p Listing 2 20 Example using bitwise operations Calculator type bit int formula int_p amp int_p2 uint_p gs_param lt bool gt booll booll true gs_param lt bool gt bool2 bool2 false av Calculator_bit lt bool gt cbo
8. function void pure_output const std string amp can be called to write directly to the text file without waiting for parameter change callbacks and without using the formating functionality of the output plugin This feature is used by report message streamers see project ReportMessages std string mystring mystring Any string to output to file mystring std endl gsi av OutputPlugin_if op m_analysisAPI gt create_OutputPlugin gs av TXT_FILE_OUT file log s gs av i File_OutputPlugin fop dynamic_cast lt gs av File_OutputPlugin gt op fop gt pure_output mystring Listing 2 6 Text file pure output example 2 4 5 Comma Separated Values CSV Output Plugin E Include L_greencontrol analysis csv_outputplugin h E Implementation see file L_1CSV_OutputPlugin 17 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW a S Identify this output plugin with gs av CSV_FILE_OUT id OutputPluginType 4 E Behavior O Starts paused will start automatically during end_of_elaboration or can be started manually O Does not cache value changes when paused O On resume it outputs the first value change not the current value The Comma Separated Values CSV output plugin can be used to output parameter changes that should be imported to MS Excel The constructor pa
9. greencontrol examples gav_simple espe cially in the files L AVAnalyserTool The type of output plugins is defined with an enum OutputPluginType see file L gav_datatypes h IGREENAV doxygen API http www greensocs com projects GreenCont rol GreenAV docs GreenAVDoxygen take care to look at the correct release 13 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ias Code example Listing 2 3 and figure 2 4 show examples how to use output plugins get pointer to parameter bases gs_param_base int_par m_configAPI getPar Owner int_param gs_param_base str_par m_configAPl getPar Owner str_param gs_param_base uint_par m_configAPI getPar Owner uint_param get simulation wide default output and observe a param gs av OutputPlugin_if overallDefaultOP m_analysisAPI 2 get_default_output m_gavApi add_to_output overallDefaultOP int_par alternative add params to the default text file output gs av O0utputPlugin_if file0P m_gavApi add_to_default_output gs av TXT_FILE_OUT int_par m_gavApi add_to_default_output gs av TXT_FILE_OUT uint_par create an additional CSV file output plugin and add all existing parameter to output gs av O0utputPlugin_if csvFileOP m_gavApi create_OutputPlugin gs av CSV_FILE_OUT CSVexp log csvFileO
10. int_par 2 Listing 2 4 STDOUT output example 2 4 4 Text file Output Plugin E Include L_ greencontrol analysis_file_outputplugin h 16 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW as E Implementation see file L File_OutputPlugin S Identify this output plugin with gs av TXT_FILE_OUT 1d OutputPluginType 2 E Behavior O Starts running needs not be started manually or automatically O Does not cache value changes when paused O On resume it outputs the first value change not the current value The Text file output plugin can be used to record parameter changes to a human readable text file The format is similar to the STDOUT plugin s output The first line is the simulation time the following lines contain one line per parameter change See listing 2 5 for an example The constructor parameter is the filename of the output file Be careful to set the file extension e g txt or log If the given file name has no extension no dot in it the extension log will be added automatically Simulation time Fri Mar 28 15 03 09 2008 41 1 Owner int_param 100 41 1 Owner uint_param 670 s 1 1 Owner int_param 101 2 3 Owner int_param 102 Listing 2 5 Text file output example Pure Output Pure output is a special feature of the text file output plugin The additional
11. is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW as It is simple to add user defined functions including their operation strings to a Calculator of spec ified type This may be done e g in the sc_main A function added to Calculator lt type gt is also available in Calculator_bit lt type gt E Constants in formula Using the calc syntax hard coded constants may be used instead of parameters E Statistics sliding window The sliding window can be activated after the formula has been specified completely The sliding window gets a window size n The function will add the results of the last n calculations and divide this by the window size n E Switch to allow sloppy calculations A special feature of the GREENAV Calculator is the sloppy functionality The user may enable sloppy behavior to pretend runtime errors e g when dividing by zero Each operation may define a default return value if sloppy is enabled E g if sloppy is enabled the division operation returns 0 if divided by zero The Calculator s formula parameters are limited to these POD and SystemC data types int unsigned int bool double float unsigned long long unsigned char sc_int_base sc_int sc_uint_base sc_uint sc_signed sc_bigint sc_unsigned sc_biguint The data types are identified by the parameter call getType which returns
12. more output plugin s you have to include the one s you need GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW los y Ca Y include greencontrol analysis h includes the Standard Output Plugin include greencontrol analysis_file_outputplugin h tinclude greencontrol analysis_csv_outputplugin h sitinclude greencontrol analysis_scv_outputplugin h tinclude greencontrol analysis_vcd_outputplugin h 1 SEC Listing 2 1 Include for output plugin GAV Several Output Alternatives Figure 2 3 GreenAV Concept for Outputs The GAV_Plugin contains several types of output plugins Default Output Plugin s The provided output plugins are described in the following subsections Any output plugin existing in the simulation is owned by the GAV plugin For each type of output plugin there is one default instance which should be used if only one instance instead of multiple ones meets the user s requirements A simulation wide default output plugin type which results in a default instance should be set by the user during construction If more than the default output s is needed e g if several files should be created the user may create additional instances of each output plugin type GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 0537
13. stc gt get_result_param Figure 2 7 GreenAV Statistics Calculator Concept 27 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ne Alternative constructors do not need a trigger to be specified In this case the default trigger object will we created by the StatCalc The default trigger triggers on each input parameter change i StatCalc const char stcalc_name calc_if any_calculator StatCalc const char stcalc_name calc_if amp any_calculator The StatCalc object gives access to the trigger and calculator object pointers via the functions trigger_if get_trigger andcalc_if get_calculator and provides some of the trigger and cal culator interface functions whose calls will be redirected to the trigger object igs_param lt result_type gt get_result_param redirected to calculator calc_if get_calculator local trigger_if get_trigger local bool is_activated redirected to trigger si void activate redirected to trigger void deactivate redirected to trigger The activation status of the trigger can also be accessed and manipulated with the parameter lt statcalc_name gt activated which is returned by the function i gs_param lt bool gt get_activated_param local 2 6 1 Trigger Concept The trigger is responsible for activation e
14. the new output plugin in the enum OutputPluginType in file L gav_datatypes h enum OutputPluginType other members Short explanation of my outp pl EW_OUTPUT_PLUGIN S Add the new output plugin to the GAV plugin s outputPluginFabricCreator function file L gav_plugin h by adding a switch case The case is the enum member being created at the preceding bullet point ijcase MYNEW_OUTPUT_PLUGIN create MyNew output plugin op new MyNew_OutputPlugin constructParam amp J m_OutpPl_event_listener 5 break E See the code documentation Doxygen API reference or header files for some more detailled information L Advanced Note Write an Output Plugin from scratch When writing a completely new output plugin at least the interface OuputPlugin_if has to be implemented The constructor should get but needs not the string given by the user transmitted over the transaction 2GREENCONFIG User s Guide http www greensocs com projects GreenControl GreenConfig 23 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ia 2 5 Analysis and Visibility Service 2 5 1 Service Plugin The service plugin class GAV_Plugin file LA gav_plugin h uses the enum member AV_SERVICE and the port plugin name GAV_Plugin The main functionality of the plugin E Manage output plug
15. trigger also uses the API s event listener This may be used e g for sliding windows that record on fixed time intervals E value changes on input parameters uses parameter callbacks This is the default trigger mechanism The trigger registers callbacks for all formula input param eters and triggers re calculation an each callback E manually chosen parameter changes The user may give any gs_params to the trigger whose value changes will result in a re calculation These parameters need not but may be formula parame ters E manually The user may manually trigger the re calculation with a simple function call Additionally the Trigger supports a E Guard no activation event gs_param lt bool gt for a condition to be checked before calculation This guard parameter is checked each time the trigger got one of the activation events If the guard s value is true the re calculation is performed otherwise re calculation is suppressed The trigger is able to handle several activation events concurrently The user may enable value change activation and e g set one or more sc_event s on whose notification triggering will also be performed Manually triggering is always possible taking account of the guard as well 30 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ja LCi Implementation Note
16. with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ia Chapter 1 Introduction The Green Analysis and Visibility GREENAV framework is an extension service for the GREENCONTROL framework GREENAV makes wide use of the GREENCONTROL s configuration service GREENCONFIG Please see the GREENCONTROL User s Guide for an introduction to GREENCONTROL and the GREENCONFIG User s Guide for details about GREENCONFIG GREENAV extends configurable parameters with analysis and visibility features It is possible to combine several parameters within a formula doing mathematical calculations and statistics with flexible triggers for the calculations It is also possible to output parameters and analysis results to several output plugins which make them available at runtime to make them visible or store them e g in files of different kinds These outputs can be connected to ESL vendor tools e g via SCV streams Visit the GreenSocs web page to get the newest release of the GREENCONTROL framework http www greensocs com projects GreenControl Visit the GREENAV project web page to get the newest development information and further docu mentation http www greensocs com projects GreenControl GreenAV GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ias Chapter 2 Green Analy
17. 9256 Registered office 10 Wellington Street Cambridge CB1 1HW ia Specify the simulation wide default output plugin like shown in listing 2 2 All outputs that are not directed to a special type or instance will use this default output plugin The output plugin types are identified with the type gs gav OutputPluginType which is an unsigned int For convenience their names can be used instead See the following sections of each output plugin for its value DEFAULT_OUT is used as a replacement for the simulation wide default av GAV_Plugin analysisPlugin gs av STDOUT_OUT Listing 2 2 Specify the default output plugin during Analysis Plugin instantiation amp Only if you know what you are doing you may use the GAV Plugin function void set_default_output_plugin OutputPluginType default_output_plugin_type to modify the default output plugin even during model creation and simulation See next paragraph and section 2 3 for how to access default output plugins and how to create and access additional ones Li Implementation Note Output Plugin identification The output plugins are identified id using the unsigned int OutputPluginType A static map OutPluginName getMap is used to store the names values related to the id key A variable of type OutputPluginType named as the output plugin name with the corre sponding value can be used to identify the type using gs av TXT_FILE_OUT etc Access Output Plugins
18. CSV file outputs should begin with a complete the header line containing all parameters Output Plugin Names An output plugin is an sc_object which is named in the following pattern The name is needed e g when creating enabled parameters see above for this output plugin All output plugin names have their name string as prefix e g STDOUT_OUT and their constructor parameter as tail The default output plugins one for each available output plugin type are created and owned by the GAV Plugin Their name tails are _default which is the constructor parameter specified by the GAV Plugin The tail is automatically converted to SystemC conform names by replacing each character which is not a letter or a digit or an underscore to an underscore Examples E Default output plugin of type STDOUT_OUT name AnalysisPlugin STDOUT_OUT_default E Default output plugin of type TXT_FILE_OUT name AnalysisPlugin TXT_FILE_OUT_default Hi User created output plugin created in the constructor of module mymodule with the call create_OutputPlugin TXT_FILE_OUT myop name mymodule TXT_FILE OUT_myop 12 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW Sreen ocs S Hi User created output plugin created in the constructor of module mymodule with the call create_OutputPlugin TXT_FILE_OUT myop txt name my
19. P gt observe_all m_configAPI pause for 2 ns csvFileOP gt pause 2 SC_NS remove parameter from default file output file0P gt remove int_par Listing 2 3 Output plugin code example Li Implementation Note Output Plugin The output plugin instances are newed by the GAV plugin and stored in two maps one for the default m_DefaultOutputPlugins and one for the additional m_OutputPlugins output plugins One event listener m_OutpP1_event_listener see section 2 5 3 is owned by the GAV plugin to handle events pause and resume of output plugins 14 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW iron y of a Value With Output UserModule gt _stdout GCnf_Api gs_param lt int gt param1 param to capture gs_param lt string gt param2 param to capture Example simulation wide default output OutputPlugin_if defaultOP m_GAV_Api get_default_output DEFAULT_OUT m_GAV_Api add_to_output default0P amp param1 m_GAV_Api add_to_output default0P amp param2 Alternative m_GAV_Api add_to_default_output DEFAULT_OUT amp param1 Alternative create and modify enabled parameters within the output plugin Example default text file output OutputPlugin_if txtFileOP m_GAV_Api get_default_outputC TXT_FILE_0UT m_GAV_Api add_to
20. Y_NEW_OUT MyNew_OutputPlugin S Inherit OuputPlugin_base which provides most functionality expect the output itself E Do not implement the empty constructor S Implement the constructor taking a name and an event listener and forward them to the base class including the project wide convenience name and the output plugin s starting behavior MyNew_OutputPlugin const char output_specifier event_listener lt 0utputPlugin_base gt ev_listn OutputPlugin_base output_specifier ev_listn convenience_variable start_running Implement the callback function and make sure to remove a parameter being observed by the output plugin when is is being destroyed Guard the output by checking is_running void config_callback gs_param_base amp par if par is_destructing remove par 22 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW lia else if is_running 5 Do the output Optionally use the base class members m_constructing and m_currently_calling_initial_add_for_observation_callback if needed E Implement the output within the callback function previous bullet point Use the functions the gs_param_base provides or cast to the actual gs_param lt type gt type see GREENCONFIG User s Guide i par getName par getString E Create a member representing
21. _output txtFile0P amp param1 m_GAV_Api add_to_output txtFile0P amp param2 Alternative m_GAV_Api add_to_default_output CSCV_STREAM_OUT amp param1 Example additional created output plugin OutputPlugin_if csvFileOP m_GAV_Api create_OutputPLugin CCSV_FILE_OUT CSVexample log m_GAV_Api add_to_output csvFile0P amp param1 Alternative create and modify enabled parameters within the output plugin Figure 2 4 GreenAV Output Example Li Implementation Note OutputPlugin_base An output plugin derives from the base class OutputPlugin_base see file L OutputPlugin_base Each output plugin needs only implement its constructor destructor the initialization function init and the callback function config_callback which should perform the actual output Output plugins implement the constructor which gets one string parameter to allow adding the output plugin to the GAV plugin s create command All functions are virtual to give the derived class the oportunity to catch the calls before calling the base class function The derived classes init 1s automatically called by the base class before the first call back access dependent on the variable bool is_used not during construction The con structor should not do memory allocations etc because it is called for the default output plugins even if the output plugin will never be used 15 GreenSocs is the trading name of GreenSocs Lt
22. added to the Calculator lt int gt class static int average int a int b bool sloppy if sloppy catch possible errors and return a default value 5 return a b 2 int sc_main int argc char argv 10 Add user defined calculation function to Calculator class gs av Calculator lt int gt addFunc amp average average U f sc_start Listing 2 23 User defined calculation function The average function will be usable by any Calculator lt int gt and Calculator_bit lt int gt i Test class surrounding the static calculation function class Surrounding_Class public Calculator function to be added to the Calculator lt double gt 5 static double divide_by_three const double a const double b bool 2 sloppy return a b 3 i int sc_main int argc char argv Add user defined calculation function to Calculator class gs av Calculator lt double gt addFunc amp Surrounding_Class divide_by_three 2 WEE gt U 15 se start Listing 2 24 User defined calculation function within class The average function will be usable by any Calculator lt double gt and Calculator_bit lt double gt 2 6 3 StatCalc Miscellaneous S The StatCalc s destructor deactivates the owned trigger Keep this in mind if you use the trigger elsewhere what you should not do S The Trigger and Calculator should exist at least as long as the StatCalc object Deleting a StatCalc
23. ates the trigger Listing 2 11 Example standard value change trigger with condition guard 32 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW Sreen ocs 1 sc_event evento gs av Trigger stc_cordula_t event0 U F event0 notify will trigger Listing 2 12 Example SystemC event trigger gs av Trigger stc_bob_t 10 SC_NS d f stc_bob_t set_sample_interval 0 SC_NS removes trigger Listing 2 13 Example periodical sample interval trigger See files L_ AVnewStCalc in the example greencontrol examples gav_StatCalc for regres sion tests on the trigger 2 6 2 Calculator Concept The calculator functor object is responsible for performing the calculation defined by the user The calculator is an object that inherits calc_if to allow to be managed by the StatCalc object It performs the calculation when the operator is called by the trigger The default GreenAV calculator object class is Calculator Interface As an extension to the GREENAV framework new calculators can be implemented which just have to implement the virtual interface calc_if elass Cale if q virtual calc_if void operator gs_param_base get_result_paran std vector lt gs_param_base gt get_used_params y Listing 2 14 Calculator interface calc_if For a detai
24. change trigger while the trig ger runs E set_condition gs_param lt bool gt cond or set_condition gs_param lt bool gt amp cond sets the guard parameter cond NULL removes the guard When being called repeatedly the old guard will be overwritten All these functions may be called anytime even if trigger already runs Further available functions are E calculate_now triggers the re calculation manually This call takes account of the activation and the guard just like all activation events do M bool is_activated returns if the trigger StatCalc is activated see interface description above E void activate activates the trigger StatCalc see interface description above M void deactivate deactivates the trigger StatCalc see interface description above M void set_activation_status bool _activate calls activate or deactivate The following listings are some usage examples For the example this predefinitions are needed i include greencontrol analysis h gs av Trigger stc_tom_t new Trigger true is the same as gs av Trigger stc_tom_t new Trigger ravi Trigger stc_regina_t condition uses param changes and a guard create calculator StatCalc do something es stc_regina_t disable_on_change_activation f stc_regina_t calculate_now calculate manually w stc_regina deactivate deactivates the trigger stc_regina activate re activ
25. cs e g O 4 1 1 4 1 4 1 1 4 2 4 1 1 4 3 e how many transactions generated e how many certain types are generated e transaction latencies e utilization in percent of link e average time in queue in the fabric e what queues were full empty utilization of queues e Transactions ex Addresses data payload size e Analyze transactions and create statistics e Register memory accesses 43 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW
26. d explicit Trigger sjexplicit Trigger sc_event ev sc_time amp ti gs_param lt bool gt amp cond j sc_event ev sc_time amp ti sc_event amp ev bool on_changes sc_time amp ti bool on_changes gs_param lt bool gt amp cond sc_time amp ti bool on_changes std vector lt gs_param_base gt explicit Trigger explicit Trigger explicit Trigger explicit Trigger explicit Trigger Listing 2 9 Trigger constructors with several calculation activation events and guard The constructor activation event and guard order is sc_event sc_time bool_on_changes guard There may be activation event combinations which are not available e g when combining manually chosen parameters with other event Then the user may use one constructor and one of the following functions after construction E set event sc_event amp ev enables trigger for SystemC events When called repeatedly all events are valid Removing events is not possible S set_sample_interval sc_time amp sample enables periodical sample interval trigger 31 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW a When called repeatedly the last interval is the valid one E enable_on_change_activation enables trigger for value changes disable_on_change_activation may be used to disable the value
27. d Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW no 2 4 1 Default Output Plugin special case E Identify the default output plugin which is actually one of the following with gs av DEFAULT_OUT id OutputPluginType 0 2 4 2 NULL Output Plugin special case S Identify the NULL output plugin which is actually no one with gs av NULL_OUT id OutputPluginType 1 Use this setting if the output should go nowhere 2 4 3 STDOUT Output Plugin E Included within L greencontrol analysis h E Implementation see file L Stdout_OutputPlugin h S Identify this output plugin with gs av STDOUT_OUT id OutputPluginType 3 E Behavior O Starts running needs not be started manually or automatically O Does not cache value changes when paused O On resume it outputs the first value change not the current value The STDOUT output plugin can be used to simply display parameter changes to the standard output e g terminal where the simulation runs One line per parameter change is printed and contains timing and delta information the parameter name and the new value An output example can be seen in listing 2 4 This output plugin is a very convenient way to print each parameter change to the simulation output The constructor string parameter is not used within this output plugin 1 130 ns 7 Stdout_OutputPlugin AVnewStatCalc
28. default Calculator The default GreenAV calculator object class is Calculator and Calculator_bit Features of the Calculator E Variable data type of the Calculator s result and intermediate results The template parameter of the Calculator class specifies the type of all operations intermediate results and the result parameter All formula parameters will be casted to this type for each opera tion S Formulas with various nested operations can be built with formula input parameters of type gs_param lt T gt O Math operations Logical operations ES PM ES SS Ee ee O Bitwise operations amp in the derived class Calculator_bit A Some data types are not allowed to have bitwise operations accordingly they are not included in the Calculator class If these operations should be used use the class Calculator_bit instead S Calc syntax calc string gs_param lt T gt gs_param lt T gt for flexible and powerful formula cre ation This is the main part of the calculator the mechanism to specify formulas Use the string to spec ify the operation the input parameters may be results of another calc call Calls to calc can be nested E Convenient operators less flexible and powerful but better human readable for parameter bases The convenient operators may be used to replace the calc syntax for the math operations E User defined functions for calc syntax 34 GreenSocs
29. entation see file L_1SCV_OutputPlugin S Identify this output plugin with gs av SCV_STREAM_OUT 1d OutputPluginType 5 E Behavior O Starts running needs not be started manually or automatically 19 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW iia O Does not cache value changes when paused O On resume it outputs the first value change not the current value The SCV output plugin SCV_OutputPlugin outputs parameter changes to a stream of the SystemC Verification Standard SCV This standard stream can be used as an input to several vendor tools such as CoWare and Mentor This output plugin exports the registered parameter changes to an SCV stream named GreenAVstream_ lt OutputPluginName gt The constructor string parameter is the OutputPluginName Each parameter gets its own transaction generator When a parameter changes the previous transac tion is ended and a new one with the new value is started Accordingly a transaction represents the time where the value of a parameter remains unchanged The database that should be written to can be chosen in the static function init_scv_recording see file L_ SCV_OutputPlugin h The output plugin s default database is a text file which is the default database in the SCV framework The SCV stream output is written to the file J tran
30. h the vsim simulator Mentor s SCV implementation does not support string data types in transactions being recorded in an SCV stream Accordingly the SCV output plugin has to use the USE_CORRECT_TYPE_TRANSACTIONS define and cannot show string parameters So the visualization is restricted to the data types listed in the enumeration gs cnf Param_type and implemented in the plugin 20 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW a The SCV output plugin has an init_recording function which automatically uses ModelSim special code when compiled with the ModelSim sccom compiler In the define section there is an ifdef for ModelSim which automatically sets the correct behavior These steps have to be performed when simulating with ModelSim E Start the simulation Important The transaction stream does not occur before simulation is run ning and has created the stream E View the recorded SCV transactions by right clicking on the module which contains the stream and selecting Add Add All Signals to Wave Experience with CoWare Experiments with the CoWare Platform Architect To use the CoWare settings define CoWare The SCV output plugin has a special define area in its init_recording function for the CoWare tool In the define section there is an ifdef for CoWare which automatically sets the correc
31. he activation events of re calculation and then calls the calculator to perform re calculation The StatCalc object gets a trigger and a calculator object during construction and combines them It gives the calculator functor object to the trigger object to enable the trigger to activate the recalculation The StatCalc calls get_used_params on the calculator to give all input parameters to the trigger using set_used_params Interface and how to use The StatCalc object has to be instantiated after the trigger and calculator have been created and specified completely The name of the StatCalc has to be specified during construction and is made unique by the construc tor using sc_gen_unique_name The full constructors are StatCalc const char stcalc_name trigger_if any_trigger calc_if any_calculator StatCalc const char stcalc_name trigger_if amp any_trigger calc_if amp any_calculator 26 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW GreenSocs near Y GAV Analysis Statistics UserModule Example with event trigger Trigger tri my_sc_event Calculator lt int gt cal Ca cal p1 cal p2 p3 11 p1 p2 p3 StatCalc lt int gt stc new StatCalc lt int gt Cordula tri cal m_GAV_Api add_to_default_output CSTDOUT_OUTPUT_PLUGIN
32. ins see section 2 4 E Own two event listeners needed by output plugins and Statistics Calculator Triggers see sections 2 4 and 2 6 2 5 2 Commands The analysis and visibility service AV_SERVICE uses the command enum GAVCommand see file L gav_datatypes h These commands may be used for the API Plugin communication Direction API GAV Plugin Usage CMD_ADD_TO_OUTPUT_PLUGIN Adds a parameter to an output plugin The output plugin can be either the default one of the specified type or a user API specified one If the default one is being used for the first time the output plugin will be instantiated by the plugin CMD_CREATE_OUTPUT_PLUGIN Creates a new output plugin of the specified type and returns the pointer to the API EVENT_LISTENE Returns the pointer to the plugin s trigger event listener to the API The fields of the transaction are used for special commands on this way CMD_ADD_TO_ 2 REQUEST AnyPointer NULL Identifier pointer of the output OUTPUT_PLUGIN plugin the parameter should be added to NULL add to the default output plugin REQUEST AnyUint If AnyPointer NULL type of the default output plugin member of enum OutputPlugin Type RESPONSE AnyPointer Pointer identifier to the output plugin the pa rameter was added Can be used in this com mand for adding further parameters NULL on error REQUEST AnyPointer2 Optional Pointe
33. ion Events Trigger S Per default the result is updated re calculated each time one of the formula input param eter changes S A boolean condition can guard the calculation The calculation will only be performed if the given parameter is true Note A change of the condition parameter from false to true does not trigger re calculation S A complex boolean expression can be created using another Statistics Calculator object giving its bool result parameter to set_condition gs_param lt bool gt 4 E An sc_event can be used to trigger the calculation Each time the event is notified the cal culation will be performed If there is a boolean condition activated this will be checked first E A fixed interval which triggers re calculation each given time can be specified S The calculation can also be manually performed by a simple function call 3 Statistics Abilities Calculator E Sliding window The user can insert a sliding window between the calculation and the result The sliding window puts out the average over the last n values to the result parameter All activation mechanisms keep the same parameter change callbacks boolean conditions sc_event interval Figure 2 7 shows the Statistics Calculator concept The StatCalc consists mainly of a trigger object see section 2 6 1 and a calculator object see section 2 6 2 The calculator is responsible for managing the formula that should be calculated The trigger manages t
34. las Green Analysis and Visibility User s Guide GreenAV v 4 2 0 Copyright GreenSocs Ltd 2008 2010 Developed by Christian Schr der and Wolfgang Klingauf and Robert Giinzel Technical University of Braunschweig Dept E LS 7 September 2010 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ias Contents 1 Introduction 3 2 Green Analysis and Visibility 4 2A ACI rar aaa ARE NA A 4 2 IIS a AAA AAA 5 23 API adapter GAV Api cee ane dea nda ea OE eee aa D we N 6 24A Ou tp tPl gins ocios iris A A EE ESS 6 24 1 Default Output Plugin special case Pe Gee Peed 15 2 4 2 NULL Output Plugin special case 2 422 624 G54 es 15 243 STDOUT Output Plugin gt s a e as sde sone oe e aoia a s 15 244 Textile Output Plugin ciosso co o co ES 15 2 4 5 Comma Separated Values CSV Output Plugin 16 24 6 SCV stream Output Plugin i a S ge ces cesa caca OA ORG OE ed 18 2 4 7 Value Change Dump VCD Output Plugin 20 2 4 8 How to implement an Output Plugin o 21 203 Analysis and Visibility Servic ss so arar ra Sere N 23 23 1 Servi e PINGIN cesos AAA AAA 23 Zaa LOOSE 5 coes bo ee a Ses a aG 23 LES BALE o co c caa c E AA A aA i AA E R A 24 ZB Statistics Calculator os pops A A SESE ES HOS 24 A III 21 fee CAGUA lt l
35. led description see the API reference The function operator enables the calculator object to be a functor This function performs the calculation regardless of the formula input parameter status The trigger has to make sure not to call the function if the calculation will fail e g because of destructed formula parameters The function get_result_param returns a pointer to the result parameter The result parameter is created and owned by the calculator This function should not be called before the formula was specified 33 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW no The function get_used_params is called by the StatCalc during construction and returns all formula input parameters to be given to the trigger These parameters are needed by the trigger for checking the destruction callbacks and if activated for the parameter change callbacks L Advanced Note Re implement a calculator As an extension to the GREENAV framework new calculators can be implemented They just have to implement the calc_if interface This may be needed if other calculations shall be available e g calculate within a script language instead using SystemC C If only further functions consuming two param eters are needed user defined functions can be added to the default GREENAV calculator see below GreenAV
36. ling the func tion OutputPlugin_if add_to_default_output gs_param_base It returns a pointer to the de fault output plugin too Observe parameters by creating and manipulating parameters belonging to special output plugins S To enable the observation of a parameter which may be already existing or may not create a new implicit parameter which is a child parameter of the output plugin and is named as the parameter that should be observed This comes clear in the following example O The GAV Plugin is named AnalysisPlugin O The output plugin which should observe the parameter is the default stdout one automatically named STDOUT_OUT_default O The parameter that should be observed is named mymodule submodule myparam O To observe the parameter with the output plugin simply create a so called enabled parameter child of the output plugin named AnalysisPlugin STDOUT_OUT_default mymodule submodule myparam by doing the following call on the config user API mCnfApi gt setInitValue AnalysisPlugin STDOUT_OUT_default mymodule 2 submodule myparam true The output plugin will automatically make the implicit parameter explicit immediately O Afterward you can enable and disable the observation of the parameter by modifying the enabled parameter to true or false e g 10 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Regi
37. llback for this parameter to react on changes This function is called before the other initialization functions to ensure that the parameter is available The function set_used_params gets the formula parameters of the calculator These parameters have to be observed by the trigger for destruction After one of these parameters has been destructed the trigger must never again call the re calculation of the calculator The function deactivate should deactivate the trigger until the function activate is called A de activated trigger should unregister all input parameter callbacks for changes and destruction checks due to performance reasons A deactivated trigger should produce no overhead This allows creation of deactivated Statistics Calculators without runtime overhead Get if the trigger is activated by calling is_activated The functions event_callback and interval_callback are both functions that can be registered by the trigger to the event listener of the GAV plugin which may be accessed via the GAV_Api which is templated to trigger_if Li Advanced Note Re implement a trigger As an extension to the GREENAV framework new triggers can be implemented They just have to implement the trigger_if interface This may be needed if further activation events are needed that are not met by the default GREENAV trigger When re implementing a trigger be careful never calling the re calculation if one of the formula parameters has been de
38. module TXT FILE OUT myop txt E User created output plugin created in the thread main_action of module mymodule with the call create _OutputPlugin TXT_FILE_OUT myop txt name mymodule main_action TXT_FILE_OUT_myop_txt Interface and how to use After the user got an output plugin pointer of type OutputPlugin_if see L_10OutputPlugin_if it may be used Call M observe gs_param_bases to let the output plugin observe a parameter S observe_all GCnf_Apis config_api to observe all parameters currently existing S observe vector lt gs_param_base gt to observe parameters given in a vector e g as a result of the config user API call getParams string M observe string getParamList_string to observe parameters specified by a string like myModule Internally the config API call getParams string will be used To observe all parameters underneath the hierarchy level of myModule call observe myModule S remove gs_param_base4 to remove a parameter observation from the output E pause to pause the output from now on E pause sc_event amp to pause the output until the given event is notified M pause sc_times Or pause double sc_time_unit to pause the output for the given time E resume to resume the output manually if paused a paused to check if paused Consult the doxygen API for more details An output plugin is not paused by default The usage of output plugins is shown in the example
39. of the GREENCONFIG namespace gs cnf A using namespace ctr statement in the GREENAV global import file imports the control names pace to the gs av namespace see L greencontrol gav plugin gav_globals h L Compatibility Note Namespace compativility to release 0 2 To be compatible to the old namespaces tlm gc tlm gc config the header file L greencontrol namespace_compatibility h can be included GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW as 2 3 API adapter GAV Api This section is about the GAV user API For a full API reference see the doxygen API reference Here follows a brief description of the most important functions create_OutputPlugin OutputPluginType type string ctor_param Creates a new OutputPlugin instance of the specified type in the plugin and provides the specified constructor parameter The constructor parameter is interpreted dependent on the output plugin type e g a file name or stream name or ignored Returns a pointer to the output plugin See section 2 4 for details get_default_output OutputPluginType type DEFAULT_OUT Get the default output plugin of the specified type or the simulation wide default Not specifying the OutputPluginType will return the simulation wide default one Returns a pointer to the default output plugin See section 2 4 for details
40. output name constructor parameter file name the fifth line is the header of the table containing the parameter names All remaining lines are data parameter changes This example includes integer and string parameters Figure 2 5 shows the file opened with Excel 18 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW orn Simulation time Fri Mar 28 14 00 42 2008 CSVexample log tin WT 2 2 de 2 m3 IES 106 ns 10 133 210 ns 18 10000 n E S S S S S S S delta Owner int_param Owner str_param Owner uint_param 1 101 Hello World 670 PIE 4 106 Hello Germany 5 Hello Arizona 6 Hello France ZOO 8 222 new hello 3000 Listing 2 7 CSV output file example o _ 1 Simulation time Fri Mar 28 14 00 42 2008 2 3 CSVexample log 4 5 time delta Ownerint_param Owner str_param Owner uint_param 6 1ns l 101 Hello World 670 7 2ns 3 104 B 2ns 4 106 Hello Germany 62 ns 5 Hello Arizona 10 2ns 6 Hello France 11 3ns 7 2000 12 5ns 8 222 new hello 3000 13 106 ns 10 133 a ns 18 10000 15 Y 14 K KI CSVexample log csv D Bereit mm 2 En El Figure 2 5 CSV ouput plugin Excel example 2 4 6 SCV stream Output Plugin E Include L_1greencontrol analysis scv_outputplugin h E Implem
41. output plugin starts paused calling resume a could output the values recorded cached before desired behavior b or could just start outputting E When pause gets called which is not the automatic internal pause on instantiation the o plugin has the choice to a keep the callbacks but drop changes desired default b or keep the callbacks and record cache changes to output them on resume c or do a or b but unregister callbacks S When resume get called during simulation the o plugin has the choice to 11 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW laa a output the first value change desired default b or output the current value s LA Implementation Note Output Plugins handling callbacks E Base class behavior When a parameter is added for observation the base class will immediately call the output plugin s callback function S The callback function can use m_constructing to check if called during construc tion S The output plugin is able to check if a call is a usual value change call back or the initial add for observation call by checking the base class member m_currently_calling_initial_add_for_observation_callback A Info Output plugins may start paused by default because an output plugin might need to initialize after all parameters have been added e g
42. page for a list of regression tests The positive and negative regres sion tests are mainly done in the examples J example greencontrol examples gav simple and greencontrol examples gav_StatCalc In the files L_Isimple_analysis globals h and L_Janalysis statcalc_globals h the define SHOW_REGRESSION_TEST_RESULTS_ON can be undefined to switch off the regression tests output 41 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW lia g Appendix A Appendix A 1 Green Analysis and Visibility Requirements A 1 1 General E Capture any kind of parameters gs_params when changed to O store changes O make changes visible to external tools O calculate with other parameters result is again a parameter O calculate statistics on parameters result is again a parameter E Capture parameters conditional not only on changes O boolean expression of gs_param lt bool gt s O event based O function call manually call to statistics calculator O combination of these Hi The GREENAV framework does not store results itself expect in the case of O statistics e g sliding window O special output plugins that caches values S AI results changes etc are provided to tools files etc via OutputPlugins in the GAV Plugin A 1 2 Details Requirements met by architectural design E captured data proces
43. r void to the parameter that should be added NULL and if AnyPointer NULL only return the default output plugin pointer without observing a parameter Es 24 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW a Description O A _CREATE_ REQUEST AnyUint Type of the OutputPlugin that should be created OUTPUT_PLUGIN ar member of enum OutputPluginType REQUEST Value Constructor parameter string that should be given to the output plugin s constructor contain ing e g filename dependent on the output plugin type RESPONSE AnyPointer Pointer identifier to the created output plugin Can be used in the CMD_ADD_TO_OUTPUT_PLUGIN command for adding parameters po RESPONSE No error specified so long D_GET_ 2 RESPONSE AnyPointer Pointer to the plugin s trigger event listener ENT_LISTENER AS RESPONSE No error specified so long 2 5 3 Event Listener Some analysis objects have to wait for events These objects may not be allowed to be an sc_module because they may be created during simulation runtime e g the trigger of the statistics calculator see section 2 6 1 To be able to wait for sc_events anyway that object may use event listeners Event listeners are sc_modules owned by the plugin doing dynamically spawned event waits An event listener is is templated
44. ram and uint64_param are shown in Decimal data format 21 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW rn File Edit Search Time Markers View Help Gioavaver VcDexample log vcd VCD loaded successfully Zoom Page Fetch Disc Shift Marker Time Regions formed on demand AQ ke 4 4 roma gt S lead Left Justification To 210ns Current Time a Hels A Ca gt 9 9 1010 ps a V SST Signals Waves Time Owmer int_param 31 0 Owner logic_param Owner str_param 511 0 Hello World Hello France Ouner uint64_param 63 0 18446744073709551615 18446744073709551614 Signals B Owner int_param1 31 0 Owner int_param2 31 0 Owner int_param3 31 0 Owner int_param 31 0 D Filter append insert Replace Figure 2 6 VCD output file showed in GTKWave 2 4 8 How to implement an Output Plugin This is a short introduction how to implement a new output plugin For a simple example see the STDOUT output plugin in file L Stdout OutputPlugin h see section 2 4 3 Outside the class but in same namespace specify the project wide unique id and convenience name with the macro GAV_ REGISTER_PLUGIN unique_id convenience_variable class_name Example EGISTER_PLUGIN 10 M
45. rameter of the CSV_OutputPlugin is the filename of the output file The default filename for the plugin s default output plugin is default csv If the filename string has not the postfix csv this will be appended automatically Due to the structure of CSV files all parameters must be registered before writing the file The plugin will begin writing the file on the first parameter change The behavior how to react to newly added parameters after began writing can be adapted with the define ALLOW_ADDING_PARAMETERS_AFTER_HEADER_WRITTEN If not defined the output plugin will refuse ignore all register requests for new parameters after having written the first value If defined the output plugin will add this new observed parameter to each following line Accordingly the row witdh may increase within the CSV file which is imported by Excel without problems But the head of the table will not include the parameter name the last columns will remain unnamed Pausing the plugin does not write the current time slot to the file because the plugin may be resumed again during the same time slot The separator character can be specified with the macro define SEPARATOR For standard conform CSV files this separator has to be a for files to be imported by Excel should be used default The following text file is an example for a file created by this plugin The first line is the time of the simulation run the thirs line is the
46. saction_text db Add define areas to use other databases like ModelSim There are some options to change the output plugin s behavior to be able to support a wide range of external tools reading the SCV stream These options can be changed in the define area at the top of the file L_1SCV_OutputPlugin h S The default is to use only one globals database for all SCV output plugin instances If there is a database type that is able to handle more than one database undefine the define ONLY_ONE_GLOBAL_DATABASE E Tf a tool or database is only able to handle one stream use the define ONLY_ONE_GLOBAL STREAM defined by default Then all scv_0utputPlugin instances write to the same stream S The OutputPlugin is able to create transactions with values of the type string default The user may set define USE_CORRECT_TYPE_TRANSACTIONS true to enable transactions containing values of the correct type as long as the type is listed in the enum gs cnf Param_type and is implemented here This is slower because of some additional switch statements and casts The files L AVscvAnalyserTool in the example greencontrol examples gav_simple create SCV output streams Experience with Mentor Graphics ModelSim ModelSim Mentor Graphics has the ability to run SystemC simulations and to show the results graphi cally GreenBus and GREENCONTROL including GREENCONFIG and GREENAV can be compiled with Mentor s sccom compiler and can be run wit
47. scint 10 gs gs_param lt sc_biguint lt 70 gt gt scbuint Scbuint 10 gs av Calculator lt unsigned long long gt c my_calc s c cala scint scbuint Listing 2 15 Simple example using the calc syntax Calculator type unsigned long long formula scint scbuint gs_param lt double gt dbl_p dbl_p gs gs_param lt int gt int_p int_p i gs_param lt int gt int_p2 int_p2 gs_param lt unsigned int gt uint_p uint_p av Calculator lt double gt cl my_calculator sCalo 4 cl cale s cl cala int p 1nt_p2 int_p2 cl calc dbl_p uint_p Listing 2 16 Example using the calc syntax Calculator type double formula int_p int_p2 int_p2 dbl_p x uint_p Convenient operators Alternative to the calc function you may use more convenient operators For the operations there are operators for the gs_param_base class See listing 2 17 for an example listing 2 18 shows how to mix convenient operators with calc syntax You may use c c il i2 c i2 12 where il and 12 have to be gs_param_bases A Warning Be careful to surround each operation with a calculator call my_calculator lt param_base gt lt operator gt lt param_base gt A Warning Only parameter bases gs_param_base may be used no gs_param lt T gt gs_param_base bl int_p int_p gs_param lt int gt see example above gs_param_base b2 int_p2 int_p2 gs_param l
48. sed in real time 4 1 1 2 O maximum data available statistics calculators caches data they need 42 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW a Functional Requirements M Capture API GAV_Api and StatisticsCalculator 4 1 1 O Capture information if user defined condition exists 4 1 1 1 e sc_event e boolean expression e method call e combination of the three E Listener API GAV_Plugin with OutputPlugins O Tool interface Listener API is a bridge to output types Out putPlugins 4 1 2 combined with GAV_API 4 1 2 1 and GCnf_Api 4 1 2 2 pull mechanism to browse parameters and add them to output or calculate statistics O Support SCV API but do not use it 4 1 1 3 export to SCV stream s via OutputPlugin E Provide information to module inside simulation GAV_Api Service Plugin API for GREENCONTROL Performance requirements S Performance impact low per capture instance 4 3 1 Callbacks inside gs_params S Inactive probe negligible performance impact 4 3 2 Performance impact of a gs_param without callbacks A 1 3 Nice to have features The GREENAV framework in its first version April 2008 will provide needed functionality for several statistics The implementation of pre defined statistics in GreenBus may be done in the future E Built in analysis parameters and statisti
49. sis and Visibility 2 1 Architecture Green Analysis and Visibility GREENAV GAV follows the GREENCONTROL concept see figure 2 1 A plugin GAV_Plugin manages the functionality that is needed centralized for analysis and visibility An API GAV_Api allows access to the plugin s functionality Green Analysis Visibility GAV Concept UserModule ConfigPlugin Figure 2 1 GreenAV Concept Figure 2 2 is an overview over the most important elements of GREENAV The user module may use the GAV_Api to access OutputPlugins see section 2 4 The user module also can create Statistics Calculator objects StatCalc and the concerning Triggers and Calculators see section 2 6 The event listeners are members of the GAV_Plugin One is used by the output plugins and one is used by the triggers without the user s recognition GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW rn Green Analysis Visibility GAV Concept 2 UserModule ConfigPlugin Figure 2 2 GreenAV full Concept 2 2 Namespace gs av All analysis and visibility classes of this GREENAV framework are located within the namespace gs av which is a sub namespace of the GreenSocs namespace gs This framework uses the GREENCONTROL namespace gs ctr and some elements
50. st not be called before a formula has been specified When searching for the result parameter in the parameter list use the parameter with the name lt CalcName gt _result_ lt highestnumber gt When using a sliding window use the parameter lt CalcName gt _SlidingWindow How add user defined functions The use can extend the calculation abilities of the GREENAV Calculator by adding functions additional to the predefined operations The user defined functions are accessible with the calc syntax just as the predefined ones E A function can only be added to a special template type of the Calculator class The types of the function signature must match the template type E A function added to Calculator lt type gt is also available in Calculator_bit lt type gt The calculation function must be static The calculation function must match the following signature static T average T a T b bool sloppy S The static function may be placed anywhere Only the function pointer has to be given to the add function Hi The sloppy parameter should be checked and if true all fatal errors that could occur during the calculation should be catched Listings 2 23 and 2 24 show examples how to define and add functions 38 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ias 1 Average calculator function to be
51. stc_c 6 Optional Get the result parameter m_gavApi add_to_default_output gs av STDOUT_OUTPUT_PLUGIN stc get_result_param or gs gs_param lt int gt res stc get_result_param See the example greencontrol examples gav_StatCalc for regression tests and examples on the statistics calculator the trigger and the calculator 2 7 Miscellaneous 2 7 1 Dynamic Processes L Important Dynamic processes Use define SC_INCLUDE_DYNAMIC_PROCESSES before including LJsystemc h or use the compiler flag DSC_INCLUDE_DYNAMIC_PROCESSES to enable dynamic processes needed by the GAV Plugin 40 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW io 2 7 2 SystemC 2 1 Together with dynamic processes and boost tokenizer SystemC 2 1 produces compiler errors The parameter arrays use the boost tokenizer and this seems to have a bug in SystemC 2 1 it seems already to be included by SystemC before GREENAV includes it in the array class As a work around you have to include the boost tokenizer before including SystemC Must be included BEFORE SystemC because SystemC has a buggy boost implementation included include lt boost tokenizer hpp gt for parameter array define SC_INCLUDE_DYNAMIC_PROCESSES include lt systemc h gt 2 7 3 Regression Tests See the project web
52. stered office 10 Wellington Street Cambridge CB1 1HW lia gs gs_param lt bool gt enabled mCnfApi gt get_gs_param lt bool gt AnalysisPlugin 2 STDOUT_OUT_default mymodule submodule myparam enabled false This works as well with any manually created output plugin E g to add a parameter to an output plugin named mymodule main_action STDOUT_OUT_userChosenConstructorParam this is done by calling ijmCnfApi gt setInitValue mymodule main_action 2 STDOUT_OUT_userChosenConstructorParam mymodule param2 true Output plugin behavior The default behavior which differs between different output plugins is that after adding a parameter for observation if the output plugin is running the first log output is caused immediately when the parameter is added This helps logging e g initial values E An output plugin has the free choice to begin paused which is not the desired default In this case it is the output plugin s choice a to cache desired default b or drop the changes O All output plugins get automatically started by calling resume during end_of_elaboration e To prevent an output plugin to start there the user can call dont_start before end_of_elaboration O The user has the option to start each output plugin by calling resume whenever he wants that might be before the automatic start during end_of_elaboration or after if e g dont_start has been called before S When an
53. stroyed Also take care to deactivate the trigger com pletely when the deactivation function is being called On activation you have to check whether all formula parameters are still existing 29 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ia g GreenAV default Trigger and calculation activation events The default GreenAV trigger object class is Trigger The trigger automatically registers for callbacks of all formula input parameters which are given to the trigger via the set_used_params call The trigger handles destructed input parameters by deactivating the trigger forever and never again calling the calculator functor object Even if parameter changes are not a calculation activating event the trigger registers for callbacks just to check if the changed parameter is being destructed Calculation activation event kinds this Trigger supports are E sc_event for SystemC events The sc_event calculation activation event uses the trigger event listener of the GAV plugin to wait for the user given event When the event is notified the trigger will be called back function event_callback by the event trigger E sc_time for periodical sample intervals periodically repeated events The sc_time calculation activation event notifies the trigger itself periodically after the specified time intervals This
54. t a e a SEG SEES SS E e E A e E e a a 32 206 3 SatCale Miscellaneous o cs s hoe eo e rr GS 38 2 6 4 How to use Overview uaaa RR SHEER ES EEE EEG ES 39 AT IMC lt lt uca a ricas A A AA A ee a 39 1 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ads 2 7 1 Dynamic Processes bk Re ds aaa 39 are IIA a a Oe a a a a a 40 Sia Regression Tests e cr EAS 40 A Appendix 41 A l Green Analysis and Visibility Requirements 2 0 S444 41 Adl General oe eee ew e Eee PRS Sed p E e a e a A 41 Ala Deilt seres nesam erme a k WS amp a OS ee HS we RA 41 A 1 3 Niceto have features 0080 ce eee eee eee ee as 42 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW las List of Figures 2 1 2 2 23 2 4 2 5 2 6 eN CERAS COMBO se Da e e RRR R EE SY ESSE OE RHEE 4 A full Concept MA 5 GreenAV Concept for Outputs The GAV_Plugin contains several types of output plugins 7 GreenAV Output Example lt SAS 14 CSV ouput plugin Excel example o ke a SR eR EE ERE a 18 VCD output file showed in GTKWave a 21 GreenAV Statistics Calculator Concept o o 26 3 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales
55. t behavior 2 4 7 Value Change Dump VCD Output Plugin E Include L greencontrol analysis_vcd_outputplugin h E Implementation see file L_1VCD_OutputPlugin h S Identify this output plugin with gs av VCD_FILE_OUT id OutputPluginType 6 E Behavior O Starts paused will start automatically during end_of_elaboration or can be started manually O Does not cache value changes when paused O On resume it outputs the first value change not the current value The Value Change Dump VCD output plugin can be used to output parameter changes that can be viewed graphically using a VCD viewer like GTK Wave The constructor parameter of the VCD_OutputPlugin is the filename of the output file The default filename for the plugin s default output plugin is default vcd If the filename string has not the postfix vcd it will be appended automatically Due to the structure of VCD files all parameters must be registered before the first write of the file The plugin will start paused and begin writing the file when resumed either automatically durig end_of_elaboration or manually by calling the resume method New parameter additions will cause an error Figure 2 6 shows an example of a file created by this plugin from example gav_simple and opened with GTKWave Note that the plugin has support for text strings str_param in the figure To show a wave as a text in GTKWave select Edit Data Format ASCII The parameters int_pa
56. t int gt see example above gS_param_base bu3 uint_p uint_p gs_param lt uint gt see expl above gs av Calculator lt int gt cc my_convCalc cc cc bl cc bl b2 cc cc bl b2 b2 Listing 2 17 Example using convenient operators Calculator type int formula b1 b1 b2 b1 x b2 b2 gs av Calculator lt int gt mc my_mixedCalc mc b1 mc calc inp_int_par inp_int_par2 Listing 2 18 Example mixing calc syntax and convenient operators Calculator type int formula b1 inp_int_par inp_int_par 2 36 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ia C Implementation Note Convenient operators These operators are implemented in the gs_param_base class To give the user furthermore the ability to use gs_params simple like e g integers the derived classes gs_param lt T gt must implement the operators with normal behavior Since only the return type differs from the calculator s operators defined in the base class the calculator s operators cannot overload the original ones Accordingly the user must use base objects to access the calculator s operators Sloppy calculations Call enable_sloppy to enable the sloppy feature call disable_sloppy to disable it Sloppy is disabled by default Constants Within the formula hard
57. the type as an enum gs cnf Param_type see file L gcnf_datatypes h If parameters of type sc_time should be used as input parameters a Calculator of type double should be used The Calculator does no initial calculation when being created This assures that only when the specified activation events occur the calculation will be performed How to use The steps before adding a calculator to the StatCalc s constructors are 1 Create a Calculator or Calculator_bit object giving a name to the constructor 2 Specify the formula which this calculator should use Use the calc syntax or the convenient oper ators 3 Optional get the result parameter This may also be called on the StatCalc object after having created it Calc syntax The calc syntax is the designated way of setting up a complex formula of several formula input parameters A calc call gets as function call parameters a string specifying the operation and two input parameters of type gs_param lt T gt or gs_param_base Nested calls of calc function calls may be used because the calc function returns an intermediate result parameter The listings 2 15 and 2 16 show examples how to specify a calculation formula using the calc syntax 35 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW liado Wgs gs_param lt sc_int lt 1l0 gt gt scint
58. to the initiator who wants to wait for an event When the initiator calls create_event_listener the listener dynamically spawns a process being sensitive for the given event When the event is notified the initiator is called back by the listener process The plugin has two event listeners event_listener lt trigger_if gt and event_listener lt OutputPlugin_base gt The one for triggers can be accessed using the GAV user API by calling get_event_listener see section 2 3 The listener pointer templated to trigger_if can be transported to the API via a transaction of command type CMD_GET_EVENT_LISTENER The listener templated to OutputPlugin_base is used by the plugin itself when instantiating output plugins 2 6 Statistics Calculator Concepts Most analysis tasks are performed by the Statistics Calculator StatCalc which is realized in the class StatCalc in file J StatCalc h The Statistics Calculator class StatCalc manages the analysis of several input parameters that are calculated in a formula on several activation events The tasks and the corresponding interfaces can be classified as follows 25 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW ia S 1 Calculation Interface Calculator S Math operations S Logical operations for boolean expressions usable as activation event 2 Calculation Activat
59. vents When one event occurs the re calculation of the calcu lator functor has to be called so the trigger object triggers the calculation The trigger is an object that must inherit trigger_if to allow it to be managed by the StatCalc object Interface All trigger classes have to implement the virtual interface trigger_if The following listing lists the functions to be implemented by a trigger class 28 GreenSocs is the trading name of GreenSocs Ltd Registered in England and Wales with registered number 05379256 Registered office 10 Wellington Street Cambridge CB1 1HW io 1 class trigger_1f virtual trigger_if Initialization functions virtual void set_activated_param gs gs_param lt bool gt amp activated virtual void set_calc_object calc_if 0 virtual void set_used_params std vector lt gs_param_base gt 0 User functions virtual bool is_activated 0 virtual void activate 0 virtual void deactivate 0 Callback functions virtual void event_callback 0 virtual void interval_callback 0 Listing 2 8 Trigger interface trigger_if For a detailed description see the API reference The initialization functions are called by the StatCalc during its construction The function set_activated_param gets a reference to the parameter that has been created by the StatCalc and which represents and modifies the activation status The trigger has to register a ca
Download Pdf Manuals
Related Search
Related Contents
HP Smart Buy - HP Compaq 8710w Mobile Workstation RM300UTABA448 instant savings PC Notebook Operating Instructions AZ260 年間プログラムタイマ QT-5800シリーズ tunel aerodinamico de demostracion fl4 ensayos componentes Mode d`emploi: Désodorisant. Ouvrir le sachet et retirer le Hampton Bay HD10256TOBRZC Instructions / Assembly Display - Services USER MANUAL 取扱説明書 - アルファックス・コイズミ Copyright © All rights reserved.
Failed to retrieve file