diff options
author | David Shah <dave@ds0.me> | 2020-10-15 12:10:02 +0100 |
---|---|---|
committer | David Shah <dave@ds0.me> | 2020-11-30 08:45:27 +0000 |
commit | 9affda5626e8207952076b8b12d2981e4bc8533e (patch) | |
tree | aec5756059fcdfa96c97bab2da75306caf5fb0b5 /nexus/arch.cc | |
parent | 7645354917b93417ebeef974f5ca8961c9a1a3c8 (diff) | |
download | nextpnr-9affda5626e8207952076b8b12d2981e4bc8533e.tar.gz nextpnr-9affda5626e8207952076b8b12d2981e4bc8533e.tar.bz2 nextpnr-9affda5626e8207952076b8b12d2981e4bc8533e.zip |
nexus: Build and embed chipdb automatically
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'nexus/arch.cc')
-rw-r--r-- | nexus/arch.cc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/nexus/arch.cc b/nexus/arch.cc index 63977d6f..40efa62d 100644 --- a/nexus/arch.cc +++ b/nexus/arch.cc @@ -20,6 +20,7 @@ #include <boost/algorithm/string.hpp> +#include "embed.h" #include "log.h" #include "nextpnr.h" #include "placer1.h" @@ -43,8 +44,6 @@ static std::tuple<int, int, std::string> split_identifier_name(const std::string name.substr(second_slash + 1)); }; -static const DatabasePOD *get_chipdb(const RelPtr<DatabasePOD> *ptr) { return ptr->get(); } - } // namespace // ----------------------------------------------------------------------- @@ -78,16 +77,12 @@ Arch::Arch(ArchArgs args) : args(args) log_error("Unknown device string '%s' (expected device name like 'LIFCL-40-8SG72C')\n", args.device.c_str()); package = args.device.substr(last_sep + 2, (package_end - (last_sep + 2)) + 1); rating = args.device.substr(package_end + 1); - // Load database (FIXME: baked-in databases too) - try { - blob_file.open(args.chipdb); - if (!blob_file.is_open()) - log_error("Unable to read chipdb %s\n", args.chipdb.c_str()); - const char *blob = reinterpret_cast<const char *>(blob_file.data()); - db = get_chipdb(reinterpret_cast<const RelPtr<DatabasePOD> *>(blob)); - } catch (...) { - log_error("Unable to read chipdb %s\n", args.chipdb.c_str()); - } + // Load database + std::string chipdb = stringf("nexus/chipdb-%s.bin", family.c_str()); + auto db_ptr = reinterpret_cast<const RelPtr<DatabasePOD> *>(get_chipdb(chipdb)); + if (db_ptr == nullptr) + log_error("Failed to load chipdb '%s'\n", chipdb.c_str()); + db = db_ptr->get(); // Check database version and family if (db->version != bba_version) { log_error("Provided database version %d is %s than nextpnr version %d, please rebuild database/nextpnr.\n", |