Skip to content

Vpr constraints parsing #1600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vpr/src/base/SetupVPR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void SetupVPR(const t_options* Options,
FileNameOpts->PowerFile = Options->PowerFile;
FileNameOpts->CmosTechFile = Options->CmosTechFile;
FileNameOpts->out_file_prefix = Options->out_file_prefix;
FileNameOpts->read_vpr_constraints_file = Options->read_vpr_constraints_file;

FileNameOpts->verify_file_digests = Options->verify_file_digests;

Expand Down
1 change: 1 addition & 0 deletions vpr/src/base/ShowSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void ShowSetup(const t_vpr_setup& vpr_setup) {
VTR_LOG("Circuit placement file: %s\n", vpr_setup.FileNameOpts.PlaceFile.c_str());
VTR_LOG("Circuit routing file: %s\n", vpr_setup.FileNameOpts.RouteFile.c_str());
VTR_LOG("Circuit SDC file: %s\n", vpr_setup.Timing.SDCFile.c_str());
VTR_LOG("Vpr Constraints file: %s\n", vpr_setup.FileNameOpts.read_vpr_constraints_file.c_str());
VTR_LOG("\n");

VTR_LOG("Packer: %s\n", (vpr_setup.PackerOpts.doPacking ? "ENABLED" : "DISABLED"));
Expand Down
106 changes: 106 additions & 0 deletions vpr/src/base/constraints_load.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#include "constraints_load.h"

void print_region(FILE* fp, Region region);
void print_partition(FILE* fp, Partition part);
void print_partition_region(FILE* fp, PartitionRegion pr);
void print_constraints(FILE* fp, VprConstraints constraints, int num_parts);

void print_region(FILE* fp, Region region) {
vtr::Rect<int> rect = region.get_region_rect();
int xmin = rect.xmin();
int xmax = rect.xmax();
int ymin = rect.ymin();
int ymax = rect.ymax();
int subtile = region.get_sub_tile();

fprintf(fp, "Region: \n");
fprintf(fp, "\txmin: %d\n", xmin);
fprintf(fp, "\txmax: %d\n", xmax);
fprintf(fp, "\tymin: %d\n", ymin);
fprintf(fp, "\tymax: %d\n", ymax);
fprintf(fp, "\tsubtile: %d\n\n", subtile);
}

void print_partition(FILE* fp, Partition part) {
std::string name = part.get_name();
fprintf(fp, "\tpartition_name: %s\n", name.c_str());

PartitionRegion pr = part.get_part_region();

print_partition_region(fp, pr);
}

void print_partition_region(FILE* fp, PartitionRegion pr) {
std::vector<Region> part_region = pr.get_partition_region();

int pr_size = part_region.size();

fprintf(fp, "\tpart_region size is: %d\n", pr_size);

for (unsigned int i = 0; i < part_region.size(); i++) {
print_region(fp, part_region[i]);
}
}

void print_constraints(FILE* fp, VprConstraints constraints, int num_parts) {
Partition temp_part;
std::vector<AtomBlockId> atoms;

for (int i = 0; i < num_parts; i++) {
PartitionId part_id(i);

temp_part = constraints.get_partition(part_id);

print_partition(fp, temp_part);

atoms = constraints.get_part_atoms(part_id);

int atoms_size = atoms.size();

fprintf(fp, "\tAtom vector size is %d\n", atoms_size);

for (unsigned int j = 0; j < atoms.size(); j++) {
AtomBlockId atom_id = atoms[j];
fprintf(fp, "\tAtom %d is in the partition\n", atom_id);
}
}
}

void echo_region(char* filename, Region region) {
FILE* fp;
fp = vtr::fopen(filename, "w");

fprintf(fp, "--------------------------------------------------------------\n");
fprintf(fp, "Region\n");
fprintf(fp, "--------------------------------------------------------------\n");
fprintf(fp, "\n");
print_region(fp, region);

fclose(fp);
}

void echo_partition(char* filename, Partition part) {
FILE* fp;
fp = vtr::fopen(filename, "w");

fprintf(fp, "--------------------------------------------------------------\n");
fprintf(fp, "Partition\n");
fprintf(fp, "--------------------------------------------------------------\n");
fprintf(fp, "\n");
print_partition(fp, part);

fclose(fp);
}

void echo_constraints(char* filename, VprConstraints constraints, int num_parts) {
FILE* fp;
fp = vtr::fopen(filename, "w");

fprintf(fp, "--------------------------------------------------------------\n");
fprintf(fp, "Constraints\n");
fprintf(fp, "--------------------------------------------------------------\n");
fprintf(fp, "\n");
print_constraints(fp, constraints, num_parts);

fclose(fp);
}
16 changes: 16 additions & 0 deletions vpr/src/base/constraints_load.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef CONSTRAINTS_LOAD_H_
#define CONSTRAINTS_LOAD_H_

#include "region.h"
#include "partition.h"
#include "partition_region.h"
#include "vpr_constraints.h"
#include "vtr_vector.h"

void echo_region(char* filename, Region region);

void echo_partition(char* filename, Partition part);

void echo_constraints(char* filename, VprConstraints constraints, int num_parts);

#endif
3 changes: 3 additions & 0 deletions vpr/src/base/echo_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ void alloc_and_load_echo_file_info() {
setEchoFileName(E_ECHO_ATOM_NETLIST_ORIG, "atom_netlist.orig.echo.blif");
setEchoFileName(E_ECHO_ATOM_NETLIST_CLEANED, "atom_netlist.cleaned.echo.blif");

//Vpr constraints
setEchoFileName(E_ECHO_VPR_CONSTRAINTS, "vpr_constraints.echo");

//Intra-block routing
setEchoFileName(E_ECHO_INTRA_LB_FAILED_ROUTE, "intra_lb_failed_route.echo");

Expand Down
1 change: 1 addition & 0 deletions vpr/src/base/echo_files.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum e_echo_files {
E_ECHO_PRE_PACKING_SLACK,
E_ECHO_PRE_PACKING_CRITICALITY,
E_ECHO_PRE_PACKING_MOLECULES_AND_PATTERNS,
E_ECHO_VPR_CONSTRAINTS,

// Intra-block routing
E_ECHO_INTRA_LB_FAILED_ROUTE,
Expand Down
3 changes: 3 additions & 0 deletions vpr/src/base/gen/README.gen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
`vpr_constraints_uxsdcxx.h`and
`vpr_constraints_uxsdcxx_interface.h` are generated via uxsdcxx and are checked in to
avoid requiring python3 and the uxsdcxx depedencies to build VPR.
Loading