add support for GW1NS-2 family

Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
This commit is contained in:
Gwenhael Goavec-Merou 2021-06-18 09:20:24 +02:00
parent 8a9fb81036
commit 96263058c3
2 changed files with 7 additions and 6 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
project(chipdb-gowin NONE) project(chipdb-gowin NONE)
set(ALL_GOWIN_DEVICES GW1N-1 GW1N-4 GW1N-9) set(ALL_GOWIN_DEVICES GW1N-1 GW1N-4 GW1N-9 GW1NS-2)
set(GOWIN_DEVICES ${ALL_GOWIN_DEVICES} CACHE STRING set(GOWIN_DEVICES ${ALL_GOWIN_DEVICES} CACHE STRING
"Include support for these Gowin devices (available: ${ALL_GOWIN_DEVICES})") "Include support for these Gowin devices (available: ${ALL_GOWIN_DEVICES})")
message(STATUS "Enabled Gowin devices: ${GOWIN_DEVICES}") message(STATUS "Enabled Gowin devices: ${GOWIN_DEVICES}")

View File

@ -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)([0-9])([A-Z]{2}[0-9]+)(C[0-9]/I[0-9])"); std::regex devicere = std::regex("GW1N([A-Z]*)-(LV|UV|UX)([0-9])(C?)([A-Z]{2}[0-9]+)(C[0-9]/I[0-9])");
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)) {
@ -62,12 +62,13 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Pr
} }
ArchArgs chipArgs; ArchArgs chipArgs;
char buf[36]; char buf[36];
snprintf(buf, 36, "GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str()); snprintf(buf, 36, "GW1N%s-%s%s", match[1].str().c_str(), match[3].str().c_str(),
match[4].str().c_str());
chipArgs.device = buf; chipArgs.device = buf;
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.family = buf;
chipArgs.package = match[4]; chipArgs.package = match[5];
chipArgs.speed = match[5]; chipArgs.speed = match[6];
return std::unique_ptr<Context>(new Context(chipArgs)); return std::unique_ptr<Context>(new Context(chipArgs));
} }