diff options
Diffstat (limited to 'ice40')
| -rw-r--r-- | ice40/arch.cc | 27 | ||||
| -rw-r--r-- | ice40/arch.h | 1 | ||||
| -rw-r--r-- | ice40/main.cc | 10 | 
3 files changed, 33 insertions, 5 deletions
| 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<std::string> Arch::getSupportedPackages(ArchArgs::ArchArgsTypes chip  {      const ChipInfoPOD *chip_info = get_chip_info(chip);      std::vector<std::string> 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<std::string> 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<Context> Ice40CommandHandler::createContext(std::unordered_map<s          chipArgs.package = "tq144";      } +    if (vm.count("hx4k")) { +        chipArgs.type = ArchArgs::HX4K; +        chipArgs.package = "tq144"; +    } +      if (vm.count("hx8k")) {          chipArgs.type = ArchArgs::HX8K;          chipArgs.package = "ct256"; @@ -185,6 +192,9 @@ std::unique_ptr<Context> Ice40CommandHandler::createContext(std::unordered_map<s          if (arch_type == "hx1k") {              chipArgs.type = ArchArgs::HX1K;          } +        if (arch_type == "hx4k") { +            chipArgs.type = ArchArgs::HX4K; +        }          if (arch_type == "hx8k") {              chipArgs.type = ArchArgs::HX8K;          } | 
