Skip to content

Commit 18bad2a

Browse files
committed
Added legacy support for old nextpnr files
1 parent 1989890 commit 18bad2a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

libtrellis/src/Database.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,21 @@ DeviceLocator find_device_by_name(string name) {
6363
return *found;
6464
}
6565

66+
static string device_legacy_mapping(string variant)
67+
{
68+
if (variant == "LFE5U-12F") return "LFE5U-25F";
69+
if (variant == "LFE5UM5G-25F") return "LFE5UM-25F";
70+
if (variant == "LFE5UM5G-45F") return "LFE5UM-45F";
71+
if (variant == "LFE5UM5G-85F") return "LFE5UM-85F";
72+
return variant;
73+
}
74+
6675
DeviceLocator find_device_by_name_and_variant(string name, string variant) {
67-
if (variant.empty())
68-
throw runtime_error("using old nexpnr with new trellis tools. ");
76+
if (variant.empty()) {
77+
fprintf(stderr, "warning: using old nexpnr with new trellis tools.\n");
78+
variant = name;
79+
name = device_legacy_mapping(variant);
80+
}
6981
auto found = find_device_generic([variant](const string &n, const pt::ptree &p) -> bool {
7082
UNUSED(p);
7183
return n == variant;

libtrellis/src/PyTrellis.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ PYBIND11_MODULE (pytrellis, m)
156156

157157
class_<Chip>(m, "Chip")
158158
.def(init<string>())
159+
.def(init<string,string>())
159160
.def(init<uint32_t>())
160161
.def(init<const ChipInfo &>())
161162
.def("get_tile_by_name", &Chip::get_tile_by_name)

0 commit comments

Comments
 (0)