Add design_loaded state variable.

This is to decouple the command line flag "--json" and enable other
frontend's.

Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
This commit is contained in:
Keith Rothman 2021-02-11 13:41:13 -08:00
parent e376f950fe
commit 96293ab25e
3 changed files with 8 additions and 1 deletions

View File

@ -331,7 +331,7 @@ int CommandHandler::executeMain(std::unique_ptr<Context> ctx)
execute_python_file(filename.c_str()); execute_python_file(filename.c_str());
} else } else
#endif #endif
if (vm.count("json")) { if (ctx->design_loaded) {
bool do_pack = vm.count("pack-only") != 0 || vm.count("no-pack") == 0; bool do_pack = vm.count("pack-only") != 0 || vm.count("no-pack") == 0;
bool do_place = vm.count("pack-only") == 0 && vm.count("no-place") == 0; bool do_place = vm.count("pack-only") == 0 && vm.count("no-place") == 0;
bool do_route = vm.count("pack-only") == 0 && vm.count("no-route") == 0; bool do_route = vm.count("pack-only") == 0 && vm.count("no-route") == 0;

View File

@ -842,6 +842,9 @@ struct BaseCtx
Context *as_ctx = nullptr; Context *as_ctx = nullptr;
// Has the frontend loaded a design?
bool design_loaded;
BaseCtx() BaseCtx()
{ {
idstring_str_to_idx = new std::unordered_map<std::string, int>; idstring_str_to_idx = new std::unordered_map<std::string, int>;
@ -853,6 +856,8 @@ struct BaseCtx
wildcard.id.index = 0; wildcard.id.index = 0;
wildcard.type = TimingConstraintObject::ANYTHING; wildcard.type = TimingConstraintObject::ANYTHING;
constraintObjects.push_back(wildcard); constraintObjects.push_back(wildcard);
design_loaded = false;
} }
virtual ~BaseCtx() virtual ~BaseCtx()

View File

@ -135,6 +135,8 @@ template <typename FrontendType> struct GenericFrontend
ctx->top_module = top; ctx->top_module = top;
// Do the actual import, starting from the top level module // Do the actual import, starting from the top level module
import_module(m, top.str(ctx), top.str(ctx), mod_refs.at(top)); import_module(m, top.str(ctx), top.str(ctx), mod_refs.at(top));
ctx->design_loaded = true;
} }
Context *ctx; Context *ctx;