Support 4K parts directly

This commit is contained in:
Miodrag Milanovic 2020-07-08 13:22:59 +02:00
parent bb3dad7ce7
commit 3be76a837d
4 changed files with 35 additions and 5 deletions

View File

@ -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);

View File

@ -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();

View File

@ -387,6 +387,7 @@ struct ArchArgs
LP1K,
LP8K,
HX1K,
HX4K,
HX8K,
UP5K,
U4K

View File

@ -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;
}