|
21 | 21 | #include "vtr_assert.h"
|
22 | 22 | #include "vtr_log.h"
|
23 | 23 | #include "vtr_vector_map.h"
|
| 24 | +#include "vtr_version.h" |
| 25 | + |
| 26 | +/** |
| 27 | + * @brief Prints the header for the flat placement file. This includes helpful |
| 28 | + * information on how to read the file and when it was generated. |
| 29 | + * |
| 30 | + * @param fp |
| 31 | + * File pointer to the file the cluster is printed to. |
| 32 | + */ |
| 33 | +static void print_flat_placement_file_header(FILE* fp) { |
| 34 | + fprintf(fp, "# Flat Placement File\n"); |
| 35 | + fprintf(fp, "# Auto-generated by VPR %s\n", |
| 36 | + vtr::VERSION); |
| 37 | + fprintf(fp, "# Created: %s\n", |
| 38 | + vtr::BUILD_TIMESTAMP); |
| 39 | + fprintf(fp, "#\n"); |
| 40 | + fprintf(fp, "# This file prints the following information for each atom in the netlist:\n"); |
| 41 | + fprintf(fp, "# <atom_name> <x> <y> <layer> <atom_sub_tile> <atom_site_idx> #<clb_blk_id> <atom_pb_type>\n"); |
| 42 | + fprintf(fp, "\n"); |
| 43 | +} |
24 | 44 |
|
25 | 45 | /**
|
26 | 46 | * @brief Prints flat placement file entries for the atoms in one placed
|
@@ -76,6 +96,9 @@ void write_flat_placement(const char* flat_place_file_path,
|
76 | 96 | // Create a file in write mode for the flat placement.
|
77 | 97 | FILE* fp = fopen(flat_place_file_path, "w");
|
78 | 98 |
|
| 99 | + // Add a header to the flat placement file. |
| 100 | + print_flat_placement_file_header(fp); |
| 101 | + |
79 | 102 | // For each cluster, write out the atoms in the cluster at this cluster's
|
80 | 103 | // location.
|
81 | 104 | for (ClusterBlockId iblk : cluster_netlist.blocks()) {
|
@@ -181,7 +204,7 @@ void log_flat_placement_reconstruction_info(
|
181 | 204 | const FlatPlacementInfo& flat_placement_info,
|
182 | 205 | const vtr::vector_map<ClusterBlockId, t_block_loc>& block_locs,
|
183 | 206 | const vtr::vector<ClusterBlockId, std::unordered_set<AtomBlockId>>& atoms_lookup,
|
184 |
| - const AtomLookup& lookup, |
| 207 | + const AtomLookup& cluster_of_atom_lookup, |
185 | 208 | const AtomNetlist& atom_netlist,
|
186 | 209 | const ClusteredNetlist& clustered_netlist) {
|
187 | 210 | // Go through each cluster and see how many clusters have atoms that
|
@@ -217,6 +240,8 @@ void log_flat_placement_reconstruction_info(
|
217 | 240 | // If the atom's flat placement more than half a block in any
|
218 | 241 | // direction from the flat placement centroid, then it does not
|
219 | 242 | // want to be in this cluster.
|
| 243 | + // FIXME: This should take into account large blocks somehow, just |
| 244 | + // being 0.5 tiles away may not be sufficient. |
220 | 245 | if (std::abs(centroid_x - flat_placement_info.blk_x_pos[atom_blk_id]) > 0.5f ||
|
221 | 246 | std::abs(centroid_y - flat_placement_info.blk_y_pos[atom_blk_id]) > 0.5f ||
|
222 | 247 | std::abs(centroid_layer - flat_placement_info.blk_layer[atom_blk_id]) > 0.5f ||
|
@@ -245,10 +270,12 @@ void log_flat_placement_reconstruction_info(
|
245 | 270 | int blk_layer = flat_placement_info.blk_layer[atom_blk_id];
|
246 | 271 |
|
247 | 272 | // Get the (x, y, layer) position of the cluster that contains this block.
|
248 |
| - ClusterBlockId atom_clb_id = lookup.atom_clb(atom_blk_id); |
| 273 | + ClusterBlockId atom_clb_id = cluster_of_atom_lookup.atom_clb(atom_blk_id); |
249 | 274 | const t_block_loc& clb_loc = block_locs[atom_clb_id];
|
250 | 275 |
|
251 | 276 | // Compute the distance between these two positions.
|
| 277 | + // FIXME: This will overreport large blocks. This should really be |
| 278 | + // the distance outside of the tile you want to be placed in. |
252 | 279 | float dx = blk_x - clb_loc.loc.x;
|
253 | 280 | float dy = blk_y - clb_loc.loc.y;
|
254 | 281 | float dlayer = blk_layer - clb_loc.loc.layer;
|
|
0 commit comments