Merge pull request #881 from uis246/regex
Tidy gowin modification regex
This commit is contained in:
commit
4a3847765c
@ -54,7 +54,7 @@ po::options_description GowinCommandHandler::getArchOptions()
|
|||||||
|
|
||||||
std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Property> &values)
|
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::smatch match;
|
||||||
std::string device = vm["device"].as<std::string>();
|
std::string device = vm["device"].as<std::string>();
|
||||||
if (!std::regex_match(device, match, devicere)) {
|
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.
|
// GW1N and GW1NR variants share the same database.
|
||||||
// Most Gowin devices are a System in Package with some SDRAM wirebonded to a GPIO bank.
|
// 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.
|
// 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, "GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str());
|
||||||
snprintf(buf, 36, "GW1NS-%s", match[3].str().c_str());
|
|
||||||
} else {
|
|
||||||
snprintf(buf, 36, "GW1N-%s", match[3].str().c_str());
|
|
||||||
}
|
|
||||||
chipArgs.family = buf;
|
chipArgs.family = buf;
|
||||||
chipArgs.partnumber = match[0];
|
chipArgs.partnumber = match[0];
|
||||||
return std::unique_ptr<Context>(new Context(chipArgs));
|
return std::unique_ptr<Context>(new Context(chipArgs));
|
||||||
|
Loading…
Reference in New Issue
Block a user