ecp5: Add support for correct tile naming in all variants
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
3aa3f5d796
commit
8aac6db44b
30
ecp5/arch.cc
30
ecp5/arch.cc
@ -77,11 +77,11 @@ Arch::Arch(ArchArgs args) : args(args)
|
||||
log_error("Unsupported ECP5 chip type.\n");
|
||||
}
|
||||
#else
|
||||
if (args.type == ArchArgs::LFE5U_25F) {
|
||||
if (args.type == ArchArgs::LFE5U_25F || args.type == ArchArgs::LFE5UM_25F || args.type == ArchArgs::LFE5UM5G_25F) {
|
||||
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_25k));
|
||||
} else if (args.type == ArchArgs::LFE5U_45F) {
|
||||
} else if (args.type == ArchArgs::LFE5U_45F || args.type == ArchArgs::LFE5UM_45F || args.type == ArchArgs::LFE5UM5G_45F) {
|
||||
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_45k));
|
||||
} else if (args.type == ArchArgs::LFE5U_85F) {
|
||||
} else if (args.type == ArchArgs::LFE5U_85F || args.type == ArchArgs::LFE5UM_85F || args.type == ArchArgs::LFE5UM5G_85F) {
|
||||
chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_85k));
|
||||
} else {
|
||||
log_error("Unsupported ECP5 chip type.\n");
|
||||
@ -111,6 +111,18 @@ std::string Arch::getChipName() const
|
||||
return "LFE5U-45F";
|
||||
} else if (args.type == ArchArgs::LFE5U_85F) {
|
||||
return "LFE5U-85F";
|
||||
} else if (args.type == ArchArgs::LFE5UM_25F) {
|
||||
return "LFE5UM-25F";
|
||||
} else if (args.type == ArchArgs::LFE5UM_45F) {
|
||||
return "LFE5UM-45F";
|
||||
} else if (args.type == ArchArgs::LFE5UM_85F) {
|
||||
return "LFE5UM-85F";
|
||||
} else if (args.type == ArchArgs::LFE5UM5G_25F) {
|
||||
return "LFE5UM5G-25F";
|
||||
} else if (args.type == ArchArgs::LFE5UM5G_45F) {
|
||||
return "LFE5UM5G-45F";
|
||||
} else if (args.type == ArchArgs::LFE5UM5G_85F) {
|
||||
return "LFE5UM5G-85F";
|
||||
} else {
|
||||
log_error("Unknown chip\n");
|
||||
}
|
||||
@ -126,6 +138,18 @@ IdString Arch::archArgsToId(ArchArgs args) const
|
||||
return id("lfe5u_45f");
|
||||
if (args.type == ArchArgs::LFE5U_85F)
|
||||
return id("lfe5u_85f");
|
||||
if (args.type == ArchArgs::LFE5UM_25F)
|
||||
return id("lfe5um_25f");
|
||||
if (args.type == ArchArgs::LFE5UM_45F)
|
||||
return id("lfe5um_45f");
|
||||
if (args.type == ArchArgs::LFE5UM_85F)
|
||||
return id("lfe5um_85f");
|
||||
if (args.type == ArchArgs::LFE5UM5G_25F)
|
||||
return id("lfe5um5g_25f");
|
||||
if (args.type == ArchArgs::LFE5UM5G_45F)
|
||||
return id("lfe5um5g_45f");
|
||||
if (args.type == ArchArgs::LFE5UM5G_85F)
|
||||
return id("lfe5um5g_85f");
|
||||
return IdString();
|
||||
}
|
||||
|
||||
|
@ -392,6 +392,12 @@ struct ArchArgs
|
||||
LFE5U_25F,
|
||||
LFE5U_45F,
|
||||
LFE5U_85F,
|
||||
LFE5UM_25F,
|
||||
LFE5UM_45F,
|
||||
LFE5UM_85F,
|
||||
LFE5UM5G_25F,
|
||||
LFE5UM5G_45F,
|
||||
LFE5UM5G_85F,
|
||||
} type = NONE;
|
||||
std::string package;
|
||||
int speed = 6;
|
||||
|
@ -279,6 +279,37 @@ std::vector<std::string> get_bram_tiles(Context *ctx, BelId bel)
|
||||
return tiles;
|
||||
}
|
||||
|
||||
void fix_tile_names(Context *ctx, ChipConfig &cc) {
|
||||
// Remove the V prefix/suffix on certain tiles if device is a SERDES variant
|
||||
if (ctx->args.type == ArchArgs::LFE5UM_25F || ctx->args.type == ArchArgs::LFE5UM_45F || ctx->args.type == ArchArgs::LFE5UM_85F ||
|
||||
ctx->args.type == ArchArgs::LFE5UM5G_25F || ctx->args.type == ArchArgs::LFE5UM5G_45F || ctx->args.type == ArchArgs::LFE5UM5G_85F) {
|
||||
std::map<std::string, std::string> tiletype_xform;
|
||||
for (const auto &tile : cc.tiles) {
|
||||
std::string newname = tile.first;
|
||||
auto vcib = tile.first.find("VCIB");
|
||||
if (vcib != std::string::npos) {
|
||||
// Remove the V
|
||||
newname.erase(vcib);
|
||||
tiletype_xform[tile.first] = newname;
|
||||
} else if (tile.first.back() == 'V') {
|
||||
// BMID_0V or BMID_2V
|
||||
if (tile.first.at(tile.first.size() - 2) == '0') {
|
||||
newname.at(tile.first.size() - 1) = 'H';
|
||||
tiletype_xform[tile.first] = newname;
|
||||
} else if (tile.first.at(tile.first.size() - 2) == '2') {
|
||||
newname.pop_back();
|
||||
tiletype_xform[tile.first] = newname;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Apply the name changes
|
||||
for (auto xform : tiletype_xform) {
|
||||
cc.tiles[xform.second] = cc.tiles.at(xform.first);
|
||||
cc.tiles.erase(xform.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void write_bitstream(Context *ctx, std::string base_config_file, std::string text_config_file)
|
||||
{
|
||||
ChipConfig cc;
|
||||
@ -588,7 +619,8 @@ void write_bitstream(Context *ctx, std::string base_config_file, std::string tex
|
||||
NPNR_ASSERT_FALSE("unsupported cell type");
|
||||
}
|
||||
}
|
||||
|
||||
// Fixup tile names
|
||||
fix_tile_names(ctx, cc);
|
||||
// Configure chip
|
||||
if (!text_config_file.empty()) {
|
||||
std::ofstream out_config(text_config_file);
|
||||
|
18
ecp5/main.cc
18
ecp5/main.cc
@ -50,6 +50,12 @@ po::options_description ECP5CommandHandler::getArchOptions()
|
||||
specific.add_options()("25k", "set device type to LFE5U-25F");
|
||||
specific.add_options()("45k", "set device type to LFE5U-45F");
|
||||
specific.add_options()("85k", "set device type to LFE5U-85F");
|
||||
specific.add_options()("um-25k", "set device type to LFE5UM-25F");
|
||||
specific.add_options()("um-45k", "set device type to LFE5UM-45F");
|
||||
specific.add_options()("um-85k", "set device type to LFE5UM-85F");
|
||||
specific.add_options()("um5g-25k", "set device type to LFE5UM5G-25F");
|
||||
specific.add_options()("um5g-45k", "set device type to LFE5UM5G-45F");
|
||||
specific.add_options()("um5g-85k", "set device type to LFE5UM5G-85F");
|
||||
specific.add_options()("package", po::value<std::string>(), "select device package (defaults to CABGA381)");
|
||||
specific.add_options()("basecfg", po::value<std::string>(), "base chip configuration in Trellis text format");
|
||||
specific.add_options()("textcfg", po::value<std::string>(), "textual configuration in Trellis format to write");
|
||||
@ -84,6 +90,18 @@ std::unique_ptr<Context> ECP5CommandHandler::createContext()
|
||||
chipArgs.type = ArchArgs::LFE5U_45F;
|
||||
if (vm.count("85k"))
|
||||
chipArgs.type = ArchArgs::LFE5U_85F;
|
||||
if (vm.count("um-25k"))
|
||||
chipArgs.type = ArchArgs::LFE5UM_25F;
|
||||
if (vm.count("um-45k"))
|
||||
chipArgs.type = ArchArgs::LFE5UM_45F;
|
||||
if (vm.count("um-85k"))
|
||||
chipArgs.type = ArchArgs::LFE5UM_85F;
|
||||
if (vm.count("um5g-25k"))
|
||||
chipArgs.type = ArchArgs::LFE5UM5G_25F;
|
||||
if (vm.count("um5g-45k"))
|
||||
chipArgs.type = ArchArgs::LFE5UM5G_45F;
|
||||
if (vm.count("um5g-85k"))
|
||||
chipArgs.type = ArchArgs::LFE5UM5G_85F;
|
||||
if (vm.count("package"))
|
||||
chipArgs.package = vm["package"].as<std::string>();
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user