ecp5: Proper support for '12k' device

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah 2020-03-13 11:22:11 +00:00
parent bb73580209
commit 3b49c20f43
4 changed files with 21 additions and 7 deletions

View File

@ -106,7 +106,8 @@ Arch::Arch(ArchArgs args) : args(args)
log_error("Unsupported ECP5 chip type.\n"); log_error("Unsupported ECP5 chip type.\n");
} }
#else #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<const RelPtr<ChipInfoPOD> *>(chipdb_blob_25k)); chip_info = get_chip_info(reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_25k));
} else if (args.type == ArchArgs::LFE5U_45F || args.type == ArchArgs::LFE5UM_45F || } else if (args.type == ArchArgs::LFE5U_45F || args.type == ArchArgs::LFE5UM_45F ||
args.type == ArchArgs::LFE5UM5G_45F) { args.type == ArchArgs::LFE5UM5G_45F) {
@ -139,7 +140,9 @@ Arch::Arch(ArchArgs args) : args(args)
std::string Arch::getChipName() const 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"; return "LFE5U-25F";
} else if (args.type == ArchArgs::LFE5U_45F) { } else if (args.type == ArchArgs::LFE5U_45F) {
return "LFE5U-45F"; return "LFE5U-45F";
@ -186,6 +189,8 @@ std::string Arch::getFullChipName() const
IdString Arch::archArgsToId(ArchArgs args) const IdString Arch::archArgsToId(ArchArgs args) const
{ {
if (args.type == ArchArgs::LFE5U_12F)
return id("lfe5u_12f");
if (args.type == ArchArgs::LFE5U_25F) if (args.type == ArchArgs::LFE5U_25F)
return id("lfe5u_25f"); return id("lfe5u_25f");
if (args.type == ArchArgs::LFE5U_45F) if (args.type == ArchArgs::LFE5U_45F)

View File

@ -431,6 +431,7 @@ struct ArchArgs
enum ArchArgsTypes enum ArchArgsTypes
{ {
NONE, NONE,
LFE5U_12F,
LFE5U_25F, LFE5U_25F,
LFE5U_45F, LFE5U_45F,
LFE5U_85F, LFE5U_85F,

View File

@ -438,8 +438,8 @@ std::vector<std::string> get_pll_tiles(Context *ctx, BelId bel)
void fix_tile_names(Context *ctx, ChipConfig &cc) void fix_tile_names(Context *ctx, ChipConfig &cc)
{ {
// Remove the V prefix/suffix on certain tiles if device is a SERDES variant // 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 || if (ctx->args.type == ArchArgs::LFE5U_12F || ctx->args.type == ArchArgs::LFE5U_25F ||
ctx->args.type == ArchArgs::LFE5U_85F) { ctx->args.type == ArchArgs::LFE5U_45F || ctx->args.type == ArchArgs::LFE5U_85F) {
std::map<std::string, std::string> tiletype_xform; std::map<std::string, std::string> tiletype_xform;
for (const auto &tile : cc.tiles) { for (const auto &tile : cc.tiles) {
std::string newname = tile.first; 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; config_file >> cc;
} else { } else {
switch (ctx->args.type) { switch (ctx->args.type) {
case ArchArgs::LFE5U_12F:
BaseConfigs::config_empty_lfe5u_25f(cc);
cc.chip_name = "LFE5U-12F";
break;
case ArchArgs::LFE5U_25F: case ArchArgs::LFE5U_25F:
BaseConfigs::config_empty_lfe5u_25f(cc); BaseConfigs::config_empty_lfe5u_25f(cc);
break; break;
@ -1429,8 +1433,8 @@ void write_bitstream(Context *ctx, std::string base_config_file, std::string tex
Loc loc = ctx->getBelLocation(ci->bel); Loc loc = ctx->getBelLocation(ci->bel);
bool u = loc.y<15, r = loc.x> 15; bool u = loc.y<15, r = loc.x> 15;
std::string tiletype = fmt_str("DDRDLL_" << (u ? 'U' : 'L') << (r ? 'R' : 'L')); 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 || if ((ctx->args.type == ArchArgs::LFE5U_12F || ctx->args.type == ArchArgs::LFE5U_25F ||
ctx->args.type == ArchArgs::LFE5UM5G_25F) && ctx->args.type == ArchArgs::LFE5UM_25F || ctx->args.type == ArchArgs::LFE5UM5G_25F) &&
u) u)
tiletype += "A"; tiletype += "A";
std::string tile = ctx->getTileByType(tiletype); std::string tile = ctx->getTileByType(tiletype);

View File

@ -49,6 +49,7 @@ ECP5CommandHandler::ECP5CommandHandler(int argc, char **argv) : CommandHandler(a
po::options_description ECP5CommandHandler::getArchOptions() po::options_description ECP5CommandHandler::getArchOptions()
{ {
po::options_description specific("Architecture specific options"); 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()("25k", "set device type to LFE5U-25F");
specific.add_options()("45k", "set device type to LFE5U-45F"); specific.add_options()("45k", "set device type to LFE5U-45F");
specific.add_options()("85k", "set device type to LFE5U-85F"); specific.add_options()("85k", "set device type to LFE5U-85F");
@ -125,7 +126,8 @@ std::unique_ptr<Context> ECP5CommandHandler::createContext(std::unordered_map<st
{ {
ArchArgs chipArgs; ArchArgs chipArgs;
chipArgs.type = ArchArgs::NONE; chipArgs.type = ArchArgs::NONE;
if (vm.count("12k"))
chipArgs.type = ArchArgs::LFE5U_12F;
if (vm.count("25k")) if (vm.count("25k"))
chipArgs.type = ArchArgs::LFE5U_25F; chipArgs.type = ArchArgs::LFE5U_25F;
if (vm.count("45k")) if (vm.count("45k"))
@ -179,6 +181,8 @@ std::unique_ptr<Context> ECP5CommandHandler::createContext(std::unordered_map<st
if (chipArgs.type != ArchArgs::NONE) if (chipArgs.type != ArchArgs::NONE)
log_error("Overriding architecture is unsuported.\n"); log_error("Overriding architecture is unsuported.\n");
if (arch_type == "lfe5u_12f")
chipArgs.type = ArchArgs::LFE5U_12F;
if (arch_type == "lfe5u_25f") if (arch_type == "lfe5u_25f")
chipArgs.type = ArchArgs::LFE5U_25F; chipArgs.type = ArchArgs::LFE5U_25F;
if (arch_type == "lfe5u_45f") if (arch_type == "lfe5u_45f")