|
| 1 | +#include "globals.h" |
| 2 | +#include "load_flat_place.h" |
| 3 | +#include "clustered_netlist_utils.h" |
| 4 | + |
| 5 | + |
| 6 | +/* @brief Prints flat placement file entries for the atoms in one placed cluster. */ |
| 7 | +static void print_flat_cluster(FILE* fp, ClusterBlockId iblk, |
| 8 | + std::vector<AtomBlockId>& atoms); |
| 9 | + |
| 10 | +static void print_flat_cluster(FILE* fp, ClusterBlockId iblk, |
| 11 | + std::vector<AtomBlockId>& atoms) { |
| 12 | + |
| 13 | + auto& atom_ctx = g_vpr_ctx.atom(); |
| 14 | + t_pl_loc loc = g_vpr_ctx.placement().block_locs[iblk].loc; |
| 15 | + size_t bnum = size_t(iblk); |
| 16 | + |
| 17 | + for (auto atom : atoms) { |
| 18 | + t_pb_graph_node* atom_pbgn = atom_ctx.lookup.atom_pb(atom)->pb_graph_node; |
| 19 | + fprintf(fp, "%s %d %d %d %d #%zu %s\n", atom_ctx.nlist.block_name(atom).c_str(), |
| 20 | + loc.x, loc.y, loc.sub_tile, |
| 21 | + atom_pbgn->flat_site_index, |
| 22 | + bnum, |
| 23 | + atom_pbgn->pb_type->name); |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +/* prints a flat placement file */ |
| 28 | +void print_flat_placement(const char* flat_place_file) { |
| 29 | + |
| 30 | + FILE* fp; |
| 31 | + |
| 32 | + ClusterAtomsLookup atoms_lookup; |
| 33 | + auto& cluster_ctx = g_vpr_ctx.clustering(); |
| 34 | + |
| 35 | + if (!g_vpr_ctx.placement().block_locs.empty()) { |
| 36 | + fp = fopen(flat_place_file, "w"); |
| 37 | + for (auto iblk : cluster_ctx.clb_nlist.blocks()) { |
| 38 | + auto atoms = atoms_lookup.atoms_in_cluster(iblk); |
| 39 | + print_flat_cluster(fp, iblk, atoms); |
| 40 | + } |
| 41 | + fclose(fp); |
| 42 | + } |
| 43 | + |
| 44 | +} |
| 45 | + |
| 46 | +/* ingests and legalizes a flat placement file */ |
| 47 | +bool load_flat_placement(t_vpr_setup& vpr_setup, const t_arch& arch) { |
| 48 | + VTR_LOG("load_flat_placement(); when implemented, this function:"); |
| 49 | + VTR_LOG("\n\tLoads flat placement file: %s, ", vpr_setup.FileNameOpts.FlatPlaceFile.c_str()); |
| 50 | + VTR_LOG("\n\tArch id: %s, ", arch.architecture_id); |
| 51 | + VTR_LOG("\n\tPrints clustered netlist file: %s, ", vpr_setup.FileNameOpts.NetFile.c_str()); |
| 52 | + VTR_LOG("\n\tPrints fix clusters file: %s\n", vpr_setup.FileNameOpts.write_constraints_file.c_str()); |
| 53 | + |
| 54 | + return false; |
| 55 | +} |
0 commit comments