Allow selection of router algorithm
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
25f57a1e38
commit
7123209324
@ -132,6 +132,12 @@ po::options_description CommandHandler::getGeneralOptions()
|
||||
"; default: " + Arch::defaultPlacer)
|
||||
.c_str());
|
||||
|
||||
general.add_options()(
|
||||
"router", po::value<std::string>(),
|
||||
std::string("router algorithm to use; available: " + boost::algorithm::join(Arch::availableRouters, ", ") +
|
||||
"; default: " + Arch::defaultPlacer)
|
||||
.c_str());
|
||||
|
||||
general.add_options()("slack_redist_iter", po::value<int>(), "number of iterations between slack redistribution");
|
||||
general.add_options()("cstrweight", po::value<float>(), "placer weighting for relative constraint satisfaction");
|
||||
general.add_options()("starttemp", po::value<float>(), "placer SA start temperature");
|
||||
@ -214,6 +220,15 @@ void CommandHandler::setupContext(Context *ctx)
|
||||
ctx->settings[ctx->id("placer")] = placer;
|
||||
}
|
||||
|
||||
if (vm.count("router")) {
|
||||
std::string router = vm["router"].as<std::string>();
|
||||
if (std::find(Arch::availableRouters.begin(), Arch::availableRouters.end(), router) ==
|
||||
Arch::availableRouters.end())
|
||||
log_error("Router algorithm '%s' is not supported (available options: %s)\n", router.c_str(),
|
||||
boost::algorithm::join(Arch::availableRouters, ", ").c_str());
|
||||
ctx->settings[ctx->id("router")] = router;
|
||||
}
|
||||
|
||||
if (vm.count("cstrweight")) {
|
||||
ctx->settings[ctx->id("placer1/constraintWeight")] = std::to_string(vm["cstrweight"].as<float>());
|
||||
}
|
||||
@ -244,6 +259,8 @@ void CommandHandler::setupContext(Context *ctx)
|
||||
ctx->settings[ctx->id("auto_freq")] = false;
|
||||
if (ctx->settings.find(ctx->id("placer")) == ctx->settings.end())
|
||||
ctx->settings[ctx->id("placer")] = Arch::defaultPlacer;
|
||||
if (ctx->settings.find(ctx->id("router")) == ctx->settings.end())
|
||||
ctx->settings[ctx->id("router")] = Arch::defaultRouter;
|
||||
|
||||
ctx->settings[ctx->id("arch.name")] = std::string(ctx->archId().c_str(ctx));
|
||||
ctx->settings[ctx->id("arch.type")] = std::string(ctx->archArgsToId(ctx->archArgs()).c_str(ctx));
|
||||
|
@ -508,3 +508,13 @@ Name of the default placement algorithm for the architecture, if
|
||||
|
||||
Name of available placer algorithms for the architecture, used
|
||||
to provide help for and validate `--placer`.
|
||||
|
||||
### static const std::string defaultRouter
|
||||
|
||||
Name of the default router algorithm for the architecture, if
|
||||
`--router` isn't specified on the command line.
|
||||
|
||||
### static const std::vector\<std::string\> availableRouters
|
||||
|
||||
Name of available router algorithms for the architecture, used
|
||||
to provide help for and validate `--router`.
|
16
ecp5/arch.cc
16
ecp5/arch.cc
@ -621,12 +621,23 @@ bool Arch::place()
|
||||
|
||||
bool Arch::route()
|
||||
{
|
||||
std::string router = str_or_default(settings, id("router"), defaultRouter);
|
||||
|
||||
setupWireLocations();
|
||||
route_ecp5_globals(getCtx());
|
||||
assignArchInfo();
|
||||
assign_budget(getCtx(), true);
|
||||
|
||||
bool result;
|
||||
if (router == "router1") {
|
||||
result = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
} else if (router == "router2") {
|
||||
router2(getCtx(), Router2Cfg(getCtx()));
|
||||
bool result = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
result = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
} else {
|
||||
log_error("ECP5 architecture does not support router '%s'\n", router.c_str());
|
||||
}
|
||||
|
||||
#if 0
|
||||
std::vector<std::pair<WireId, int>> fanout_vector;
|
||||
std::copy(wire_fanout.begin(), wire_fanout.end(), std::back_inserter(fanout_vector));
|
||||
@ -1173,6 +1184,9 @@ const std::vector<std::string> Arch::availablePlacers = {"sa",
|
||||
#endif
|
||||
};
|
||||
|
||||
const std::string Arch::defaultRouter = "router1";
|
||||
const std::vector<std::string> Arch::availableRouters = {"router1", "router2"};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
GroupId Arch::getGroupByName(IdString name) const
|
||||
|
@ -1066,6 +1066,8 @@ struct Arch : BaseCtx
|
||||
|
||||
static const std::string defaultPlacer;
|
||||
static const std::vector<std::string> availablePlacers;
|
||||
static const std::string defaultRouter;
|
||||
static const std::vector<std::string> availableRouters;
|
||||
};
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "placer1.h"
|
||||
#include "placer_heap.h"
|
||||
#include "router1.h"
|
||||
#include "router2.h"
|
||||
#include "util.h"
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
@ -553,10 +554,19 @@ bool Arch::place()
|
||||
|
||||
bool Arch::route()
|
||||
{
|
||||
bool retVal = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
std::string router = str_or_default(settings, id("router"), defaultRouter);
|
||||
bool result;
|
||||
if (router == "router1") {
|
||||
result = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
} else if (router == "router2") {
|
||||
router2(getCtx(), Router2Cfg(getCtx()));
|
||||
result = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
} else {
|
||||
log_error("iCE40 architecture does not support router '%s'\n", router.c_str());
|
||||
}
|
||||
getCtx()->settings[getCtx()->id("route")] = 1;
|
||||
archInfoToAttributes();
|
||||
return retVal;
|
||||
return result;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
@ -653,6 +663,10 @@ const std::vector<std::string> Arch::availablePlacers = {"sa",
|
||||
"heap"
|
||||
#endif
|
||||
};
|
||||
|
||||
const std::string Arch::defaultRouter = "router1";
|
||||
const std::vector<std::string> Arch::availableRouters = {"router1", "router2"};
|
||||
|
||||
void Arch::assignArchInfo()
|
||||
{
|
||||
for (auto &cell : getCtx()->cells) {
|
||||
|
@ -288,6 +288,8 @@ struct Arch : BaseCtx
|
||||
|
||||
static const std::string defaultPlacer;
|
||||
static const std::vector<std::string> availablePlacers;
|
||||
static const std::string defaultRouter;
|
||||
static const std::vector<std::string> availableRouters;
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Internal usage
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "placer1.h"
|
||||
#include "placer_heap.h"
|
||||
#include "router1.h"
|
||||
#include "router2.h"
|
||||
#include "timing_opt.h"
|
||||
#include "util.h"
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
@ -696,10 +697,19 @@ bool Arch::place()
|
||||
|
||||
bool Arch::route()
|
||||
{
|
||||
bool retVal = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
std::string router = str_or_default(settings, id("router"), defaultRouter);
|
||||
bool result;
|
||||
if (router == "router1") {
|
||||
result = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
} else if (router == "router2") {
|
||||
router2(getCtx(), Router2Cfg(getCtx()));
|
||||
result = router1(getCtx(), Router1Cfg(getCtx()));
|
||||
} else {
|
||||
log_error("iCE40 architecture does not support router '%s'\n", router.c_str());
|
||||
}
|
||||
getCtx()->settings[getCtx()->id("route")] = 1;
|
||||
archInfoToAttributes();
|
||||
return retVal;
|
||||
return result;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -1257,4 +1267,7 @@ const std::vector<std::string> Arch::availablePlacers = {"sa",
|
||||
#endif
|
||||
};
|
||||
|
||||
const std::string Arch::defaultRouter = "router1";
|
||||
const std::vector<std::string> Arch::availableRouters = {"router1", "router2"};
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
@ -900,6 +900,8 @@ struct Arch : BaseCtx
|
||||
|
||||
static const std::string defaultPlacer;
|
||||
static const std::vector<std::string> availablePlacers;
|
||||
static const std::string defaultRouter;
|
||||
static const std::vector<std::string> availableRouters;
|
||||
};
|
||||
|
||||
void ice40DelayFuzzerMain(Context *ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user