The Sparta Modeling Framework
Loading...
Searching...
No Matches
CPUTopology.hpp
1// <CPUTopology.h> -*- C++ -*-
2
3
4#pragma once
5
6#include <memory>
7
8#include "CPU.hpp"
9#include "CPUFactories.hpp"
10#include "sparta/simulation/ResourceFactory.hpp"
12#include "sparta/simulation/ResourceTreeNode.hpp"
13
14namespace core_example{
15
29public:
30
32 struct UnitInfo{
33
35 std::string name;
36
38 std::string parent_name;
39
41 std::string human_name;
42
44 std::string group_name;
45
47 uint32_t group_id;
48
51
54
58 UnitInfo(const std::string& name,
59 const std::string& parent_name,
60 const std::string& human_name,
61 const std::string& group_name,
62 const uint32_t group_id,
64 bool is_private_subtree = false) :
65 name{name},
72 };
73
76
78 std::string output_port_name;
79
81 std::string input_port_name;
82
90 };
91
95 CPUTopology() : factories{new CPUFactories()}{}
96
100 auto setName(const std::string& topology) -> void{
101 topology_name = topology;
102 }
103
107 auto setNumCores(const uint32_t num_of_cores) -> void{
108 num_cores = num_of_cores;
109 }
110
114 static auto allocateTopology(const std::string& topology) -> CPUTopology*;
115
117 uint32_t num_cores;
118 std::unique_ptr<CPUFactories> factories;
119 std::string topology_name;
120 std::vector<UnitInfo> units;
121 std::vector<PortConnectionInfo> port_connections;
122}; // class CPUTopology
123
128public:
129
134}; // class CoreTopology_1
135} // namespace core_example
TreeNode refinement representing the root (or "top") of a device tree.
auto setNumCores(const uint32_t num_of_cores) -> void
Set the number of cores in this processor.
uint32_t num_cores
Public members used by CPUFactory to build and bind tree.
auto setName(const std::string &topology) -> void
Set the name for this topoplogy.
CPUTopology()
Constructor for CPUTopology.
static auto allocateTopology(const std::string &topology) -> CPUTopology *
Static method to allocate memory for topology.
CoreTopology_1 topology class.
CoreTopology_1()
Constructor for CPUTopology.
Factory which can create Resources as well as the Parameter sets that can be modified before actually...
Structure to represent a port binding between units in device tree.
std::string output_port_name
Out port name of unit_1.
PortConnectionInfo(const std::string &output_port_name, const std::string &input_port_name)
Constructor for PortConnectionInfo.
std::string input_port_name
In port name of next unit, unit_2.
Structure to represent a resource unit in device tree.
UnitInfo(const std::string &name, const std::string &parent_name, const std::string &human_name, const std::string &group_name, const uint32_t group_id, sparta::ResourceFactoryBase *factory, bool is_private_subtree=false)
Constructor for UnitInfo.
uint32_t group_id
TreeNode group id required for multiple execution units.
sparta::ResourceFactoryBase * factory
Factory required to create this particular resource.
std::string name
ResourceTreeNode name.
std::string parent_name
ResourceTreeNode parent name.
bool is_private_subtree
Flag to tell whether this node should be private to its parent.
std::string human_name
ResourceTreeNode human-readable name.
std::string group_name
TreeNode group name required for multiple execution units.