The Sparta Modeling Framework
Loading...
Searching...
No Matches
Core.hpp
1
2
3#pragma once
4
5#include <string>
6
10#include "sparta/functional/RegisterSet.hpp"
12#include "sparta/statistics/Counter.hpp"
14
15
16namespace core_example
17{
18 class Core : public sparta::Unit
19 {
20 public:
21
24 {
25 public:
28 {
29 foo.addDependentValidationCallback([](std::string& s, const sparta::TreeNode*){return s.size() < 10;},
30 "Length must be < 10");
31 ctr_incr_period.addDependentValidationCallback([](uint64_t& v, const sparta::TreeNode*){return v > 0;},
32 "Counter increment period must be > 0");
33 ctr_incr_amount.addDependentValidationCallback([](uint32_t& v, const sparta::TreeNode*){return v > 0;},
34 "Counter incrementor must be > 0");
35 }
36
37 PARAMETER(std::string, foo, "default", "test parameter")
38 PARAMETER(uint64_t, ctr_incr_period, 1000, "Period of each 'counter_foo' counter update. Must be > 0")
39 PARAMETER(uint32_t, ctr_incr_amount, 1, "Value to increment the counter 'counter_foo' each counter update period. Must be > 0")
40 PARAMETER(std::vector<std::string>, contents, {}, "Content???")
41 };
42
44 static constexpr char name[] = "core_example_core";
45
60 const CoreParameterSet * params); // Temporary type
61
62 ~Core() {}
63
64
65 private:
66
70 void incrementCounter_();
71
72 std::vector<Resource *> resources_;
73 std::unique_ptr<sparta::RegisterSet> regs_;
74 sparta::Counter* fooctr_;
75 sparta::Event<> counter_incr_event_;
76 uint64_t counter_incr_period_;
77 uint64_t counter_incr_amount_;
78 };
79}
80
File that defines the Clock class.
File that defines the Event class.
A set of sparta::Parameters per sparta::ResourceTreeNode.
#define PARAMETER(type, name, def, doc)
Parameter declaration.
Basic Node framework in sparta device tree composite pattern.
File that defines the Unit class, a common grouping of sets and loggers.
Parameters for Core model.
Definition Core.hpp:24
static constexpr char name[]
Name of this resource. Required by sparta::UnitFactory.
Definition Core.hpp:44
Represents a counter of type counter_type (uint64_t). 2 and greater than 0 with a ceiling specified....
Definition Counter.hpp:27
Event is a simple class for scheduling random events on the Scheduler.
Definition Event.hpp:42
Generic container of Parameters.
Node in a composite tree representing a sparta Tree item.
Definition TreeNode.hpp:205
The is the base class for user defined blocks in simulation.
Definition Unit.hpp:38