aboutsummaryrefslogtreecommitdiffstats
path: root/gui/ecp5/mainwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gui/ecp5/mainwindow.cc')
-rw-r--r--gui/ecp5/mainwindow.cc56
1 files changed, 23 insertions, 33 deletions
diff --git a/gui/ecp5/mainwindow.cc b/gui/ecp5/mainwindow.cc
index 880af047..5ae1e50f 100644
--- a/gui/ecp5/mainwindow.cc
+++ b/gui/ecp5/mainwindow.cc
@@ -76,48 +76,38 @@ void MainWindow::createMenu()
menuDesign->addAction(actionSaveConfig);
}
-static const ChipInfoPOD *get_chip_info(const RelPtr<ChipInfoPOD> *ptr) { return ptr->get(); }
-
-static QStringList getSupportedPackages(ArchArgs::ArchArgsTypes chip)
-{
- QStringList packages;
- const ChipInfoPOD *chip_info;
- if (chip == ArchArgs::LFE5U_25F || chip == ArchArgs::LFE5UM_25F || chip == ArchArgs::LFE5UM5G_25F) {
- chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_25k));
- } else if (chip == ArchArgs::LFE5U_45F || chip == ArchArgs::LFE5UM_45F || chip == ArchArgs::LFE5UM5G_45F) {
- chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_45k));
- } else if (chip == ArchArgs::LFE5U_85F || chip == ArchArgs::LFE5UM_85F || chip == ArchArgs::LFE5UM5G_85F) {
- chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_85k));
- } else {
- log_error("Unsupported ECP5 chip type.\n");
- }
-
- for (int i = 0; i < chip_info->num_packages; i++) {
- packages << chip_info->package_info[i].name.get();
- }
- return packages;
-}
-
void MainWindow::new_proj()
{
QMap<QString, int> arch;
- arch.insert("Lattice ECP5 LFE5U-25F", ArchArgs::LFE5U_25F);
- arch.insert("Lattice ECP5 LFE5U-45F", ArchArgs::LFE5U_45F);
- arch.insert("Lattice ECP5 LFE5U-85F", ArchArgs::LFE5U_85F);
- arch.insert("Lattice ECP5 LFE5UM-25F", ArchArgs::LFE5UM_25F);
- arch.insert("Lattice ECP5 LFE5UM-45F", ArchArgs::LFE5UM_45F);
- arch.insert("Lattice ECP5 LFE5UM-85F", ArchArgs::LFE5UM_85F);
- arch.insert("Lattice ECP5 LFE5UM5G-25F", ArchArgs::LFE5UM5G_25F);
- arch.insert("Lattice ECP5 LFE5UM5G-45F", ArchArgs::LFE5UM5G_45F);
- arch.insert("Lattice ECP5 LFE5UM5G-85F", ArchArgs::LFE5UM5G_85F);
+ if (Arch::isAvailable(ArchArgs::LFE5U_25F))
+ arch.insert("Lattice ECP5 LFE5U-25F", ArchArgs::LFE5U_25F);
+ if (Arch::isAvailable(ArchArgs::LFE5U_45F))
+ arch.insert("Lattice ECP5 LFE5U-45F", ArchArgs::LFE5U_45F);
+ if (Arch::isAvailable(ArchArgs::LFE5U_85F))
+ arch.insert("Lattice ECP5 LFE5U-85F", ArchArgs::LFE5U_85F);
+ if (Arch::isAvailable(ArchArgs::LFE5UM_25F))
+ arch.insert("Lattice ECP5 LFE5UM-25F", ArchArgs::LFE5UM_25F);
+ if (Arch::isAvailable(ArchArgs::LFE5UM_45F))
+ arch.insert("Lattice ECP5 LFE5UM-45F", ArchArgs::LFE5UM_45F);
+ if (Arch::isAvailable(ArchArgs::LFE5UM_85F))
+ arch.insert("Lattice ECP5 LFE5UM-85F", ArchArgs::LFE5UM_85F);
+ if (Arch::isAvailable(ArchArgs::LFE5UM5G_25F))
+ arch.insert("Lattice ECP5 LFE5UM5G-25F", ArchArgs::LFE5UM5G_25F);
+ if (Arch::isAvailable(ArchArgs::LFE5UM5G_45F))
+ arch.insert("Lattice ECP5 LFE5UM5G-45F", ArchArgs::LFE5UM5G_45F);
+ if (Arch::isAvailable(ArchArgs::LFE5UM5G_85F))
+ arch.insert("Lattice ECP5 LFE5UM5G-85F", ArchArgs::LFE5UM5G_85F);
+
bool ok;
QString item = QInputDialog::getItem(this, "Select new context", "Chip:", arch.keys(), 0, false, &ok);
if (ok && !item.isEmpty()) {
ArchArgs chipArgs;
chipArgs.type = (ArchArgs::ArchArgsTypes)arch.value(item);
- QString package = QInputDialog::getItem(this, "Select package", "Package:", getSupportedPackages(chipArgs.type),
- 0, false, &ok);
+ QStringList packages;
+ for (auto package : Arch::getSupportedPackages(chipArgs.type))
+ packages.append(QLatin1String(package.data(), package.size()));
+ QString package = QInputDialog::getItem(this, "Select package", "Package:", packages, 0, false, &ok);
if (ok && !item.isEmpty()) {
currentProj = "";