Skip to content

Commit 1230745

Browse files
Fix circular dependency between physical_types and interposer_types
1 parent 18193e9 commit 1230745

File tree

3 files changed

+133
-112
lines changed

3 files changed

+133
-112
lines changed

libs/libarchfpga/src/grid_types.h

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#pragma once
2+
3+
/**
4+
* @file grid_types.h
5+
* @brief FPGA grid layout data types
6+
*/
7+
8+
#include <string>
9+
#include <memory>
10+
11+
// Forward declerations
12+
13+
struct t_metadata_dict;
14+
15+
/**
16+
* @brief Grid location specification
17+
* Each member is a formula evaluated in terms of 'W' (device width),
18+
* and 'H' (device height). Formulas can be evaluated using parse_formula()
19+
* from expr_eval.h.
20+
*/
21+
struct t_grid_loc_spec {
22+
std::string start_expr; //Starting position (inclusive)
23+
std::string end_expr; //Ending position (inclusive)
24+
25+
std::string repeat_expr; //Distance between repeated
26+
// region instances
27+
28+
std::string incr_expr; //Distance between block instantiations
29+
// with the region
30+
};
31+
32+
/* Definition of how to place physical logic block in the grid.
33+
34+
*/
35+
36+
/**
37+
* @brief Definition of how to place physical logic block in the grid.
38+
* @details This defines a region of the grid to be set to a specific type
39+
* (provided its priority is high enough to override other blocks).
40+
*
41+
* The diagram below illustrates the layout specification.
42+
*
43+
* +----+ +----+ +----+
44+
* | | | | | |
45+
* | | | | ... | |
46+
* | | | | | |
47+
* +----+ +----+ +----+
48+
*
49+
* . . .
50+
* . . .
51+
* . . .
52+
*
53+
* +----+ +----+ +----+
54+
* | | | | | |
55+
* | | | | ... | |
56+
* | | | | | |
57+
* +----+ +----+ +----+
58+
* ^
59+
* |
60+
* repeaty |
61+
* |
62+
* v (endx,endy)
63+
* +----+ +----+ +----+
64+
* | | | | | |
65+
* | | | | ... | |
66+
* | | | | | |
67+
* +----+ +----+ +----+
68+
* (startx,starty)
69+
* <-------------->
70+
* repeatx
71+
*
72+
* startx/endx and endx/endy define a rectangular region instances dimensions.
73+
* The region instance is then repeated every repeatx/repeaty (if specified).
74+
*
75+
* Within a particular region instance a block of block_type is laid down every
76+
* incrx/incry units (if not specified defaults to block width/height):
77+
*
78+
*
79+
* * = an instance of block_type within the region
80+
*
81+
* +------------------------------+
82+
* |* * * *|
83+
* | |
84+
* | |
85+
* | |
86+
* | |
87+
* | |
88+
* |* * * *|
89+
* ^ | |
90+
* | | |
91+
* incry | | |
92+
* | | |
93+
* v | |
94+
* |* * * *|
95+
* +------------------------------+
96+
*
97+
* <------->
98+
* incrx
99+
*
100+
* In the above diagram incrx = 10, and incry = 6
101+
*/
102+
struct t_grid_loc_def {
103+
t_grid_loc_def(std::string block_type_val, int priority_val)
104+
: block_type(std::move(block_type_val))
105+
, priority(priority_val)
106+
, x("0", "W-1", "max(w+1,W)", "w") //Fill in x direction, no repeat, incr by block width
107+
, y("0", "H-1", "max(h+1,H)", "h") //Fill in y direction, no repeat, incr by block height
108+
{}
109+
110+
std::string block_type; //The block type name
111+
112+
int priority = 0; //Priority of the specification.
113+
// In case of conflicting specifications
114+
// the largest priority wins.
115+
116+
t_grid_loc_spec x; //Horizontal location specification
117+
t_grid_loc_spec y; //Vertical location specification
118+
119+
// When 1 metadata tag is split among multiple t_grid_loc_def, one
120+
// t_grid_loc_def is arbitrarily chosen to own the metadata, and the other
121+
// t_grid_loc_def point to the owned version.
122+
std::unique_ptr<t_metadata_dict> owned_meta;
123+
t_metadata_dict* meta = nullptr; // Metadata for this location definition. This
124+
// metadata may be shared with multiple grid_locs
125+
// that come from a common definition.
126+
};
127+
128+
enum class GridDefType {
129+
AUTO,
130+
FIXED
131+
};

libs/libarchfpga/src/interposer_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <unordered_map>
1111
#include <vector>
1212
#include <string>
13-
#include "physical_types.h"
13+
#include "grid_types.h"
1414

