From 3be76a837d20fb81814067cebdd45f482cbcbb33 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 8 Jul 2020 13:22:59 +0200 Subject: Support 4K parts directly --- gui/ice40/mainwindow.cc | 2 ++ ice40/arch.cc | 27 ++++++++++++++++++++++----- ice40/arch.h | 1 + ice40/main.cc | 10 ++++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index 3dcf90ae..b08e5435 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -89,6 +89,8 @@ void MainWindow::new_proj() arch.insert("Lattice UP5K", ArchArgs::UP5K); if (Arch::isAvailable(ArchArgs::LP8K)) arch.insert("Lattice LP8K", ArchArgs::LP8K); + if (Arch::isAvailable(ArchArgs::HX4K)) + arch.insert("Lattice HX4K", ArchArgs::HX4K); if (Arch::isAvailable(ArchArgs::HX8K)) arch.insert("Lattice HX8K", ArchArgs::HX8K); diff --git a/ice40/arch.cc b/ice40/arch.cc index be346fd7..b20245fc 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -55,7 +55,7 @@ static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip) chipdb = "ice40/chipdb-u4k.bin"; } else if (chip == ArchArgs::UP5K) { chipdb = "ice40/chipdb-5k.bin"; - } else if (chip == ArchArgs::LP8K || chip == ArchArgs::HX8K) { + } else if (chip == ArchArgs::LP8K || chip == ArchArgs::HX8K || chip == ArchArgs::HX4K) { chipdb = "ice40/chipdb-8k.bin"; } else { log_error("Unknown chip\n"); @@ -73,8 +73,17 @@ std::vector Arch::getSupportedPackages(ArchArgs::ArchArgsTypes chip { const ChipInfoPOD *chip_info = get_chip_info(chip); std::vector packages; - for (int i = 0; i < chip_info->num_packages; i++) - packages.push_back(chip_info->packages_data[i].name.get()); + for (int i = 0; i < chip_info->num_packages; i++) { + std::string name = chip_info->packages_data[i].name.get(); + if (chip == ArchArgs::HX4K) + { + if (name.find(":4k") != std::string::npos) + name = name.substr(0, name.size()-3); + else + continue; + } + packages.push_back(name); + } return packages; } @@ -82,15 +91,19 @@ std::vector Arch::getSupportedPackages(ArchArgs::ArchArgsTypes chip Arch::Arch(ArchArgs args) : args(args) { - fast_part = (args.type == ArchArgs::HX8K || args.type == ArchArgs::HX1K); + fast_part = (args.type == ArchArgs::HX8K || args.type == ArchArgs::HX4K || args.type == ArchArgs::HX1K); chip_info = get_chip_info(args.type); if (chip_info == nullptr) log_error("Unsupported iCE40 chip type.\n"); package_info = nullptr; + std::string package_name = args.package; + if (args.type == ArchArgs::HX4K) + package_name += ":4k"; + for (int i = 0; i < chip_info->num_packages; i++) { - if (chip_info->packages_data[i].name.get() == args.package) { + if (chip_info->packages_data[i].name.get() == package_name) { package_info = &(chip_info->packages_data[i]); break; } @@ -121,6 +134,8 @@ std::string Arch::getChipName() const return "Lattice U4K"; } else if (args.type == ArchArgs::LP8K) { return "Lattice LP8K"; + } else if (args.type == ArchArgs::HX4K) { + return "Lattice HX4K"; } else if (args.type == ArchArgs::HX8K) { return "Lattice HX8K"; } else { @@ -144,6 +159,8 @@ IdString Arch::archArgsToId(ArchArgs args) const return id("u4k"); if (args.type == ArchArgs::LP8K) return id("lp8k"); + if (args.type == ArchArgs::HX4K) + return id("hx4k"); if (args.type == ArchArgs::HX8K) return id("hx8k"); return IdString(); diff --git a/ice40/arch.h b/ice40/arch.h index 0d8e7d76..9197dcd2 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -387,6 +387,7 @@ struct ArchArgs LP1K, LP8K, HX1K, + HX4K, HX8K, UP5K, U4K diff --git a/ice40/main.cc b/ice40/main.cc index 497d580b..fedd0918 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -59,6 +59,8 @@ po::options_description Ice40CommandHandler::getArchOptions() if (Arch::isAvailable(ArchArgs::HX1K)) specific.add_options()("hx1k", "set device type to iCE40HX1K"); if (Arch::isAvailable(ArchArgs::HX8K)) + specific.add_options()("hx4k", "set device type to iCE40HX4K"); + if (Arch::isAvailable(ArchArgs::HX4K)) specific.add_options()("hx8k", "set device type to iCE40HX8K"); if (Arch::isAvailable(ArchArgs::UP5K)) specific.add_options()("up5k", "set device type to iCE40UP5K"); @@ -142,6 +144,11 @@ std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map Ice40CommandHandler::createContext(std::unordered_map Date: Wed, 8 Jul 2020 13:44:13 +0200 Subject: Adding LP4K as well --- gui/ice40/mainwindow.cc | 2 ++ ice40/arch.cc | 10 +++++++--- ice40/arch.h | 1 + ice40/main.cc | 8 ++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index b08e5435..bb5b6ab5 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -87,6 +87,8 @@ void MainWindow::new_proj() arch.insert("Lattice U4K", ArchArgs::U4K); if (Arch::isAvailable(ArchArgs::UP5K)) arch.insert("Lattice UP5K", ArchArgs::UP5K); + if (Arch::isAvailable(ArchArgs::LP4K)) + arch.insert("Lattice LP4K", ArchArgs::LP4K); if (Arch::isAvailable(ArchArgs::LP8K)) arch.insert("Lattice LP8K", ArchArgs::LP8K); if (Arch::isAvailable(ArchArgs::HX4K)) diff --git a/ice40/arch.cc b/ice40/arch.cc index b20245fc..a94d40c8 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -55,7 +55,7 @@ static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip) chipdb = "ice40/chipdb-u4k.bin"; } else if (chip == ArchArgs::UP5K) { chipdb = "ice40/chipdb-5k.bin"; - } else if (chip == ArchArgs::LP8K || chip == ArchArgs::HX8K || chip == ArchArgs::HX4K) { + } else if (chip == ArchArgs::LP8K || chip == ArchArgs::HX8K || chip == ArchArgs::LP4K || chip == ArchArgs::HX4K) { chipdb = "ice40/chipdb-8k.bin"; } else { log_error("Unknown chip\n"); @@ -75,7 +75,7 @@ std::vector Arch::getSupportedPackages(ArchArgs::ArchArgsTypes chip std::vector packages; for (int i = 0; i < chip_info->num_packages; i++) { std::string name = chip_info->packages_data[i].name.get(); - if (chip == ArchArgs::HX4K) + if (chip == ArchArgs::LP4K || chip == ArchArgs::HX4K) { if (name.find(":4k") != std::string::npos) name = name.substr(0, name.size()-3); @@ -99,7 +99,7 @@ Arch::Arch(ArchArgs args) : args(args) package_info = nullptr; std::string package_name = args.package; - if (args.type == ArchArgs::HX4K) + if (args.type == ArchArgs::LP4K || args.type == ArchArgs::HX4K) package_name += ":4k"; for (int i = 0; i < chip_info->num_packages; i++) { @@ -132,6 +132,8 @@ std::string Arch::getChipName() const return "Lattice UP5K"; } else if (args.type == ArchArgs::U4K) { return "Lattice U4K"; + } else if (args.type == ArchArgs::LP4K) { + return "Lattice LP4K"; } else if (args.type == ArchArgs::LP8K) { return "Lattice LP8K"; } else if (args.type == ArchArgs::HX4K) { @@ -157,6 +159,8 @@ IdString Arch::archArgsToId(ArchArgs args) const return id("up5k"); if (args.type == ArchArgs::U4K) return id("u4k"); + if (args.type == ArchArgs::LP4K) + return id("lp4k"); if (args.type == ArchArgs::LP8K) return id("lp8k"); if (args.type == ArchArgs::HX4K) diff --git a/ice40/arch.h b/ice40/arch.h index 9197dcd2..6c79f349 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -385,6 +385,7 @@ struct ArchArgs NONE, LP384, LP1K, + LP4K, LP8K, HX1K, HX4K, diff --git a/ice40/main.cc b/ice40/main.cc index fedd0918..bfbe3b8c 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -134,6 +134,11 @@ std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map Ice40CommandHandler::createContext(std::unordered_map Date: Wed, 8 Jul 2020 13:45:34 +0200 Subject: Missed adding option --- ice40/main.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ice40/main.cc b/ice40/main.cc index bfbe3b8c..6f6632cc 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -54,6 +54,8 @@ po::options_description Ice40CommandHandler::getArchOptions() specific.add_options()("lp384", "set device type to iCE40LP384"); if (Arch::isAvailable(ArchArgs::LP1K)) specific.add_options()("lp1k", "set device type to iCE40LP1K"); + if (Arch::isAvailable(ArchArgs::LP4K)) + specific.add_options()("lp4k", "set device type to iCE40LP4K"); if (Arch::isAvailable(ArchArgs::LP8K)) specific.add_options()("lp8k", "set device type to iCE40LP8K"); if (Arch::isAvailable(ArchArgs::HX1K)) -- cgit v1.2.3 From 32ddc94b4f5735b8c28edb1f311533b360888a2a Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 8 Jul 2020 14:09:44 +0200 Subject: Support rest of parts --- gui/ice40/mainwindow.cc | 6 ++++++ ice40/arch.cc | 33 ++++++++++++++++++++++----------- ice40/arch.h | 3 +++ ice40/main.cc | 35 +++++++++++++++++++++++++++++++++-- 4 files changed, 64 insertions(+), 13 deletions(-) diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index bb5b6ab5..56855f41 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -83,8 +83,14 @@ void MainWindow::new_proj() arch.insert("Lattice LP1K", ArchArgs::LP1K); if (Arch::isAvailable(ArchArgs::HX1K)) arch.insert("Lattice HX1K", ArchArgs::HX1K); + if (Arch::isAvailable(ArchArgs::U1K)) + arch.insert("Lattice U1K", ArchArgs::U1K); + if (Arch::isAvailable(ArchArgs::U2K)) + arch.insert("Lattice U2K", ArchArgs::U2K); if (Arch::isAvailable(ArchArgs::U4K)) arch.insert("Lattice U4K", ArchArgs::U4K); + if (Arch::isAvailable(ArchArgs::UP3K)) + arch.insert("Lattice UP3K", ArchArgs::UP3K); if (Arch::isAvailable(ArchArgs::UP5K)) arch.insert("Lattice UP5K", ArchArgs::UP5K); if (Arch::isAvailable(ArchArgs::LP4K)) diff --git a/ice40/arch.cc b/ice40/arch.cc index a94d40c8..306c52c2 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -51,9 +51,9 @@ static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip) chipdb = "ice40/chipdb-384.bin"; } else if (chip == ArchArgs::LP1K || chip == ArchArgs::HX1K) { chipdb = "ice40/chipdb-1k.bin"; - } else if (chip == ArchArgs::U4K) { + } else if (chip == ArchArgs::U1K || chip == ArchArgs::U2K || chip == ArchArgs::U4K) { chipdb = "ice40/chipdb-u4k.bin"; - } else if (chip == ArchArgs::UP5K) { + } else if (chip == ArchArgs::UP3K || chip == ArchArgs::UP5K) { chipdb = "ice40/chipdb-5k.bin"; } else if (chip == ArchArgs::LP8K || chip == ArchArgs::HX8K || chip == ArchArgs::LP4K || chip == ArchArgs::HX4K) { chipdb = "ice40/chipdb-8k.bin"; @@ -74,15 +74,14 @@ std::vector Arch::getSupportedPackages(ArchArgs::ArchArgsTypes chip const ChipInfoPOD *chip_info = get_chip_info(chip); std::vector packages; for (int i = 0; i < chip_info->num_packages; i++) { - std::string name = chip_info->packages_data[i].name.get(); - if (chip == ArchArgs::LP4K || chip == ArchArgs::HX4K) - { - if (name.find(":4k") != std::string::npos) - name = name.substr(0, name.size()-3); - else - continue; - } - packages.push_back(name); + std::string name = chip_info->packages_data[i].name.get(); + if (chip == ArchArgs::LP4K || chip == ArchArgs::HX4K) { + if (name.find(":4k") != std::string::npos) + name = name.substr(0, name.size() - 3); + else + continue; + } + packages.push_back(name); } return packages; } @@ -128,8 +127,14 @@ std::string Arch::getChipName() const return "Lattice LP1K"; } else if (args.type == ArchArgs::HX1K) { return "Lattice HX1K"; + } else if (args.type == ArchArgs::UP3K) { + return "Lattice UP3K"; } else if (args.type == ArchArgs::UP5K) { return "Lattice UP5K"; + } else if (args.type == ArchArgs::U1K) { + return "Lattice U1K"; + } else if (args.type == ArchArgs::U2K) { + return "Lattice U2K"; } else if (args.type == ArchArgs::U4K) { return "Lattice U4K"; } else if (args.type == ArchArgs::LP4K) { @@ -155,8 +160,14 @@ IdString Arch::archArgsToId(ArchArgs args) const return id("lp1k"); if (args.type == ArchArgs::HX1K) return id("hx1k"); + if (args.type == ArchArgs::UP3K) + return id("up3k"); if (args.type == ArchArgs::UP5K) return id("up5k"); + if (args.type == ArchArgs::U1K) + return id("u1k"); + if (args.type == ArchArgs::U2K) + return id("u2k"); if (args.type == ArchArgs::U4K) return id("u4k"); if (args.type == ArchArgs::LP4K) diff --git a/ice40/arch.h b/ice40/arch.h index 6c79f349..0af0a5dd 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -390,7 +390,10 @@ struct ArchArgs HX1K, HX4K, HX8K, + UP3K, UP5K, + U1K, + U2K, U4K } type = NONE; std::string package; diff --git a/ice40/main.cc b/ice40/main.cc index 6f6632cc..cabf6a2e 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -64,8 +64,14 @@ po::options_description Ice40CommandHandler::getArchOptions() specific.add_options()("hx4k", "set device type to iCE40HX4K"); if (Arch::isAvailable(ArchArgs::HX4K)) specific.add_options()("hx8k", "set device type to iCE40HX8K"); + if (Arch::isAvailable(ArchArgs::UP3K)) + specific.add_options()("up3k", "set device type to iCE40UP3K"); if (Arch::isAvailable(ArchArgs::UP5K)) specific.add_options()("up5k", "set device type to iCE40UP5K"); + if (Arch::isAvailable(ArchArgs::U1K)) + specific.add_options()("u1k", "set device type to iCE5LP1K"); + if (Arch::isAvailable(ArchArgs::U2K)) + specific.add_options()("u2k", "set device type to iCE5LP2K"); if (Arch::isAvailable(ArchArgs::U4K)) specific.add_options()("u4k", "set device type to iCE5LP4K"); specific.add_options()("package", po::value(), "set device package"); @@ -84,8 +90,9 @@ po::options_description Ice40CommandHandler::getArchOptions() void Ice40CommandHandler::validate() { conflicting_options(vm, "read", "json"); - if ((vm.count("lp384") + vm.count("lp1k") + vm.count("lp8k") + vm.count("hx1k") + vm.count("hx8k") + - vm.count("up5k") + vm.count("u4k")) > 1) + if ((vm.count("lp384") + vm.count("lp1k") + vm.count("lp4k") + vm.count("lp8k") + vm.count("hx1k") + + vm.count("hx4k") + vm.count("hx8k") + vm.count("up3k") + vm.count("up5k") + vm.count("u1k") + vm.count("u2k") + + vm.count("u4k")) > 1) log_error("Only one device type can be set\n"); } @@ -161,11 +168,26 @@ std::unique_ptr Ice40CommandHandler::createContext(std::unordered_map Ice40CommandHandler::createContext(std::unordered_map Date: Wed, 8 Jul 2020 14:16:00 +0200 Subject: Use proper names in GUI --- gui/ice40/mainwindow.cc | 24 ++++++++++++------------ ice40/arch.cc | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index 56855f41..3c9cab1f 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -78,29 +78,29 @@ void MainWindow::new_proj() { QMap arch; if (Arch::isAvailable(ArchArgs::LP384)) - arch.insert("Lattice LP384", ArchArgs::LP384); + arch.insert("Lattice iCE40LP384", ArchArgs::LP384); if (Arch::isAvailable(ArchArgs::LP1K)) - arch.insert("Lattice LP1K", ArchArgs::LP1K); + arch.insert("Lattice iCE40LP1K", ArchArgs::LP1K); if (Arch::isAvailable(ArchArgs::HX1K)) - arch.insert("Lattice HX1K", ArchArgs::HX1K); + arch.insert("Lattice iCE40HX1K", ArchArgs::HX1K); if (Arch::isAvailable(ArchArgs::U1K)) - arch.insert("Lattice U1K", ArchArgs::U1K); + arch.insert("Lattice iCE5LP1K", ArchArgs::U1K); if (Arch::isAvailable(ArchArgs::U2K)) - arch.insert("Lattice U2K", ArchArgs::U2K); + arch.insert("Lattice iCE5LP2K", ArchArgs::U2K); if (Arch::isAvailable(ArchArgs::U4K)) - arch.insert("Lattice U4K", ArchArgs::U4K); + arch.insert("Lattice iCE5LP4K", ArchArgs::U4K); if (Arch::isAvailable(ArchArgs::UP3K)) - arch.insert("Lattice UP3K", ArchArgs::UP3K); + arch.insert("Lattice iCE40UP3K", ArchArgs::UP3K); if (Arch::isAvailable(ArchArgs::UP5K)) - arch.insert("Lattice UP5K", ArchArgs::UP5K); + arch.insert("Lattice iCE40UP5K", ArchArgs::UP5K); if (Arch::isAvailable(ArchArgs::LP4K)) - arch.insert("Lattice LP4K", ArchArgs::LP4K); + arch.insert("Lattice iCE40LP4K", ArchArgs::LP4K); if (Arch::isAvailable(ArchArgs::LP8K)) - arch.insert("Lattice LP8K", ArchArgs::LP8K); + arch.insert("Lattice iCE40LP8K", ArchArgs::LP8K); if (Arch::isAvailable(ArchArgs::HX4K)) - arch.insert("Lattice HX4K", ArchArgs::HX4K); + arch.insert("Lattice iCE40HX4K", ArchArgs::HX4K); if (Arch::isAvailable(ArchArgs::HX8K)) - arch.insert("Lattice HX8K", ArchArgs::HX8K); + arch.insert("Lattice iCE40HX8K", ArchArgs::HX8K); bool ok; QString item = QInputDialog::getItem(this, "Select new context", "Chip:", arch.keys(), 0, false, &ok); diff --git a/ice40/arch.cc b/ice40/arch.cc index 306c52c2..74674799 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -122,29 +122,29 @@ Arch::Arch(ArchArgs args) : args(args) std::string Arch::getChipName() const { if (args.type == ArchArgs::LP384) { - return "Lattice LP384"; + return "Lattice iCE40LP384"; } else if (args.type == ArchArgs::LP1K) { - return "Lattice LP1K"; + return "Lattice iCE40LP1K"; } else if (args.type == ArchArgs::HX1K) { - return "Lattice HX1K"; + return "Lattice iCE40HX1K"; } else if (args.type == ArchArgs::UP3K) { - return "Lattice UP3K"; + return "Lattice iCE40UP3K"; } else if (args.type == ArchArgs::UP5K) { - return "Lattice UP5K"; + return "Lattice iCE40UP5K"; } else if (args.type == ArchArgs::U1K) { - return "Lattice U1K"; + return "Lattice iCE5LP1K"; } else if (args.type == ArchArgs::U2K) { - return "Lattice U2K"; + return "Lattice iCE5LP2K"; } else if (args.type == ArchArgs::U4K) { - return "Lattice U4K"; + return "Lattice iCE5LP4K"; } else if (args.type == ArchArgs::LP4K) { - return "Lattice LP4K"; + return "Lattice iCE40LP4K"; } else if (args.type == ArchArgs::LP8K) { - return "Lattice LP8K"; + return "Lattice iCE40LP8K"; } else if (args.type == ArchArgs::HX4K) { - return "Lattice HX4K"; + return "Lattice iCE40HX4K"; } else if (args.type == ArchArgs::HX8K) { - return "Lattice HX8K"; + return "Lattice iCE40HX8K"; } else { log_error("Unknown chip\n"); } -- cgit v1.2.3