Add constraint weight as a command line option
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
4a751d9aaf
commit
b937e6defe
@ -46,7 +46,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
class SAPlacer
|
class SAPlacer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SAPlacer(Context *ctx) : ctx(ctx)
|
SAPlacer(Context *ctx, Placer1Cfg cfg) : ctx(ctx), cfg(cfg)
|
||||||
{
|
{
|
||||||
int num_bel_types = 0;
|
int num_bel_types = 0;
|
||||||
for (auto bel : ctx->getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
@ -395,7 +395,7 @@ private:
|
|||||||
if (other != IdString())
|
if (other != IdString())
|
||||||
new_dist += get_constraints_distance(ctx, other_cell);
|
new_dist += get_constraints_distance(ctx, other_cell);
|
||||||
delta = new_metric - curr_metric;
|
delta = new_metric - curr_metric;
|
||||||
delta += (10 / temp) * (new_dist - old_dist);
|
delta += (cfg.constraintWeight / temp) * (new_dist - old_dist);
|
||||||
n_move++;
|
n_move++;
|
||||||
// SA acceptance criterea
|
// SA acceptance criterea
|
||||||
if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) {
|
if (delta < 0 || (temp > 1e-6 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) {
|
||||||
@ -458,12 +458,13 @@ private:
|
|||||||
const float legalise_temp = 1;
|
const float legalise_temp = 1;
|
||||||
const float post_legalise_temp = 10;
|
const float post_legalise_temp = 10;
|
||||||
const float post_legalise_dia_scale = 1.5;
|
const float post_legalise_dia_scale = 1.5;
|
||||||
|
Placer1Cfg cfg;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool placer1(Context *ctx)
|
bool placer1(Context *ctx, Placer1Cfg cfg)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
SAPlacer placer(ctx);
|
SAPlacer placer(ctx, cfg);
|
||||||
placer.place();
|
placer.place();
|
||||||
log_info("Checksum: 0x%08x\n", ctx->checksum());
|
log_info("Checksum: 0x%08x\n", ctx->checksum());
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -23,7 +23,12 @@
|
|||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
extern bool placer1(Context *ctx);
|
struct Placer1Cfg
|
||||||
|
{
|
||||||
|
float constraintWeight = 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern bool placer1(Context *ctx, Placer1Cfg cfg);
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ delay_t Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, de
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
bool Arch::place() { return placer1(getCtx()); }
|
bool Arch::place() { return placer1(getCtx(), Placer1Cfg()); }
|
||||||
|
|
||||||
bool Arch::route()
|
bool Arch::route()
|
||||||
{
|
{
|
||||||
|
@ -412,7 +412,7 @@ delay_t Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, de
|
|||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
bool Arch::place() { return placer1(getCtx()); }
|
bool Arch::place() { return placer1(getCtx()\, Placer1Cfg()); }
|
||||||
|
|
||||||
bool Arch::route() { return router1(getCtx(), Router1Cfg()); }
|
bool Arch::route() { return router1(getCtx(), Router1Cfg()); }
|
||||||
|
|
||||||
|
@ -659,7 +659,11 @@ delay_t Arch::getBudgetOverride(const NetInfo *net_info, const PortRef &sink, de
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
bool Arch::place() { return placer1(getCtx()); }
|
bool Arch::place() {
|
||||||
|
Placer1Cfg cfg;
|
||||||
|
cfg.constraintWeight = placer_constraintWeight;
|
||||||
|
return placer1(getCtx(), cfg);
|
||||||
|
}
|
||||||
|
|
||||||
bool Arch::route()
|
bool Arch::route()
|
||||||
{
|
{
|
||||||
|
@ -797,6 +797,9 @@ struct Arch : BaseCtx
|
|||||||
}
|
}
|
||||||
NPNR_ASSERT_FALSE("Expected PLL pin to share an output with an SB_IO D_IN_{0,1}");
|
NPNR_ASSERT_FALSE("Expected PLL pin to share an output with an SB_IO D_IN_{0,1}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float placer_constraintWeight = 10;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -106,6 +106,8 @@ int main(int argc, char *argv[])
|
|||||||
options.add_options()("seed", po::value<int>(), "seed value for random number generator");
|
options.add_options()("seed", po::value<int>(), "seed value for random number generator");
|
||||||
options.add_options()("slack_redist_iter", po::value<int>(),
|
options.add_options()("slack_redist_iter", po::value<int>(),
|
||||||
"number of iterations between slack redistribution");
|
"number of iterations between slack redistribution");
|
||||||
|
options.add_options()("cstrweight", po::value<float>(), "placer weighting for relative constraint satisfaction");
|
||||||
|
|
||||||
options.add_options()("version,V", "show version");
|
options.add_options()("version,V", "show version");
|
||||||
options.add_options()("tmfuzz", "run path delay estimate fuzzer");
|
options.add_options()("tmfuzz", "run path delay estimate fuzzer");
|
||||||
options.add_options()("test", "check architecture database integrity");
|
options.add_options()("test", "check architecture database integrity");
|
||||||
@ -318,6 +320,10 @@ int main(int argc, char *argv[])
|
|||||||
ctx->slack_redist_iter = vm["slack_redist_iter"].as<int>();
|
ctx->slack_redist_iter = vm["slack_redist_iter"].as<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vm.count("cstrweight")) {
|
||||||
|
ctx->placer_constraintWeight = vm["cstrweight"].as<float>();
|
||||||
|
}
|
||||||
|
|
||||||
if (vm.count("svg")) {
|
if (vm.count("svg")) {
|
||||||
std::cout << "<svg xmlns=\"http://www.w3.org/2000/svg\" "
|
std::cout << "<svg xmlns=\"http://www.w3.org/2000/svg\" "
|
||||||
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
|
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user