gowin: add an option to manually specify family

In the vendor IDE, there's a device family named GW1N-9C (which seems to
mean C revision of GW1N-9), in which the model numbers are all the same
with GW1N-9.

Add an option to nextpnr-gowin to allow manually specified family for
this situation.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
This commit is contained in:
Icenowy Zheng 2022-01-24 23:54:09 +08:00 committed by Pepijn de Vos
parent 4b72f02255
commit 230de1e68a

View File

@ -48,6 +48,7 @@ po::options_description GowinCommandHandler::getArchOptions()
{ {
po::options_description specific("Architecture specific options"); po::options_description specific("Architecture specific options");
specific.add_options()("device", po::value<std::string>(), "device name"); specific.add_options()("device", po::value<std::string>(), "device name");
specific.add_options()("family", po::value<std::string>(), "family name");
specific.add_options()("cst", po::value<std::string>(), "physical constraints file"); specific.add_options()("cst", po::value<std::string>(), "physical constraints file");
return specific; return specific;
} }
@ -62,12 +63,16 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Pr
} }
ArchArgs chipArgs; ArchArgs chipArgs;
chipArgs.gui = vm.count("gui") != 0; chipArgs.gui = vm.count("gui") != 0;
char buf[36]; if (vm.count("family")) {
// GW1N and GW1NR variants share the same database. chipArgs.family = vm["family"].as<std::string>();
// Most Gowin devices are a System in Package with some SDRAM wirebonded to a GPIO bank. } else {
// However, it appears that the S series with embedded ARM core are unique silicon. char buf[36];
snprintf(buf, 36, "GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str()); // GW1N and GW1NR variants share the same database.
chipArgs.family = buf; // 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.
snprintf(buf, 36, "GW1N%s-%s", match[1].str().c_str(), match[3].str().c_str());
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));
} }