From 48b3fe0dae463e9a0fd8ecd072490a9162d5581c Mon Sep 17 00:00:00 2001 From: AlexandreSinger Date: Fri, 14 Nov 2025 10:36:35 -0500 Subject: [PATCH] [LibArchFPGA] Moved CAD Types out of Lib The CAD types header file does not belong in libarchfpga since it was only really used in the prepacker of VPR. It makes several references to the pb_graph structure which I would ultimately like to move into VPR entirely. --- libs/libarchfpga/src/physical_types.h | 1 - vpr/src/analytical_place/model_grouper.cpp | 3 ++- vpr/src/pack/cluster_legalizer.cpp | 1 - vpr/src/pack/cluster_placement.h | 14 +++++++++++++ .../src/pack/pack_patterns.h | 21 +++++-------------- vpr/src/pack/prepack.h | 4 +++- 6 files changed, 24 insertions(+), 20 deletions(-) rename libs/libarchfpga/src/cad_types.h => vpr/src/pack/pack_patterns.h (92%) diff --git a/libs/libarchfpga/src/physical_types.h b/libs/libarchfpga/src/physical_types.h index 7c84f43f0dc..568a3c52b4b 100644 --- a/libs/libarchfpga/src/physical_types.h +++ b/libs/libarchfpga/src/physical_types.h @@ -77,7 +77,6 @@ struct t_pin_to_pin_annotation; struct t_interconnect; class t_pb_graph_pin; class t_pb_graph_edge; -struct t_cluster_placement_primitive; struct t_arch; enum class e_sb_type; struct t_interposer_cut_inf; diff --git a/vpr/src/analytical_place/model_grouper.cpp b/vpr/src/analytical_place/model_grouper.cpp index 1c74c7cdac3..06681c05f28 100644 --- a/vpr/src/analytical_place/model_grouper.cpp +++ b/vpr/src/analytical_place/model_grouper.cpp @@ -10,8 +10,9 @@ #include #include #include -#include "cad_types.h" #include "logic_types.h" +#include "pack_patterns.h" +#include "physical_types.h" #include "prepack.h" #include "vtr_assert.h" #include "vtr_log.h" diff --git a/vpr/src/pack/cluster_legalizer.cpp b/vpr/src/pack/cluster_legalizer.cpp index 065b7b7e7ef..1daf3791cca 100644 --- a/vpr/src/pack/cluster_legalizer.cpp +++ b/vpr/src/pack/cluster_legalizer.cpp @@ -17,7 +17,6 @@ #include #include "atom_lookup.h" #include "atom_netlist.h" -#include "cad_types.h" #include "cluster_placement.h" #include "cluster_router.h" #include "globals.h" diff --git a/vpr/src/pack/cluster_placement.h b/vpr/src/pack/cluster_placement.h index facb8b3c68e..c2b5ee1912e 100644 --- a/vpr/src/pack/cluster_placement.h +++ b/vpr/src/pack/cluster_placement.h @@ -12,6 +12,20 @@ // Forward declarations class AtomBlockId; +/** + * Keeps track of locations that a primitive can go to during packing + * Linked list for easy insertion/deletion + */ +struct t_cluster_placement_primitive { + t_cluster_placement_primitive() { + pb_graph_node = nullptr; + } + t_pb_graph_node* pb_graph_node; + bool valid; + float base_cost; /* cost independent of current status of packing */ + float incremental_cost; /* cost dependent on current status of packing */ +}; + /** * @brief Stats keeper for placement within the cluster during packing * diff --git a/libs/libarchfpga/src/cad_types.h b/vpr/src/pack/pack_patterns.h similarity index 92% rename from libs/libarchfpga/src/cad_types.h rename to vpr/src/pack/pack_patterns.h index 9b4610f029b..bb934e865f3 100644 --- a/libs/libarchfpga/src/cad_types.h +++ b/vpr/src/pack/pack_patterns.h @@ -1,10 +1,13 @@ #pragma once /* - * Data types used to give architectural hints for the CAD algorithm + * Data types used to give architectural hints for the CAD algorithm through pack + * patterns. */ -#include "physical_types.h" +#include +struct t_pb_type; +struct t_pb_graph_pin; struct t_pack_pattern_connections; /** @@ -112,17 +115,3 @@ struct t_pack_patterns { is_chain = false; } }; - -/** - * Keeps track of locations that a primitive can go to during packing - * Linked list for easy insertion/deletion - */ -struct t_cluster_placement_primitive { - t_cluster_placement_primitive() { - pb_graph_node = nullptr; - } - t_pb_graph_node* pb_graph_node; - bool valid; - float base_cost; /* cost independent of current status of packing */ - float incremental_cost; /* cost dependent on current status of packing */ -}; diff --git a/vpr/src/pack/prepack.h b/vpr/src/pack/prepack.h index 7210d02d7ad..c17e7dae613 100644 --- a/vpr/src/pack/prepack.h +++ b/vpr/src/pack/prepack.h @@ -9,8 +9,9 @@ */ #include +#include #include "atom_netlist_fwd.h" -#include "cad_types.h" +#include "pack_patterns.h" #include "vtr_assert.h" #include "vtr_range.h" #include "vtr_strong_id.h" @@ -21,6 +22,7 @@ class t_pack_molecule; class LogicalModels; struct t_logical_block_type; +struct t_pb_graph_node; // A unique ID used to identify a molecule generated by the prepacker. typedef vtr::StrongId PackMoleculeId;