The Sparta Modeling Framework
|
The is the base class for user defined blocks in simulation. More...
#include <Unit.hpp>
Public Member Functions | |
Unit (TreeNode *rc, const std::string &name) | |
Construct unit with a ResouceContainer. | |
Unit (TreeNode *rc) | |
Construct unit with a ResouceContainer. | |
virtual | ~Unit () |
Destroy! | |
void | setAutoPrecedence (bool auto_p) |
Turn off auto-precedence. | |
PortSet * | getPortSet () |
Return the port set. | |
EventSet * | getEventSet () |
Return the event set. | |
StatisticSet * | getStatisticSet () |
Return the stat set. | |
Public Member Functions inherited from sparta::Resource | |
Resource (TreeNode *rc) | |
Construct resource with a resource container. | |
Resource (TreeNode *rc, const std::string &name) | |
Construct resource with a specific name and resource container. | |
Resource (const std::string &name, const Clock *clk) | |
Construct a Resource with the given name and clock having NO association with a resource container. This constructor is reserved for free-standing resources owned by other resources (not containers [TreeNodes]) | |
virtual | ~Resource () |
Destroy! | |
const Clock * | getClock () const |
Scheduler * | getScheduler (const bool must_exist=true) const |
std::string | getName () const |
TreeNode * | getContainer () |
Gets the TreeNode (container) for this resource (if any) | |
const TreeNode * | getContainer () const |
Gets the TreeNode (container) for this resource (if any) | |
ResourceContainer * | getResourceContainer () |
Gets the ResourceContainer for this resource (if any) | |
const ResourceContainer * | getResourceContainer () const |
Gets the ResourceContainer for this resource (if any) | |
virtual void | addLink (TreeNode *node, const std::string &label) |
virtual void | activateLink (const std::string &label) |
Resource (const Resource &)=delete | |
Disallow copying. | |
Resource & | operator= (const Resource &)=delete |
Static Public Attributes | |
static constexpr const char * | INFO_LOG = "info" |
static constexpr const char * | WARN_LOG = log::categories::WARN_STR |
static constexpr const char * | DEBUG_LOG = log::categories::DEBUG_STR |
Protected Member Functions | |
virtual void | onBindTreeEarly_ () override |
virtual void | onBindTreeLate_ () override |
Dump a dot. | |
Protected Attributes | |
sparta::PortSet | unit_port_set_ |
The Unit's Ports. | |
sparta::EventSet | unit_event_set_ |
The Unit's event set. | |
sparta::StatisticSet | unit_stat_set_ |
The Unit's statistic set. | |
log::MessageSource | info_logger_ |
Default info logger. | |
log::MessageSource | warn_logger_ |
Default warn logger. | |
log::MessageSource | debug_logger_ |
Default debug logger. | |
Friends | |
class | DAG |
The is the base class for user defined blocks in simulation.
This class defines common set of sets (sparta::PortSet, sparta::EventSet, and sparta::StatisticSet) as well as common loggers (info_logger_, warn_logger_, debug_logger_). In addition, this class will establish precedences between Ports and Events. See setAutoPrecedence() for more information.
|
inline |
|
inline |
Construct unit with a ResouceContainer.
rc | ResourceContainer that will hold this Unit until the Unit is destructed. Name and clock are extracted from this container. Must not be nullptr |
|
inline |
|
inline |
|
inline |
|
inlineoverrideprotectedvirtual |
From sparta::Resource, set up precedence between ports and events registered in the sets
Reimplemented from sparta::Resource.
Definition at line 121 of file Unit.hpp.
|
overrideprotectedvirtual |
Dump a dot.
Reimplemented from sparta::Resource.
|
inline |
Turn off auto-precedence.
auto_p | True, perform auto-precedence, false, don't |
By default, the sparta::Unit will establish precedence between registered events (via the unit_event_set_) and registered ports (via the unit_port_set_). Specifically, the Unit will register all events in the sparta::SchedulingPhase::Tick as consumers on InPorts and producers on OutPorts. If this behavior is not desired, call setAutoPrecedence() with the value false.
|
staticconstexpr |
|
protected |
|
staticconstexpr |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexpr |
|
protected |