6#include "SkeletonSimulator.hpp"
9#include "sparta/utils/TimeManager.hpp"
13#include "Producer.hpp"
14#include "Consumer.hpp"
17 sparta::app::Simulation(
"sparta_skeleton", &scheduler),
24 std::cout <<
"NOISE: " << __PRETTY_FUNCTION__ <<
": Constructing" << std::endl;
35SkeletonSimulator::~SkeletonSimulator()
38 std::cout << __PRETTY_FUNCTION__ <<
": Tearing down" << std::endl;
43void SkeletonSimulator::buildTree_()
46 std::cout <<
"NOISE: " << __PRETTY_FUNCTION__ <<
": Building the ResourceTreeNodes -- not instantiated yet" << std::endl;
64 const uint32_t num_producers = param_set->
getParameterAs<uint32_t>(
"num_producers");
67 for (uint32_t i = 0; i < num_producers; ++i)
69 std::stringstream nodeName, humanName;
70 nodeName <<
"producer" << i;
71 humanName <<
"Producer " << i;
87void SkeletonSimulator::configureTree_()
90 std::cout <<
"NOISE: " << __PRETTY_FUNCTION__
91 <<
": Configuring the parameters in the ResourceTreeNodes, "
92 <<
"but not the simulated objects are still not instantiated yet!" << std::endl;
99void SkeletonSimulator::bindTree_()
102 std::cout <<
"NOISE: " << __PRETTY_FUNCTION__
103 <<
": The simulated objects are instantiated. Can be bound now." << std::endl;
113 const uint32_t num_producers = param_set->
getParameterAs<uint32_t>(
"num_producers");
115 for (uint32_t i = 0; i < num_producers; ++i)
117 std::stringstream nodeName, humanName;
118 nodeName <<
"producer" << i;
File that defines the Clock class.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
#define SPARTA_EXPECT_FALSE(x)
A macro for hinting to the compiler a particular condition should be considered most likely false.
Basic Node framework in sparta device tree composite pattern.
static const char * name
Name of this resource. Required by sparta::ResourceFactory.
SkeletonSimulator(sparta::Scheduler &scheduler, bool be_noisy)
Construct SkeletonSimulator.
Generic container of Parameters.
const Parameter< ContentT > & getParameterAs(const std::string &name) const
Retrieves a sparta::Parameter<ContentT> reference from this parameter set.
The port interface used to bind port types together and defines a port behavior.
Templated ResourceFactoryBase implementation which can be used to trivially define Resource Factories...
void addResourceFactory()
Add a resource factory by its template type.
TreeNode subclass representing a node in the device tree which contains a single ResourceFactory and ...
ParameterSet * getParameterSet()
Gets the ParameterSet associated with this ResourceTreeNode.
void enterTeardown()
Places this tree into TREE_TEARDOWN phase so that nodes may be deleted without errors.
A class that lets you schedule events now and in the future.
Node in a composite tree representing a sparta Tree item.
static const group_idx_type GROUP_IDX_NONE
GroupIndex indicating that a node has no group index because it belongs to no group.
static constexpr char GROUP_NAME_NONE[]
Group name indicating that a node belongs to no group.
const ConstT getChildAs(const std::string &name, bool must_exist=true) const
Retrieves a child that is castable to T with the given dotted path.
std::vector< std::unique_ptr< sparta::TreeNode > > to_delete_
Vector of TreeNodes to delete automatically at destruction. Add any nodes allocated to this list to a...
sparta::RootTreeNode * getRoot() noexcept
Returns the tree root.
sparta::ResourceSet * getResourceSet() noexcept
Returns the resource set for this Simulation.
Macros for handling exponential backoff.
void bind(Bus *p1, Bus *p2)
Bind two buses together.