1
0
mirror of https://github.com/YosysHQ/nextpnr.git synced 2026-01-13 07:20:04 +00:00

Gowin. Preparing to support the 5A series. (#1520)

* Gowin. Preparing to support the 5A series.

Family recognition is added, as well as minor fixes, but base generation
itself is not allowed for GW5 - this gives the ability to test the next
Apicula release and still not break installations for those who simply
specify `HIMBAECHEL_GOWIN_DEVICES = "all"`.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>

* Gowin. Recognize GW5A family chips.

Construct chip base name for

 - GW5A-LV25MG121C1/l0 - TangPrimer 25k

 - GW5AT-LV60PG484A - TangMega 60k

 - GW5AST-LV138PG484A - TangMega 138k

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>

---------

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
This commit is contained in:
YRabbit 2025-07-23 16:45:24 +10:00 committed by GitHub
parent 2d7d1e2408
commit 356278d068
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 13 deletions

View File

@ -129,14 +129,21 @@ void GowinImpl::init_database(Arch *arch)
if (GW2) {
log_error("For the GW2A series you need to specify --vopt family=GW2A-18 or --vopt family=GW2A-18C\n");
} else {
std::regex devicere = std::regex("GW1N([SZ]?)[A-Z]*-(LV|UV|UX)([0-9])(C?).*");
std::regex devicere = std::regex("GW5A(T|ST)?-LV(25|60|138)[A-Z]*.*");
std::smatch match;
if (!std::regex_match(args.device, match, devicere)) {
log_error("Invalid device %s\n", args.device.c_str());
}
family = stringf("GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str());
if (family.rfind("GW1N-9", 0) == 0) {
log_error("For the GW1N-9 series you need to specify --vopt family=GW1N-9 or --vopt family=GW1N-9C\n");
if (std::regex_match(args.device, match, devicere)) {
family = stringf("GW5A%s-%sA", match[1].str().c_str(), match[2].str().c_str());
} else {
std::regex devicere = std::regex("GW1N([SZ]?)[A-Z]*-(LV|UV|UX)([0-9])(C?).*");
std::smatch match;
if (!std::regex_match(args.device, match, devicere)) {
log_error("Invalid device %s\n", args.device.c_str());
}
family = stringf("GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str());
if (family.rfind("GW1N-9", 0) == 0) {
log_error("For the GW1N-9 series you need to specify --vopt family=GW1N-9 or --vopt "
"family=GW1N-9C\n");
}
}
}
}
@ -175,17 +182,17 @@ void GowinImpl::init(Context *ctx)
spd = ctx->id(match[2]);
ctx->set_speed_grade(match[2]);
} else {
if (pn.length() > 2 && pn.compare(pn.length() - 2, 2, "ES")) {
package_idx = ctx->id(pn.substr(pn.length() - 2));
if (pn.length() > 2 && pn.compare(pn.length() - 3, 2, "ES")) {
package_idx = ctx->id(pn.substr(0, pn.length() - 2));
spd = ctx->id("ES");
ctx->set_speed_grade("ES");
}
}
// log_info("packages:%ld\n", ctx->chip_info->packages.ssize());
// log_info("search for %s, packages:%ld\n", package_idx.c_str(ctx), ctx->chip_info->packages.ssize());
for (int i = 0; i < ctx->chip_info->packages.ssize(); ++i) {
// log_info("i:%d %s\n", i, IdString(ctx->chip_info->packages[i].name).c_str(ctx));
if (IdString(ctx->chip_info->packages[i].name) == package_idx) {
// log_info("i:%d %s\n", i, package_idx.c_str(ctx));
ctx->package_info = &ctx->chip_info->packages[i];
break;
}

View File

@ -512,7 +512,7 @@ def create_switch_matrix(tt: TileType, db: chipdb, x: int, y: int):
tt.create_pip(src, dst, get_tm_class(db, src))
# clock wires
for dst, srcs in db.grid[y][x].pure_clock_pips.items():
for dst, srcs in db.grid[y][x].clock_pips.items():
if not tt.has_wire(dst):
tt.create_wire(dst, "GLOBAL_CLK")
for src in srcs.keys():
@ -1426,7 +1426,7 @@ def create_timing_info(chip: Chip, db: chipdb.Device):
return TimingValue(min(ff, fr, rf, rr), max(ff, fr, rf, rr))
speed_grades = []
for speed, _ in db.timing.items():
for speed in db.timing.keys():
speed_grades.append(speed)
tmg = chip.set_speed_grades(speed_grades)