The Sparta Modeling Framework
Loading...
Searching...
No Matches
CPUFactory.hpp
1// <CPUFactory.h> -*- C++ -*-
2
3
4#pragma once
5
6#include "sparta/simulation/ResourceFactory.hpp"
8#include "CPU.hpp"
9#include "sparta/simulation/ResourceTreeNode.hpp"
10#include "CPUTopology.hpp"
11
12namespace core_example{
13
25class CPUFactory : public sparta::ResourceFactory<CPU, CPU::CPUParameterSet>{
26public:
27
31 CPUFactory();
32
37
41 auto setTopology(const std::string&, const uint32_t) -> void;
42
46 auto buildTree(sparta::RootTreeNode*) -> void;
47
51 auto bindTree(sparta::RootTreeNode*) -> void;
52
56 auto getResourceNames() const -> const std::vector<std::string>&;
57private:
58
62 auto buildTree_(sparta::RootTreeNode*,
63 const std::vector<CPUTopology::UnitInfo>&) -> void;
67 auto bindTree_(sparta::RootTreeNode*,
68 const std::vector<CPUTopology::PortConnectionInfo>&) -> void;
69
73 const char to_replace_ {'*'};
74
78 std::unique_ptr<CPUTopology> topology_;
79
83 std::vector<std::string> resource_names_;
84
88 std::vector<sparta::TreeNode*> private_nodes_;
89
93 std::vector<std::unique_ptr<sparta::ResourceTreeNode>> to_delete_;
94}; // class CPUFactory
95} // namespace core_example
TreeNode refinement representing the root (or "top") of a device tree.
auto getResourceNames() const -> const std::vector< std::string > &
Get the list of resources instantiated in this topology.
~CPUFactory()
Destructor for CPUFactory.
auto setTopology(const std::string &, const uint32_t) -> void
Set the user-defined topology for this microarchitecture.
auto buildTree(sparta::RootTreeNode *) -> void
Build the device tree by instantiating resource nodes.
auto bindTree(sparta::RootTreeNode *) -> void
Bind all the ports between different units and set TLBs and preload.
CPUFactory()
Constructor for CPUFactory.
Templated ResourceFactoryBase implementation which can be used to trivially define Resource Factories...
TreeNode which represents the root ("top") of a device tree.
Macros for handling exponential backoff.