Skip to content

Commit

Permalink
Added legacy support for old nextpnr files
Browse files Browse the repository at this point in the history
  • Loading branch information
mmicko committed May 19, 2023
1 parent 1989890 commit 18bad2a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions libtrellis/src/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,21 @@ DeviceLocator find_device_by_name(string name) {
return *found;
}

static string device_legacy_mapping(string variant)
{
if (variant == "LFE5U-12F") return "LFE5U-25F";
if (variant == "LFE5UM5G-25F") return "LFE5UM-25F";
if (variant == "LFE5UM5G-45F") return "LFE5UM-45F";
if (variant == "LFE5UM5G-85F") return "LFE5UM-85F";
return variant;
}

DeviceLocator find_device_by_name_and_variant(string name, string variant) {
if (variant.empty())
throw runtime_error("using old nexpnr with new trellis tools. ");
if (variant.empty()) {
fprintf(stderr, "warning: using old nexpnr with new trellis tools.\n");
variant = name;
name = device_legacy_mapping(variant);
}
auto found = find_device_generic([variant](const string &n, const pt::ptree &p) -> bool {
UNUSED(p);
return n == variant;
Expand Down
1 change: 1 addition & 0 deletions libtrellis/src/PyTrellis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ PYBIND11_MODULE (pytrellis, m)

class_<Chip>(m, "Chip")
.def(init<string>())
.def(init<string,string>())
.def(init<uint32_t>())
.def(init<const ChipInfo &>())
.def("get_tile_by_name", &Chip::get_tile_by_name)
Expand Down

0 comments on commit 18bad2a

Please sign in to comment.