The Sparta Modeling Framework
Loading...
Searching...
No Matches
CPUTopology.cpp
1// <CPUTopology.cpp> -*- C++ -*-
2
3#include "CPUTopology.hpp"
5
10
12 units = {
13 {
14 "core*",
15 "cpu",
16 "Core *",
19 &factories->core_rf
20 },
21 {
22 "flushmanager",
23 "cpu.core*",
24 "Flush Manager",
27 &factories->flushmanager_rf
28 },
29 {
30 "fetch",
31 "cpu.core*",
32 "Fetch Unit",
35 &factories->fetch_rf
36 },
37 {
38 "decode",
39 "cpu.core*",
40 "Decode Unit",
43 &factories->decode_rf
44 },
45 {
46 "rename",
47 "cpu.core*",
48 "Rename Unit",
51 &factories->rename_rf
52 },
53 {
54 "dispatch",
55 "cpu.core*",
56 "Dispatch Unit",
59 &factories->dispatch_rf
60 },
61 {
62 "alu0",
63 "cpu.core*",
64 "ALU Unit 0",
65 "alu",
66 0,
67 &factories->execute_rf
68 },
69 {
70 "alu1",
71 "cpu.core*",
72 "ALU Unit 1",
73 "alu",
74 1,
75 &factories->execute_rf
76 },
77 {
78 "fpu",
79 "cpu.core*",
80 "FPU Unit",
81 "alu",
82 2,
83 &factories->execute_rf
84 },
85 {
86 "br",
87 "cpu.core*",
88 "BR Unit",
89 "alu",
90 3,
91 &factories->execute_rf
92 },
93 {
94 "lsu",
95 "cpu.core*",
96 "Load-Store Unit",
99 &factories->lsu_rf
100 },
101 {
102 "tlb",
103 "cpu.core*.lsu",
104 "TLB Unit",
107 &factories->tlb_rf,
108 true
109 },
110 {
111 "biu",
112 "cpu.core*",
113 "Bus Interface Unit",
116 &factories->biu_rf
117 },
118 {
119 "mss",
120 "cpu.core*",
121 "Memory Sub-System",
124 &factories->mss_rf
125 },
126 {
127 "rob",
128 "cpu.core*",
129 "ROB Unit",
132 &factories->rob_rf
133 },
134 {
135 "preloader",
136 "cpu.core*",
137 "Preloader Facility",
140 &factories->preloader_rf
141 }
142 };
143
145 port_connections = {
146 {
147 "cpu.core*.fetch.ports.out_fetch_queue_write",
148 "cpu.core*.decode.ports.in_fetch_queue_write"
149 },
150 {
151 "cpu.core*.fetch.ports.in_fetch_queue_credits",
152 "cpu.core*.decode.ports.out_fetch_queue_credits"
153 },
154 {
155 "cpu.core*.decode.ports.out_uop_queue_write",
156 "cpu.core*.rename.ports.in_uop_queue_append"
157 },
158 {
159 "cpu.core*.decode.ports.in_uop_queue_credits",
160 "cpu.core*.rename.ports.out_uop_queue_credits"
161 },
162 {
163 "cpu.core*.rename.ports.out_dispatch_queue_write",
164 "cpu.core*.dispatch.ports.in_dispatch_queue_write"
165 },
166 {
167 "cpu.core*.rename.ports.in_dispatch_queue_credits",
168 "cpu.core*.dispatch.ports.out_dispatch_queue_credits"
169 },
170 {
171 "cpu.core*.dispatch.ports.out_fpu_write",
172 "cpu.core*.fpu.ports.in_execute_write"
173 },
174 {
175 "cpu.core*.dispatch.ports.in_fpu_credits",
176 "cpu.core*.fpu.ports.out_scheduler_credits"
177 },
178 {
179 "cpu.core*.dispatch.ports.out_alu0_write",
180 "cpu.core*.alu0.ports.in_execute_write"
181 },
182 {
183 "cpu.core*.dispatch.ports.in_alu0_credits",
184 "cpu.core*.alu0.ports.out_scheduler_credits"
185 },
186 {
187 "cpu.core*.dispatch.ports.out_alu1_write",
188 "cpu.core*.alu1.ports.in_execute_write"
189 },
190 {
191 "cpu.core*.dispatch.ports.in_alu1_credits",
192 "cpu.core*.alu1.ports.out_scheduler_credits"
193 },
194 {
195 "cpu.core*.dispatch.ports.out_br_write",
196 "cpu.core*.br.ports.in_execute_write"
197 },
198 {
199 "cpu.core*.dispatch.ports.in_br_credits",
200 "cpu.core*.br.ports.out_scheduler_credits"
201 },
202 {
203 "cpu.core*.dispatch.ports.out_lsu_write",
204 "cpu.core*.lsu.ports.in_lsu_insts"
205 },
206 {
207 "cpu.core*.dispatch.ports.in_lsu_credits",
208 "cpu.core*.lsu.ports.out_lsu_credits"
209 },
210 {
211 "cpu.core*.dispatch.ports.out_reorder_buffer_write",
212 "cpu.core*.rob.ports.in_reorder_buffer_write"
213 },
214 {
215 "cpu.core*.dispatch.ports.in_reorder_buffer_credits",
216 "cpu.core*.rob.ports.out_reorder_buffer_credits"
217 },
218 {
219 "cpu.core*.lsu.ports.out_biu_req",
220 "cpu.core*.biu.ports.in_biu_req"
221 },
222 {
223 "cpu.core*.lsu.ports.in_biu_ack",
224 "cpu.core*.biu.ports.out_biu_ack"
225 },
226 {
227 "cpu.core*.biu.ports.out_mss_req_sync",
228 "cpu.core*.mss.ports.in_mss_req_sync"
229 },
230 {
231 "cpu.core*.biu.ports.in_mss_ack_sync",
232 "cpu.core*.mss.ports.out_mss_ack_sync"
233 },
234 {
235 "cpu.core*.rob.ports.out_retire_flush",
236 "cpu.core*.flushmanager.ports.in_retire_flush"
237 },
238 {
239 "cpu.core*.rob.ports.out_fetch_flush_redirect",
240 "cpu.core*.flushmanager.ports.in_fetch_flush_redirect"
241 },
242 {
243 "cpu.core*.rob.ports.out_rob_retire_ack",
244 "cpu.core*.lsu.ports.in_rob_retire_ack"
245 },
246 {
247 "cpu.core*.flushmanager.ports.out_retire_flush",
248 "cpu.core*.alu0.ports.in_reorder_flush"
249 },
250 {
251 "cpu.core*.flushmanager.ports.out_retire_flush",
252 "cpu.core*.alu1.ports.in_reorder_flush"
253 },
254 {
255 "cpu.core*.flushmanager.ports.out_retire_flush",
256 "cpu.core*.fpu.ports.in_reorder_flush"
257 },
258 {
259 "cpu.core*.flushmanager.ports.out_retire_flush",
260 "cpu.core*.dispatch.ports.in_reorder_flush"
261 },
262 {
263 "cpu.core*.flushmanager.ports.out_retire_flush",
264 "cpu.core*.decode.ports.in_reorder_flush"
265 },
266 {
267 "cpu.core*.flushmanager.ports.out_retire_flush",
268 "cpu.core*.rename.ports.in_reorder_flush"
269 },
270 {
271 "cpu.core*.flushmanager.ports.out_retire_flush",
272 "cpu.core*.rob.ports.in_reorder_flush"
273 },
274 {
275 "cpu.core*.flushmanager.ports.out_retire_flush",
276 "cpu.core*.lsu.ports.in_reorder_flush"
277 },
278 {
279 "cpu.core*.flushmanager.ports.out_fetch_flush_redirect",
280 "cpu.core*.fetch.ports.in_fetch_flush_redirect"
281 }
282 };
283}
284
289 CPUTopology* new_topology {nullptr};
290 if(topology == "core_topology_1"){
291 new_topology = new core_example::CoreTopology_1();
292 }
293 else{
294 throw sparta::SpartaException("This topology in unrecognized.");
295 }
296 sparta_assert(new_topology);
297 return new_topology;
298}
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
Exception class for all of Sparta.
static auto allocateTopology(const std::string &topology) -> CPUTopology *
Static method to allocate memory for topology.
CoreTopology_1 topology class.
CoreTopology_1()
Constructor for CPUTopology.
Used to construct and throw a standard C++ exception. Inherits from std::exception.
static const group_idx_type GROUP_IDX_NONE
GroupIndex indicating that a node has no group index because it belongs to no group.
Definition TreeNode.hpp:303
static constexpr char GROUP_NAME_NONE[]
Group name indicating that a node belongs to no group.
Definition TreeNode.hpp:314