From 3b49c20f4345f05bb92e6fc0a8dfa4c87c9cfa46 Mon Sep 17 00:00:00 2001 From: David Shah Date: Fri, 13 Mar 2020 11:22:11 +0000 Subject: [PATCH] ecp5: Proper support for '12k' device Signed-off-by: David Shah --- ecp5/arch.cc | 9 +++++++-- ecp5/arch.h | 1 + ecp5/bitstream.cc | 12 ++++++++---- ecp5/main.cc | 6 +++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ecp5/arch.cc b/ecp5/arch.cc index 0a44e020..3aed3ad4 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -106,7 +106,8 @@ Arch::Arch(ArchArgs args) : args(args) log_error("Unsupported ECP5 chip type.\n"); } #else - if (args.type == ArchArgs::LFE5U_25F || args.type == ArchArgs::LFE5UM_25F || args.type == ArchArgs::LFE5UM5G_25F) { + if (args.type == ArchArgs::LFE5U_12F || args.type == ArchArgs::LFE5U_25F || args.type == ArchArgs::LFE5UM_25F || + args.type == ArchArgs::LFE5UM5G_25F) { chip_info = get_chip_info(reinterpret_cast *>(chipdb_blob_25k)); } else if (args.type == ArchArgs::LFE5U_45F || args.type == ArchArgs::LFE5UM_45F || args.type == ArchArgs::LFE5UM5G_45F) { @@ -139,7 +140,9 @@ Arch::Arch(ArchArgs args) : args(args) std::string Arch::getChipName() const { - if (args.type == ArchArgs::LFE5U_25F) { + if (args.type == ArchArgs::LFE5U_12F) { + return "LFE5U-12F"; + } else if (args.type == ArchArgs::LFE5U_25F) { return "LFE5U-25F"; } else if (args.type == ArchArgs::LFE5U_45F) { return "LFE5U-45F"; @@ -186,6 +189,8 @@ std::string Arch::getFullChipName() const IdString Arch::archArgsToId(ArchArgs args) const { + if (args.type == ArchArgs::LFE5U_12F) + return id("lfe5u_12f"); if (args.type == ArchArgs::LFE5U_25F) return id("lfe5u_25f"); if (args.type == ArchArgs::LFE5U_45F) diff --git a/ecp5/arch.h b/ecp5/arch.h index 55494b1f..d57b5bc0 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -431,6 +431,7 @@ struct ArchArgs enum ArchArgsTypes { NONE, + LFE5U_12F, LFE5U_25F, LFE5U_45F, LFE5U_85F, diff --git a/ecp5/bitstream.cc b/ecp5/bitstream.cc index 1bdb4188..fd3de4ab 100644 --- a/ecp5/bitstream.cc +++ b/ecp5/bitstream.cc @@ -438,8 +438,8 @@ std::vector get_pll_tiles(Context *ctx, BelId bel) 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::LFE5U_25F || ctx->args.type == ArchArgs::LFE5U_45F || - ctx->args.type == ArchArgs::LFE5U_85F) { + if (ctx->args.type == ArchArgs::LFE5U_12F || ctx->args.type == ArchArgs::LFE5U_25F || + ctx->args.type == ArchArgs::LFE5U_45F || ctx->args.type == ArchArgs::LFE5U_85F) { std::map tiletype_xform; for (const auto &tile : cc.tiles) { std::string newname = tile.first; @@ -580,6 +580,10 @@ void write_bitstream(Context *ctx, std::string base_config_file, std::string tex config_file >> cc; } else { switch (ctx->args.type) { + case ArchArgs::LFE5U_12F: + BaseConfigs::config_empty_lfe5u_25f(cc); + cc.chip_name = "LFE5U-12F"; + break; case ArchArgs::LFE5U_25F: BaseConfigs::config_empty_lfe5u_25f(cc); break; @@ -1429,8 +1433,8 @@ void write_bitstream(Context *ctx, std::string base_config_file, std::string tex Loc loc = ctx->getBelLocation(ci->bel); bool u = loc.y<15, r = loc.x> 15; std::string tiletype = fmt_str("DDRDLL_" << (u ? 'U' : 'L') << (r ? 'R' : 'L')); - if ((ctx->args.type == ArchArgs::LFE5U_25F || ctx->args.type == ArchArgs::LFE5UM_25F || - ctx->args.type == ArchArgs::LFE5UM5G_25F) && + if ((ctx->args.type == ArchArgs::LFE5U_12F || ctx->args.type == ArchArgs::LFE5U_25F || + ctx->args.type == ArchArgs::LFE5UM_25F || ctx->args.type == ArchArgs::LFE5UM5G_25F) && u) tiletype += "A"; std::string tile = ctx->getTileByType(tiletype); diff --git a/ecp5/main.cc b/ecp5/main.cc index 24a98df4..a24011db 100644 --- a/ecp5/main.cc +++ b/ecp5/main.cc @@ -49,6 +49,7 @@ ECP5CommandHandler::ECP5CommandHandler(int argc, char **argv) : CommandHandler(a po::options_description ECP5CommandHandler::getArchOptions() { po::options_description specific("Architecture specific options"); + specific.add_options()("12k", "set device type to LFE5U-12F"); 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"); @@ -125,7 +126,8 @@ std::unique_ptr ECP5CommandHandler::createContext(std::unordered_map ECP5CommandHandler::createContext(std::unordered_map