gowin: Add support for GW2A series chips
* Limited to Tangprimer 20k or GW2A-LV18PG256C8/I7 chip. * Clock lines are disabled. Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
This commit is contained in:
parent
cbd6496d35
commit
1260f2f7d7
@ -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 GW1NZ-1 GW1N-4 GW1N-9 GW1N-9C GW1NS-2 GW1NS-4)
|
set(ALL_GOWIN_DEVICES GW1N-1 GW1NZ-1 GW1N-4 GW1N-9 GW1N-9C GW1NS-2 GW1NS-4 GW2A-18)
|
||||||
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}")
|
||||||
|
@ -66,7 +66,9 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Pr
|
|||||||
std::regex devicere = std::regex("GW1N([SZ]?)[A-Z]*-(LV|UV|UX)([0-9])(C?).*");
|
std::regex devicere = std::regex("GW1N([SZ]?)[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)) {
|
bool GW2 = device == "GW2A-LV18PG256C8/I7";
|
||||||
|
|
||||||
|
if (!GW2 && !std::regex_match(device, match, devicere)) {
|
||||||
log_error("Invalid device %s\n", device.c_str());
|
log_error("Invalid device %s\n", device.c_str());
|
||||||
}
|
}
|
||||||
ArchArgs chipArgs;
|
ArchArgs chipArgs;
|
||||||
@ -74,14 +76,22 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Pr
|
|||||||
if (vm.count("family")) {
|
if (vm.count("family")) {
|
||||||
chipArgs.family = vm["family"].as<std::string>();
|
chipArgs.family = vm["family"].as<std::string>();
|
||||||
} else {
|
} else {
|
||||||
char buf[36];
|
if (!GW2) {
|
||||||
// GW1N and GW1NR variants share the same database.
|
char buf[36];
|
||||||
// Most Gowin devices are a System in Package with some SDRAM wirebonded to a GPIO bank.
|
// GW1N and GW1NR variants share the same database.
|
||||||
// However, it appears that the S series with embedded ARM core are unique silicon.
|
// Most Gowin devices are a System in Package with some SDRAM wirebonded to a GPIO bank.
|
||||||
snprintf(buf, 36, "GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str());
|
// However, it appears that the S series with embedded ARM core are unique silicon.
|
||||||
chipArgs.family = buf;
|
snprintf(buf, 36, "GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str());
|
||||||
|
chipArgs.family = buf;
|
||||||
|
} else {
|
||||||
|
chipArgs.family = "GW2A-18";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!GW2) {
|
||||||
|
chipArgs.partnumber = match[0];
|
||||||
|
} else {
|
||||||
|
chipArgs.partnumber = device;
|
||||||
}
|
}
|
||||||
chipArgs.partnumber = match[0];
|
|
||||||
|
|
||||||
auto ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
auto ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
||||||
// routing options
|
// routing options
|
||||||
@ -93,6 +103,10 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Pr
|
|||||||
if (vm.count("enable-auto-longwires")) {
|
if (vm.count("enable-auto-longwires")) {
|
||||||
ctx->settings[ctx->id("arch.enable-auto-longwires")] = 1;
|
ctx->settings[ctx->id("arch.enable-auto-longwires")] = 1;
|
||||||
}
|
}
|
||||||
|
// XXX disable clock lines for now
|
||||||
|
if (GW2) {
|
||||||
|
ctx->settings[ctx->id("arch.enable-globals")] = 0;
|
||||||
|
}
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user