From 19cc284b8cd6293430dd8acc11ace73b8e13b287 Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 16 Nov 2018 10:24:00 +0000 Subject: ecp5: Allow selection of device speed grade Signed-off-by: David Shah --- ecp5/main.cc | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/ecp5/main.cc b/ecp5/main.cc index 0b187942..8e1ee8d4 100644 --- a/ecp5/main.cc +++ b/ecp5/main.cc @@ -59,6 +59,8 @@ po::options_description ECP5CommandHandler::getArchOptions() specific.add_options()("um5g-85k", "set device type to LFE5UM5G-85F"); specific.add_options()("package", po::value(), "select device package (defaults to CABGA381)"); + specific.add_options()("speed", po::value(), "select device speedgrade (6, 7 or 8)"); + specific.add_options()("basecfg", po::value(), "base chip configuration in Trellis text format"); specific.add_options()("textcfg", po::value(), "textual configuration in Trellis format to write"); @@ -112,10 +114,31 @@ std::unique_ptr ECP5CommandHandler::createContext() else chipArgs.package = "CABGA381"; if (chipArgs.type == ArchArgs::LFE5UM5G_25F || chipArgs.type == ArchArgs::LFE5UM5G_45F || - chipArgs.type == ArchArgs::LFE5UM5G_85F) + chipArgs.type == ArchArgs::LFE5UM5G_85F) { + if (vm.count("speed") && vm["speed"].as() != 8) + log_error("Only speed grade 8 is available for 5G parts\n"); chipArgs.speed = ArchArgs::SPEED_8_5G; - else - chipArgs.speed = ArchArgs::SPEED_6; + } else { + if (vm.count("speed")) { + int speed = vm["speed"].as(); + switch (speed) { + case 6: + chipArgs.speed = ArchArgs::SPEED_6; + break; + case 7: + chipArgs.speed = ArchArgs::SPEED_7; + break; + case 8: + chipArgs.speed = ArchArgs::SPEED_8; + break; + default: + log_error("Unsupported speed grade '%d'\n", speed); + } + } else { + chipArgs.speed = ArchArgs::SPEED_6; + } + } + return std::unique_ptr(new Context(chipArgs)); } -- cgit v1.2.3