diff options
Diffstat (limited to 'ice40')
-rw-r--r-- | ice40/delay.cc | 2 | ||||
-rw-r--r-- | ice40/main.cc | 5 | ||||
-rw-r--r-- | ice40/pcf.cc | 3 | ||||
-rw-r--r-- | ice40/pcf.h | 2 | ||||
-rw-r--r-- | ice40/project.cc | 10 |
5 files changed, 13 insertions, 9 deletions
diff --git a/ice40/delay.cc b/ice40/delay.cc index dd2a4969..d76aaefb 100644 --- a/ice40/delay.cc +++ b/ice40/delay.cc @@ -121,7 +121,7 @@ struct model_params_t int delta_sp4; int delta_sp12; - static const model_params_t &get(ArchArgs args) + static const model_params_t &get(const ArchArgs& args) { static const model_params_t model_hx8k = {588, 129253, 8658, 118333, 23915, -73105, 57696, -86797, 89, 3706, -316, -575, -158, -296}; diff --git a/ice40/main.cc b/ice40/main.cc index 2818a3ad..8bab360d 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -79,8 +79,9 @@ void Ice40CommandHandler::validate() void Ice40CommandHandler::customAfterLoad(Context *ctx) { if (vm.count("pcf")) { - std::ifstream pcf(vm["pcf"].as<std::string>()); - if (!apply_pcf(ctx, pcf)) + std::string filename = vm["pcf"].as<std::string>(); + std::ifstream pcf(filename); + if (!apply_pcf(ctx, filename, pcf)) log_error("Loading PCF failed.\n"); } } diff --git a/ice40/pcf.cc b/ice40/pcf.cc index 410fa1c9..d9fc4e68 100644 --- a/ice40/pcf.cc +++ b/ice40/pcf.cc @@ -27,7 +27,7 @@ NEXTPNR_NAMESPACE_BEGIN // Read a w // Apply PCF constraints to a pre-packing design -bool apply_pcf(Context *ctx, std::istream &in) +bool apply_pcf(Context *ctx, std::string filename, std::istream &in) { try { if (!in) @@ -66,6 +66,7 @@ bool apply_pcf(Context *ctx, std::istream &in) log_error("unsupported pcf command '%s'\n", cmd.c_str()); } } + ctx->settings.emplace(ctx->id("project/input/pcf"), filename); return true; } catch (log_execution_error_exception) { return false; diff --git a/ice40/pcf.h b/ice40/pcf.h index 315f6270..ecc81e59 100644 --- a/ice40/pcf.h +++ b/ice40/pcf.h @@ -27,7 +27,7 @@ NEXTPNR_NAMESPACE_BEGIN // Apply PCF constraints to a pre-packing design -bool apply_pcf(Context *ctx, std::istream &in); +bool apply_pcf(Context *ctx, std::string filename, std::istream &in); NEXTPNR_NAMESPACE_END diff --git a/ice40/project.cc b/ice40/project.cc index d1f1674a..8ca10e36 100644 --- a/ice40/project.cc +++ b/ice40/project.cc @@ -25,11 +25,13 @@ NEXTPNR_NAMESPACE_BEGIN -void ProjectHandler::saveArch(Context *ctx, pt::ptree &root) +void ProjectHandler::saveArch(Context *ctx, pt::ptree &root, std::string path) { root.put("project.arch.package", ctx->archArgs().package); - // if(!pcfFilename.empty()) - // root.put("project.input.pcf", pcfFilename); + if (ctx->settings.find(ctx->id("project/input/pcf")) != ctx->settings.end()) { + std::string fn = ctx->settings[ctx->id("project/input/pcf")]; + root.put("project.input.pcf", make_relative(fn, path).string()); + } } std::unique_ptr<Context> ProjectHandler::createContext(pt::ptree &root) @@ -64,7 +66,7 @@ void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) auto input = root.get_child("project").get_child("input"); boost::filesystem::path pcf = boost::filesystem::path(path) / input.get<std::string>("pcf"); std::ifstream f(pcf.string()); - if (!apply_pcf(ctx, f)) + if (!apply_pcf(ctx, input.get<std::string>("pcf"), f)) log_error("Loading PCF failed.\n"); } |