aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-12-18 21:38:52 +0000
committerGitHub <noreply@github.com>2021-12-18 21:38:52 +0000
commit4a3847765ca1e511cf1ee91f2d1e438565091745 (patch)
treef188696564beb070b6cc5839fdc553f3d31779ed
parent673faea230ab63367a092decd4b822aa011028d9 (diff)
parent9b2d6c5a67f0774bc41f0bc6cdb6a71bbcc388e8 (diff)
downloadnextpnr-4a3847765ca1e511cf1ee91f2d1e438565091745.tar.gz
nextpnr-4a3847765ca1e511cf1ee91f2d1e438565091745.tar.bz2
nextpnr-4a3847765ca1e511cf1ee91f2d1e438565091745.zip
Merge pull request #881 from uis246/regex
Tidy gowin modification regex
-rw-r--r--gowin/main.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/gowin/main.cc b/gowin/main.cc
index cbd62ed9..66de26aa 100644
--- a/gowin/main.cc
+++ b/gowin/main.cc
@@ -54,7 +54,7 @@ po::options_description GowinCommandHandler::getArchOptions()
std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Property> &values)
{
- std::regex devicere = std::regex("GW1N([A-Z]*)-(LV|UV|UX)([0-9])(C?).*");
+ std::regex devicere = std::regex("GW1N(S?)[A-Z]*-(LV|UV|UX)([0-9])(C?).*");
std::smatch match;
std::string device = vm["device"].as<std::string>();
if (!std::regex_match(device, match, devicere)) {
@@ -65,11 +65,7 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Pr
// GW1N and GW1NR variants share the same database.
// Most Gowin devices are a System in Package with some SDRAM wirebonded to a GPIO bank.
// However, it appears that the S series with embedded ARM core are unique silicon.
- if (match[1].str().length() && match[1].str()[0] == 'S') {
- snprintf(buf, 36, "GW1NS-%s", match[3].str().c_str());
- } else {
- snprintf(buf, 36, "GW1N-%s", match[3].str().c_str());
- }
+ snprintf(buf, 36, "GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str());
chipArgs.family = buf;
chipArgs.partnumber = match[0];
return std::unique_ptr<Context>(new Context(chipArgs));