diff --git a/doc/src/api/libarchfpga/grid_types.rst b/doc/src/api/libarchfpga/grid_types.rst
new file mode 100644
index 00000000000..39cb5125605
--- /dev/null
+++ b/doc/src/api/libarchfpga/grid_types.rst
@@ -0,0 +1,14 @@
+========
+Grid Specification Types
+========
+
+These types are used to capture user's intended grid specification, i.e., which tiles go where in the device. These specifications will be later turned into a flattened device grid according to the device's size.
+
+.. doxygenstruct:: t_grid_loc_spec
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_grid_loc_def
+ :project: vpr
+ :members:
+
\ No newline at end of file
diff --git a/doc/src/api/libarchfpga/index.rst b/doc/src/api/libarchfpga/index.rst
new file mode 100644
index 00000000000..af2000bee41
--- /dev/null
+++ b/doc/src/api/libarchfpga/index.rst
@@ -0,0 +1,12 @@
+.. _libarchfpga:
+
+LIBARCHFPGA
+=======
+
+.. toctree::
+ :maxdepth: 1
+
+ physical_types
+ grid_types
+ scatter_gather_types
+ interposer_types
\ No newline at end of file
diff --git a/doc/src/api/libarchfpga/interposer_types.rst b/doc/src/api/libarchfpga/interposer_types.rst
new file mode 100644
index 00000000000..1e54a242c27
--- /dev/null
+++ b/doc/src/api/libarchfpga/interposer_types.rst
@@ -0,0 +1,13 @@
+========
+Interposer Types
+========
+
+These types are used to store information about interposer based architectures.
+
+.. doxygenstruct:: t_interposer_cut_inf
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_interdie_wire_inf
+ :project: vpr
+ :members:
\ No newline at end of file
diff --git a/doc/src/api/libarchfpga/physical_types.rst b/doc/src/api/libarchfpga/physical_types.rst
new file mode 100644
index 00000000000..1dcb6d15a80
--- /dev/null
+++ b/doc/src/api/libarchfpga/physical_types.rst
@@ -0,0 +1,33 @@
+========
+Physical Types
+========
+
+These types are used to capture user's intended architecture specification.
+
+.. doxygenstruct:: t_arch
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_arch_switch_inf
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_segment_inf
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_physical_tile_loc
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_sub_tile
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_layer_def
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_grid_def
+ :project: vpr
+ :members:
diff --git a/doc/src/api/libarchfpga/scatter_gather_types.rst b/doc/src/api/libarchfpga/scatter_gather_types.rst
new file mode 100644
index 00000000000..5b3be6d8bfc
--- /dev/null
+++ b/doc/src/api/libarchfpga/scatter_gather_types.rst
@@ -0,0 +1,17 @@
+========
+Scatter-Gather Types
+========
+
+These types store information about about scatter-gather routing patterns
+
+.. doxygenstruct:: t_scatter_gather_pattern
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_sg_link
+ :project: vpr
+ :members:
+
+.. doxygenstruct:: t_sg_location
+ :project: vpr
+ :members:
\ No newline at end of file
diff --git a/doc/src/arch/reference.rst b/doc/src/arch/reference.rst
index aa10a43c541..a374cbeb265 100644
--- a/doc/src/arch/reference.rst
+++ b/doc/src/arch/reference.rst
@@ -581,6 +581,32 @@ Grid Layout Example
Example FPGA grid
+
+.. arch:tag::
+
+ :req_param dim: Dimension or axis of the cut. 'X' or 'x' means a horizontal cut while 'Y' or 'y' means a vertical cut.
+ :req_param loc: Location of the cut. Cuts are done above or to the right of the tiles at coordinate 'loc'. For example a cut with dim=x and loc=0 would cut the vertical wires above tiles in the 0th row. Currently only integer values are supported.
+
+ .. note:: Interposers are experimental and are currently not supported by VPR and using the related tags will not actually result in any changes to the flow.
+ Defines an interposer cut for modelling 2.5D interposer-based architectures. An interposer cut will cut all connections at location 'loc' along the axis 'dim' Leaving the two sides completely unconnected.
+ To reconnect the two sides, this tag can have multiple tags as children to specify the connection between the two sides.
+
+.. arch:tag::
+
+ :req_param sg_name: Name of the scatter-gather pattern to be used for the interdie connection.
+ :req_param sg_link: Name of the scatter-gather link to be used for the interdie connection.
+ :req_param offset_start: Starting point of scatter-gather instantiations.
+ :req_param offset_end: Ending point of scatter-gather instantiations
+ :req_param offset_increment: Increment/distance between scatter-gather instantiations.
+ :req_param num: Number of scatter-gather instantiations per switchblock location.
+
+ Defines the interdie wiring between the two sides of the cut. Connectivity is defined using scatter-gather patterns. Starting at 'offset_start' from location of the cut and moving by 'offset_increment' until we reach the location of 'offset_end' away from the cut, 'num' scatter-gather patterns defined by 'sg_name' and 'sg_link' will be instantiated.
+ Note that these offset points always define the starting point of the scatter-gather pattern's sg_link. offset_start, offset_end and offset_increment can be integer values or expressions involving W and H (device width and height.)
+
+ .. figure:: scatter_gather_images/interposer_diagram.png
+
+ An example of how specifying interposers in VTR works. Connections between the two sides of a cut are first severed after which the two sides are reconnected using scatter_gather patterns. In this example the length of the sg_link wire used is 3. Note that there are 'num' of each pattern at each switchblock location.
+
.. _arch_device_info:
FPGA Device Information
diff --git a/doc/src/arch/scatter_gather_images/interposer_diagram.png b/doc/src/arch/scatter_gather_images/interposer_diagram.png
new file mode 100644
index 00000000000..be0b335985d
Binary files /dev/null and b/doc/src/arch/scatter_gather_images/interposer_diagram.png differ
diff --git a/doc/src/index.rst b/doc/src/index.rst
index 378e46af087..047c2237dee 100644
--- a/doc/src/index.rst
+++ b/doc/src/index.rst
@@ -64,6 +64,7 @@ For more specific documentation about VPR see :ref:`vpr`.
api/vtrutil/index
api/ezgl/index
api/vprinternals/index
+ api/libarchfpga/index
Indices and tables
==================
diff --git a/libs/libarchfpga/src/echo_arch.cpp b/libs/libarchfpga/src/echo_arch.cpp
index 70456a8a204..115616a0edb 100644
--- a/libs/libarchfpga/src/echo_arch.cpp
+++ b/libs/libarchfpga/src/echo_arch.cpp
@@ -101,10 +101,10 @@ void PrintArchInfo(FILE* Echo, const t_arch* arch) {
//Layout
fprintf(Echo, "*************************************************\n");
for (const auto& grid_layout : arch->grid_layouts) {
- if (grid_layout.grid_type == GridDefType::AUTO) {
+ if (grid_layout.grid_type == e_grid_def_type::AUTO) {
fprintf(Echo, "Layout: '%s' Type: auto Aspect_Ratio: %f\n", grid_layout.name.c_str(), grid_layout.aspect_ratio);
} else {
- VTR_ASSERT(grid_layout.grid_type == GridDefType::FIXED);
+ VTR_ASSERT(grid_layout.grid_type == e_grid_def_type::FIXED);
fprintf(Echo, "Layout: '%s' Type: fixed Width: %d Height %d\n", grid_layout.name.c_str(), grid_layout.width, grid_layout.height);
}
}
diff --git a/libs/libarchfpga/src/grid_types.h b/libs/libarchfpga/src/grid_types.h
new file mode 100644
index 00000000000..6c2afd769bc
--- /dev/null
+++ b/libs/libarchfpga/src/grid_types.h
@@ -0,0 +1,134 @@
+#pragma once
+
+/**
+ * @file grid_types.h
+ * @brief FPGA grid layout data types
+ */
+
+#include
+#include
+
+// Forward declerations
+
+struct t_metadata_dict;
+
+/**
+ * @brief Grid location specification
+ * Each member is a formula evaluated in terms of 'W' (device width),
+ * and 'H' (device height). Formulas can be evaluated using parse_formula()
+ * from expr_eval.h.
+ */
+struct t_grid_loc_spec {
+ std::string start_expr; ///
+ * repeatx
+ *
+ * startx/endx and endx/endy define a rectangular region instance's dimensions.
+ * The region instance is then repeated every repeatx/repeaty (if specified).
+ *
+ * Within a particular region instance a block of block_type is laid down every
+ * incrx/incry units (if not specified defaults to block width/height):
+ *
+ *
+ * * = an instance of block_type within the region
+ *
+ * +------------------------------+
+ * |* * * *|
+ * | |
+ * | |
+ * | |
+ * | |
+ * | |
+ * |* * * *|
+ * ^ | |
+ * | | |
+ * incry | | |
+ * | | |
+ * v | |
+ * |* * * *|
+ * +------------------------------+
+ *
+ * <------->
+ * incrx
+ *
+ * In the above diagram incrx = 10, and incry = 6
+ */
+struct t_grid_loc_def {
+ t_grid_loc_def(std::string block_type_val, int priority_val)
+ : block_type(std::move(block_type_val))
+ , priority(priority_val)
+ , x{"0", "W-1", "max(w+1,W)", "w"} // Fill in x direction, no repeat, incr by block width
+ , y{"0", "H-1", "max(h+1,H)", "h"} // Fill in y direction, no repeat, incr by block height
+ {}
+
+ std::string block_type; ///< The block type name
+
+ int priority = 0; ///< Priority of the specification. In case of conflicting specifications the largest priority wins.
+
+ t_grid_loc_spec x; ///< Horizontal location specification
+ t_grid_loc_spec y; ///< Vertical location specification
+
+ /**
+ * @brief When 1 metadata tag is split among multiple t_grid_loc_def, one
+ * t_grid_loc_def is arbitrarily chosen to own the metadata, and the other
+ * t_grid_loc_def point to the owned version.
+ *
+ */
+ std::unique_ptr owned_meta;
+
+ /**
+ * @brief Metadata for this location definition. This
+ * metadata may be shared with multiple grid_locs
+ * that come from a common definition.
+ */
+ t_metadata_dict* meta = nullptr;
+};
+
+/**
+ * @brief Enum for specfying if the architecture grid specification is for an auto sized device (variable size)
+ * or a fixed size device.
+ */
+enum class e_grid_def_type {
+ AUTO,
+ FIXED
+};
\ No newline at end of file
diff --git a/libs/libarchfpga/src/interposer_types.h b/libs/libarchfpga/src/interposer_types.h
new file mode 100644
index 00000000000..efdfa24be93
--- /dev/null
+++ b/libs/libarchfpga/src/interposer_types.h
@@ -0,0 +1,57 @@
+#pragma once
+
+/**
+ * @file interposer_types.h
+ * @brief This file contains types used for parsing interposer-related tags such as and
+ * and converting that information into the device architecture-related data structures.
+ *
+ */
+
+#include
+#include
+#include
+#include "grid_types.h"
+
+/**
+ * @brief Enum for direction of an interposer cut. X means horizontal cut and Y means vertical cut.
+ *
+ */
+enum class e_interposer_cut_dim {
+ X,
+ Y
+};
+
+// Lookup table for converting between a character and an e_interposer_cut_dim
+inline const std::unordered_map CHAR_INTERPOSER_DIM_MAP = {
+ {'X', e_interposer_cut_dim::X},
+ {'x', e_interposer_cut_dim::X},
+ {'Y', e_interposer_cut_dim::Y},
+ {'y', e_interposer_cut_dim::Y}};
+
+/**
+ * @brief Struct containing information of interdire wires i.e. connections between the dies on an interposer
+ *
+ */
+struct t_interdie_wire_inf {
+ std::string sg_name; ///< Name of the scatter-gather pattern to be used for the interdie connection
+ std::string sg_link; ///< Name of the scatter-gather link to be used for the interdie connection
+ /**
+ * @brief
+ * Contains starting and ending point (both inclusive) of scatter-gather instantiations and the increment/distance between the instantiations.
+ * offset_definition.repeat_expr is not relevant for interdie wires and is not set to anything or used.
+ *
+ * Locations defined by this offset definition define the starting point or the gathering point of the SG pattern. The end or scatter point of the SG pattern is defined by the sg_link.
+ */
+ t_grid_loc_spec offset_definition;
+ int num; ///< Number of scatter-gather instantiations per switchblock location
+};
+
+/**
+ * @brief Struct containing information of an interposer cut
+ *
+ */
+struct t_interposer_cut_inf {
+ e_interposer_cut_dim dim; ///< Dimension or axis of interposer cut.
+ int loc; ///< Location of the cut on the grid. Locations start from zero and cuts will happen above or to the right of the tiles at location=loc.
+ std::vector interdie_wires; ///< Connectivity specification between the two sides of the cut.
+};
diff --git a/libs/libarchfpga/src/physical_types.h b/libs/libarchfpga/src/physical_types.h
index 3418e7ba342..af0aba4a06d 100644
--- a/libs/libarchfpga/src/physical_types.h
+++ b/libs/libarchfpga/src/physical_types.h
@@ -48,6 +48,7 @@
#include "vib_inf.h"
#include "scatter_gather_types.h"
+#include "interposer_types.h"
//Forward declarations
struct t_clock_network;
@@ -80,6 +81,7 @@ class t_pb_graph_edge;
struct t_cluster_placement_primitive;
struct t_arch;
enum class e_sb_type;
+struct t_interposer_cut_inf;
/****************************************************************************/
/* FPGA metadata types */
@@ -248,130 +250,14 @@ typedef enum e_power_estimation_method_ t_power_estimation_method;
/*************************************************************************************************/
/* FPGA grid layout data types */
/*************************************************************************************************/
-/* Grid location specification
- * Each member is a formula evaluated in terms of 'W' (device width),
- * and 'H' (device height). Formulas can be evaluated using parse_formula()
- * from expr_eval.h.
- */
-struct t_grid_loc_spec {
- t_grid_loc_spec(std::string start, std::string end, std::string repeat, std::string incr)
- : start_expr(std::move(start))
- , end_expr(std::move(end))
- , repeat_expr(std::move(repeat))
- , incr_expr(std::move(incr)) {}
-
- std::string start_expr; //Starting position (inclusive)
- std::string end_expr; //Ending position (inclusive)
-
- std::string repeat_expr; //Distance between repeated
- // region instances
-
- std::string incr_expr; //Distance between block instantiations
- // with the region
-};
-
-/* Definition of how to place physical logic block in the grid.
- * This defines a region of the grid to be set to a specific type
- * (provided its priority is high enough to override other blocks).
- *
- * The diagram below illustrates the layout specification.
- *
- * +----+ +----+ +----+
- * | | | | | |
- * | | | | ... | |
- * | | | | | |
- * +----+ +----+ +----+
- *
- * . . .
- * . . .
- * . . .
- *
- * +----+ +----+ +----+
- * | | | | | |
- * | | | | ... | |
- * | | | | | |
- * +----+ +----+ +----+
- * ^
- * |
- * repeaty |
- * |
- * v (endx,endy)
- * +----+ +----+ +----+
- * | | | | | |
- * | | | | ... | |
- * | | | | | |
- * +----+ +----+ +----+
- * (startx,starty)
- * <-------------->
- * repeatx
- *
- * startx/endx and endx/endy define a rectangular region instances dimensions.
- * The region instance is then repeated every repeatx/repeaty (if specified).
- *
- * Within a particular region instance a block of block_type is laid down every
- * incrx/incry units (if not specified defaults to block width/height):
- *
- *
- * * = an instance of block_type within the region
- *
- * +------------------------------+
- * |* * * *|
- * | |
- * | |
- * | |
- * | |
- * | |
- * |* * * *|
- * ^ | |
- * | | |
- * incry | | |
- * | | |
- * v | |
- * |* * * *|
- * +------------------------------+
- *
- * <------->
- * incrx
- *
- * In the above diagram incrx = 10, and incry = 6
- */
-struct t_grid_loc_def {
- t_grid_loc_def(std::string block_type_val, int priority_val)
- : block_type(std::move(block_type_val))
- , priority(priority_val)
- , x("0", "W-1", "max(w+1,W)", "w") //Fill in x direction, no repeat, incr by block width
- , y("0", "H-1", "max(h+1,H)", "h") //Fill in y direction, no repeat, incr by block height
- {}
-
- std::string block_type; //The block type name
-
- int priority = 0; //Priority of the specification.
- // In case of conflicting specifications
- // the largest priority wins.
-
- t_grid_loc_spec x; //Horizontal location specification
- t_grid_loc_spec y; //Vertical location specification
-
- // When 1 metadata tag is split among multiple t_grid_loc_def, one
- // t_grid_loc_def is arbitrarily chosen to own the metadata, and the other
- // t_grid_loc_def point to the owned version.
- std::unique_ptr owned_meta;
- t_metadata_dict* meta = nullptr; // Metadata for this location definition. This
- // metadata may be shared with multiple grid_locs
- // that come from a common definition.
-};
-
-enum GridDefType {
- AUTO,
- FIXED
-};
struct t_layer_def {
- std::vector loc_defs; //The list of block location definitions for this layer specification
+ std::vector loc_defs; ///< List of block location definitions for this layer specification
+ std::vector interposer_cuts; ///< List of interposer cuts in this layer
};
struct t_grid_def {
- GridDefType grid_type = GridDefType::AUTO; //The type of this grid specification
+ e_grid_def_type grid_type = e_grid_def_type::AUTO; //The type of this grid specification
std::string name = ""; //The name of this device
diff --git a/libs/libarchfpga/src/read_fpga_interchange_arch.cpp b/libs/libarchfpga/src/read_fpga_interchange_arch.cpp
index d9ad5853570..6268ede1b01 100644
--- a/libs/libarchfpga/src/read_fpga_interchange_arch.cpp
+++ b/libs/libarchfpga/src/read_fpga_interchange_arch.cpp
@@ -2244,7 +2244,7 @@ struct ArchReader {
grid_def.width += 2;
grid_def.height += 2;
- grid_def.grid_type = GridDefType::FIXED;
+ grid_def.grid_type = e_grid_def_type::FIXED;
if (name == "auto") {
// At the moment, the interchange specifies fixed-layout only architectures,
diff --git a/libs/libarchfpga/src/read_xml_arch_file.cpp b/libs/libarchfpga/src/read_xml_arch_file.cpp
index 676c78d0d35..92cbb979b16 100644
--- a/libs/libarchfpga/src/read_xml_arch_file.cpp
+++ b/libs/libarchfpga/src/read_xml_arch_file.cpp
@@ -35,19 +35,19 @@
* the two files are swapped on command line.
*
*/
-
#include
#include