| |||
| Home > SystemC Export > Adding the generated SystemC component to a SystemC system | |||
The following steps are required to add the generated System C component to your SystemC project:
Link the generated library to your existing SystemC system.
Include the generated header file of the generated
SystemC component into main.cpp:
#include "sc_sg_wrapper_MySystem.h"
Instantiate the generated SystemC component:
sc_sg_wrapper_MySystem mySystem("mySystem");
If your generated system contains components that can load application files, such as CPUs, load the application files into them:
mySystem.load_application_file("cpu0", "myApplication.elf");
where is
the instance name of a CPU in the Fast Models system.cpu0
The Cortex A9MP requires that the CPU is specified by using
a period (.) before the name. To load an application to cpu0, use
a specification string like Core.cpu0 where Core is
the instance name. The Dhrystone example in the SystemC export directory
uses this convention.
If required, set parameters for the configurable
components of the Fast Models system. For example, to set parameter PAR of
component instance to
value cpu0true:
mySystem.set_parameter("cpu0.PAR", true);
The Cortex A9MP requires that the CPU is specified if the
parameter is set for a specific core. Use a specification string
like Core.cpu0.PAR where Core is
the instance name.
Setup the simulation frequency of the Fast Models system, in Hz:
mySystem.set_frequency(1000000000);
The parameter value must be the same frequency as the master clock connected to the system.
Setup the execution quantum of the Fast Models system:
mySystem.set_global_quantum(0.001);
For this example, the Fast Models system runs for 100 ticks
before SystemC wait() is called.
Bind the master port and slave ports (exports) of the generated SystemC component to the other components in the SystemC system. Because the generated ports are native SystemC ports, binding the ports works in the same way as between all other SystemC components.