From 7ca3ba3835ee6083b441d693a30ef7530a7e2eed Mon Sep 17 00:00:00 2001 From: gatecat Date: Thu, 15 Sep 2022 12:27:36 +0200 Subject: nexus: Add ES2 device names and --list-devices Signed-off-by: gatecat --- nexus/arch.cc | 36 +++++++++++++++++++++++++++++++++++- nexus/arch.h | 2 ++ nexus/main.cc | 5 +++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/nexus/arch.cc b/nexus/arch.cc index c2d3b6e4..274c5ad3 100644 --- a/nexus/arch.cc +++ b/nexus/arch.cc @@ -58,7 +58,9 @@ Arch::Arch(ArchArgs args) : args(args) log_error("Unknown device string '%s' (expected device name like 'LIFCL-40-8SG72C')\n", args.device.c_str()); device = args.device.substr(0, last_sep); speed = args.device.substr(last_sep + 1, 1); - auto package_end = args.device.find_last_of("0123456789"); + auto package_end = args.device.find_last_of("0123456789", args.device.substr(args.device.size() - 3) == "ES2" + ? args.device.size() - 3 + : std::string::npos); if (package_end == std::string::npos || package_end < last_sep) 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); @@ -67,6 +69,9 @@ Arch::Arch(ArchArgs args) : args(args) // Check for 'ES' part if (rating.size() > 1 && rating.substr(1) == "ES") { variant = "ES"; + } else if (rating.size() > 1 && rating.substr(1) == "ES2") { + // ES2 devices are production-equivalent from nextpnr's and bitstream point of view + variant = ""; } else { variant = ""; } @@ -194,6 +199,35 @@ Arch::Arch(ArchArgs args) : args(args) } } +void Arch::list_devices() +{ + std::vector families{ + "LIFCL", + }; + log("Supported devices: \n"); + for (auto fam : families) { + std::string chipdb = stringf("nexus/chipdb-%s.bin", fam.c_str()); + auto db_ptr = reinterpret_cast *>(get_chipdb(chipdb)); + if (!db_ptr) + continue; // chipdb not available + // enumerate chips + for (auto &chip : db_ptr->get()->chips) { + // enumerate packages + for (auto &pkg : chip.packages) { + // enumerate suffices + for (auto speedgrade : {"7", "8", "9"}) { // TODO: these might depend on family + for (auto rating : {"I", "C"}) { + for (auto suffix : {"", "ES", "ES2"}) { + log(" %s-%s%s%s%s\n", chip.device_name.get(), speedgrade, pkg.short_name.get(), rating, + suffix); + } + } + } + } + } + } +} + // ----------------------------------------------------------------------- std::string Arch::getChipName() const { return args.device; } diff --git a/nexus/arch.h b/nexus/arch.h index 4a28dfb7..df4f976a 100644 --- a/nexus/arch.h +++ b/nexus/arch.h @@ -1522,6 +1522,8 @@ struct Arch : BaseArch // ------------------------------------------------- void write_fasm(std::ostream &out) const; + // ------------------------------------------------- + static void list_devices(); }; NEXTPNR_NAMESPACE_END diff --git a/nexus/main.cc b/nexus/main.cc index bca6661f..cfa06b74 100644 --- a/nexus/main.cc +++ b/nexus/main.cc @@ -48,6 +48,7 @@ po::options_description NexusCommandHandler::getArchOptions() { po::options_description specific("Architecture specific options"); specific.add_options()("device", po::value(), "device name"); + specific.add_options()("list-devices", "list all supported device names"); specific.add_options()("fasm", po::value(), "fasm file to write"); specific.add_options()("pdc", po::value(), "physical constraints file"); specific.add_options()("no-post-place-opt", "disable post-place repacking (debugging use only)"); @@ -73,6 +74,10 @@ void NexusCommandHandler::customBitstream(Context *ctx) std::unique_ptr NexusCommandHandler::createContext(dict &values) { ArchArgs chipArgs; + if (vm.count("list-devices")) { + Arch::list_devices(); + exit(0); + } if (!vm.count("device")) { log_error("device must be specified on the command line (e.g. --device LIFCL-40-9BG400CES)\n"); } -- cgit v1.2.3