summaryrefslogtreecommitdiff
path: root/passes
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-09-26 10:42:27 +0200
committerClifford Wolf <clifford@clifford.at>2015-09-26 10:42:27 +0200
commit281c1f4029eaff4215a81dbb9f0c2ce17da40706 (patch)
treebd1fd82748f227ac7dd496c27795ed053c209a63 /passes
parentddcfc99f8c23a2a7e9f41eeed5504e10215bee14 (diff)
Some cleanups in qwp
Diffstat (limited to 'passes')
-rw-r--r--passes/cmds/qwp.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/passes/cmds/qwp.cc b/passes/cmds/qwp.cc
index f76de326..784076c3 100644
--- a/passes/cmds/qwp.cc
+++ b/passes/cmds/qwp.cc
@@ -203,8 +203,8 @@ struct QwpWorker
void solve(bool alt_mode = false)
{
- // A := observation_matrix
- // y := observation_rhs_vector
+ // A := constraint_matrix
+ // y := constraint_rhs_vector
//
// AA = A' * A
// Ay = A' * y
@@ -215,6 +215,10 @@ struct QwpWorker
int N = GetSize(nodes), N1 = N+1;
vector<double> M(N * N1);
+ // Edge constraints:
+ // A[i,:] := [ 0 0 .... 0 weight 0 ... 0 -weight 0 ... 0 0], y[i] := 0
+ //
+ // i.e. nonzero columns in A[i,:] at the two node indices.
for (auto &edge : edges)
{
int idx1 = edge.first.first;
@@ -228,6 +232,14 @@ struct QwpWorker
M[idx2 + idx1*N1] += -weight * weight;
}
+ // Node constraints:
+ // A[i,:] := [ 0 0 .... 0 weight 0 ... 0 0], y[i] := weight * pos
+ //
+ // i.e. nonzero column in A[i,:] at the node index
+ //
+ // "tied" nodes have a large weight, pinning them in position. Untied
+ // nodes have a small weight, giving then a tiny preference to stay at
+ // the current position, making sure that AA never is singular.
for (int idx = 0; idx < GetSize(nodes); idx++)
{
auto &node = nodes[idx];
@@ -453,7 +465,7 @@ struct QwpWorker
config.dump_file << stringf("</svg>\n");
}
- void run_worker(int indent, bool return_after_solve = false)
+ void run_worker(int indent)
{
int count_cells = 0;
@@ -481,9 +493,6 @@ struct QwpWorker
solve();
solve(true);
- if (return_after_solve)
- return;
-
// detect median position and check for break condition
vector<pair<double, int>> sorted_pos;
@@ -769,7 +778,7 @@ struct QwpPass : public Pass {
log(" -dump <html_file_name>\n");
log(" Dump a protocol of the placement algorithm to the html file.\n");
log("\n");
- log("Note: This implementation of a quadratic wirelength placer uses unoptimized\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("\n");
}