1515
/**
1616
* @brief Enum for direction of an interposer cut. X means horizontal cut and Y means vertical cut.

libs/libarchfpga/src/physical_types.h

Lines changed: 1 addition & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include "vib_inf.h"
4949

5050
#include "scatter_gather_types.h"
51+
#include "interposer_types.h"
5152

5253
//Forward declarations
5354
struct t_clock_network;
@@ -249,117 +250,6 @@ typedef enum e_power_estimation_method_ t_power_estimation_method;
249250
/*************************************************************************************************/
250251
/* FPGA grid layout data types */
251252
/*************************************************************************************************/
252-
/* Grid location specification
253-
* Each member is a formula evaluated in terms of 'W' (device width),
254-
* and 'H' (device height). Formulas can be evaluated using parse_formula()
255-
* from expr_eval.h.
256-
*/
257-
struct t_grid_loc_spec {
258-
std::string start_expr; //Starting position (inclusive)
259-
std::string end_expr; //Ending position (inclusive)
260-
261-
std::string repeat_expr; //Distance between repeated
262-
// region instances
263-
264-
std::string incr_expr; //Distance between block instantiations
265-
// with the region
266-
};
267-
268-
/* Definition of how to place physical logic block in the grid.
269-
* This defines a region of the grid to be set to a specific type
270-
* (provided its priority is high enough to override other blocks).
271-
*
272-
* The diagram below illustrates the layout specification.
273-
*
274-
* +----+ +----+ +----+
275-
* | | | | | |
276-
* | | | | ... | |
277-
* | | | | | |
278-
* +----+ +----+ +----+
279-
*
280-
* . . .
281-
* . . .
282-
* . . .
283-
*
284-
* +----+ +----+ +----+
285-
* | | | | | |
286-
* | | | | ... | |
287-
* | | | | | |
288-
* +----+ +----+ +----+
289-
* ^
290-
* |
291-
* repeaty |
292-
* |
293-
* v (endx,endy)
294-
* +----+ +----+ +----+
295-
* | | | | | |
296-
* | | | | ... | |
297-
* | | | | | |
298-
* +----+ +----+ +----+
299-
* (startx,starty)
300-
* <-------------->
301-
* repeatx
302-
*
303-
* startx/endx and endx/endy define a rectangular region instances dimensions.
304-
* The region instance is then repeated every repeatx/repeaty (if specified).
305-
*
306-
* Within a particular region instance a block of block_type is laid down every
307-
* incrx/incry units (if not specified defaults to block width/height):
308-
*
309-
*
310-
* * = an instance of block_type within the region
311-
*
312-
* +------------------------------+
313-
* |* * * *|
314-
* | |
315-
* | |
316-
* | |
317-
* | |
318-
* | |
319-
* |* * * *|
320-
* ^ | |
321-
* | | |
322-
* incry | | |
323-
* | | |
324-
* v | |
325-
* |* * * *|
326-
* +------------------------------+
327-
*
328-
* <------->
329-
* incrx
330-
*
331-
* In the above diagram incrx = 10, and incry = 6
332-
*/
333-
struct t_grid_loc_def {
334-
t_grid_loc_def(std::string block_type_val, int priority_val)
335-
: block_type(std::move(block_type_val))
336-
, priority(priority_val)
337-
, x("0", "W-1", "max(w+1,W)", "w") //Fill in x direction, no repeat, incr by block width
338-
, y("0", "H-1", "max(h+1,H)", "h") //Fill in y direction, no repeat, incr by block height
339-
{}
340-
341-
std::string block_type; //The block type name
342-
343-
int priority = 0; //Priority of the specification.
344-
// In case of conflicting specifications
345-
// the largest priority wins.
346-
347-
t_grid_loc_spec x; //Horizontal location specification
348-
t_grid_loc_spec y; //Vertical location specification
349-
350-
// When 1 metadata tag is split among multiple t_grid_loc_def, one
351-
// t_grid_loc_def is arbitrarily chosen to own the metadata, and the other
352-
// t_grid_loc_def point to the owned version.
353-
std::unique_ptr<t_metadata_dict> owned_meta;
354-
t_metadata_dict* meta = nullptr; // Metadata for this location definition. This
355-
// metadata may be shared with multiple grid_locs
356-
// that come from a common definition.
357-
};
358-
359-
enum class GridDefType {
360-
AUTO,
361-
FIXED
362-
};
363253

364254
struct t_layer_def {
365255
std::vector<t_grid_loc_def> loc_defs; ///< List of block location definitions for this layer specification

0 commit comments

Comments
 (0)