mirror of https://github.com/YosysHQ/yosys.git
This commit is contained in:
commit
fb87022dca
|
@ -40,6 +40,7 @@ struct QwpConfig
|
||||||
{
|
{
|
||||||
bool ltr;
|
bool ltr;
|
||||||
bool alpha;
|
bool alpha;
|
||||||
|
bool verbose;
|
||||||
double grid;
|
double grid;
|
||||||
|
|
||||||
std::ofstream dump_file;
|
std::ofstream dump_file;
|
||||||
|
@ -47,6 +48,7 @@ struct QwpConfig
|
||||||
QwpConfig() {
|
QwpConfig() {
|
||||||
ltr = false;
|
ltr = false;
|
||||||
alpha = false;
|
alpha = false;
|
||||||
|
verbose = false;
|
||||||
grid = 1.0 / 16;
|
grid = 1.0 / 16;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -211,10 +213,16 @@ struct QwpWorker
|
||||||
//
|
//
|
||||||
// M := [AA Ay]
|
// M := [AA Ay]
|
||||||
|
|
||||||
|
if (config.verbose)
|
||||||
|
log("> System size: %d^2\n", GetSize(nodes));
|
||||||
|
|
||||||
// Row major order
|
// Row major order
|
||||||
int N = GetSize(nodes), N1 = N+1;
|
int N = GetSize(nodes), N1 = N+1;
|
||||||
vector<double> M(N * N1);
|
vector<double> M(N * N1);
|
||||||
|
|
||||||
|
if (config.verbose)
|
||||||
|
log("> Edge constraints: %d\n", GetSize(edges));
|
||||||
|
|
||||||
// Edge constraints:
|
// Edge constraints:
|
||||||
// A[i,:] := [ 0 0 .... 0 weight 0 ... 0 -weight 0 ... 0 0], y[i] := 0
|
// A[i,:] := [ 0 0 .... 0 weight 0 ... 0 -weight 0 ... 0 0], y[i] := 0
|
||||||
//
|
//
|
||||||
|
@ -232,6 +240,9 @@ struct QwpWorker
|
||||||
M[idx2 + idx1*N1] += -weight * weight;
|
M[idx2 + idx1*N1] += -weight * weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.verbose)
|
||||||
|
log("> Node constraints: %d\n", GetSize(nodes));
|
||||||
|
|
||||||
// Node constraints:
|
// Node constraints:
|
||||||
// A[i,:] := [ 0 0 .... 0 weight 0 ... 0 0], y[i] := weight * pos
|
// A[i,:] := [ 0 0 .... 0 weight 0 ... 0 0], y[i] := weight * pos
|
||||||
//
|
//
|
||||||
|
@ -263,6 +274,9 @@ struct QwpWorker
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (config.verbose)
|
||||||
|
log("> Solving\n");
|
||||||
|
|
||||||
// Solve "AA*x = Ay"
|
// Solve "AA*x = Ay"
|
||||||
// (least squares fit for "A*x = y")
|
// (least squares fit for "A*x = y")
|
||||||
//
|
//
|
||||||
|
@ -277,6 +291,9 @@ struct QwpWorker
|
||||||
// gaussian elimination
|
// gaussian elimination
|
||||||
for (int i = 0; i < N; i++)
|
for (int i = 0; i < N; i++)
|
||||||
{
|
{
|
||||||
|
if (config.verbose && ((i+1) % (N/15)) == 0)
|
||||||
|
log("> Solved %d%%: %d/%d\n", (100*(i+1))/N, i+1, N);
|
||||||
|
|
||||||
// find best row
|
// find best row
|
||||||
int best_row = queue.front();
|
int best_row = queue.front();
|
||||||
int best_row_queue_idx = 0;
|
int best_row_queue_idx = 0;
|
||||||
|
@ -312,6 +329,9 @@ struct QwpWorker
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.verbose)
|
||||||
|
log("> Solved\n");
|
||||||
|
|
||||||
log_assert(queue.empty());
|
log_assert(queue.empty());
|
||||||
log_assert(GetSize(pivot_cache) == N);
|
log_assert(GetSize(pivot_cache) == N);
|
||||||
|
|
||||||
|
@ -334,6 +354,9 @@ struct QwpWorker
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (config.verbose)
|
||||||
|
log("> Update nodes\n");
|
||||||
|
|
||||||
// update node positions
|
// update node positions
|
||||||
for (int i = 0; i < N; i++)
|
for (int i = 0; i < N; i++)
|
||||||
{
|
{
|
||||||
|
@ -778,6 +801,9 @@ struct QwpPass : public Pass {
|
||||||
log(" -dump <html_file_name>\n");
|
log(" -dump <html_file_name>\n");
|
||||||
log(" Dump a protocol of the placement algorithm to the html file.\n");
|
log(" Dump a protocol of the placement algorithm to the html file.\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" -v\n");
|
||||||
|
log(" Verbose solver output for profiling or debugging\n");
|
||||||
|
log("\n");
|
||||||
log("Note: This implementation of a quadratic wirelength placer uses exact\n");
|
log("Note: This implementation of a quadratic wirelength placer uses exact\n");
|
||||||
log("dense matrix operations. It is only a toy-placer for small circuits.\n");
|
log("dense matrix operations. It is only a toy-placer for small circuits.\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
@ -799,6 +825,10 @@ struct QwpPass : public Pass {
|
||||||
config.alpha = true;
|
config.alpha = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (args[argidx] == "-v") {
|
||||||
|
config.verbose = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (args[argidx] == "-grid" && argidx+1 < args.size()) {
|
if (args[argidx] == "-grid" && argidx+1 < args.size()) {
|
||||||
config.grid = 1.0 / atoi(args[++argidx].c_str());
|
config.grid = 1.0 / atoi(args[++argidx].c_str());
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue