From 50cd305d48ef807aec9ad775a5d5433cfef3a7fd Mon Sep 17 00:00:00 2001 From: YRabbit Date: Wed, 23 Jul 2025 08:40:42 +1000 Subject: [PATCH] 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 --- himbaechel/uarch/gowin/gowin.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/himbaechel/uarch/gowin/gowin.cc b/himbaechel/uarch/gowin/gowin.cc index ef2d8ed8..76446786 100644 --- a/himbaechel/uarch/gowin/gowin.cc +++ b/himbaechel/uarch/gowin/gowin.cc @@ -129,8 +129,10 @@ 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 { - if (args.device.rfind("GW5A", 0) == 0) { - family = "GW5A-25A"; + 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)) { + 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;