gowin: Use speed from chip base.
Another simplification of the input regular expression, now the speed is taken from the base. Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
This commit is contained in:
parent
0e8a2999bd
commit
74b4f69728
@ -670,7 +670,6 @@ void Arch::addMuxBels(const DatabasePOD *db, int row, int col)
|
||||
Arch::Arch(ArchArgs args) : args(args)
|
||||
{
|
||||
family = args.family;
|
||||
device = args.device;
|
||||
|
||||
// Load database
|
||||
std::string chipdb = stringf("gowin/chipdb-%s.bin", family.c_str());
|
||||
@ -685,22 +684,11 @@ Arch::Arch(ArchArgs args) : args(args)
|
||||
for (size_t i = 0; i < db->num_ids; i++) {
|
||||
IdString::initialize_add(this, db->id_strs[i].get(), uint32_t(i) + db->num_constids);
|
||||
}
|
||||
// setup timing info
|
||||
speed = nullptr;
|
||||
for (unsigned int i = 0; i < db->num_speeds; i++) {
|
||||
const TimingClassPOD *tc = &db->speeds[i];
|
||||
// std::cout << IdString(tc->name_id).str(this) << std::endl;
|
||||
if (IdString(tc->name_id) == id(args.speed)) {
|
||||
speed = tc->groups.get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (speed == nullptr) {
|
||||
log_error("Unsuported speed grade '%s'.\n", args.speed.c_str());
|
||||
}
|
||||
|
||||
// setup package
|
||||
IdString package_name;
|
||||
IdString device_id;
|
||||
IdString speed_id;
|
||||
for (unsigned int i = 0; i < db->num_partnumbers; i++) {
|
||||
auto partnumber = &db->partnumber_packages[i];
|
||||
// std::cout << IdString(partnumber->name_id).str(this) << IdString(partnumber->package_id).str(this) <<
|
||||
@ -708,9 +696,27 @@ Arch::Arch(ArchArgs args) : args(args)
|
||||
if (IdString(partnumber->name_id) == id(args.partnumber)) {
|
||||
package_name = IdString(partnumber->package_id);
|
||||
device_id = IdString(partnumber->device_id);
|
||||
speed_id = IdString(partnumber->speed_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (package_name == IdString()) {
|
||||
log_error("Unsuported partnumber '%s'.\n", args.partnumber.c_str());
|
||||
}
|
||||
|
||||
// setup timing info
|
||||
speed = nullptr;
|
||||
for (unsigned int i = 0; i < db->num_speeds; i++) {
|
||||
const TimingClassPOD *tc = &db->speeds[i];
|
||||
// std::cout << IdString(tc->name_id).str(this) << std::endl;
|
||||
if (IdString(tc->name_id) == speed_id) {
|
||||
speed = tc->groups.get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (speed == nullptr) {
|
||||
log_error("Unsuported speed grade '%s'.\n", speed_id.c_str(this));
|
||||
}
|
||||
|
||||
const VariantPOD *variant = nullptr;
|
||||
for (unsigned int i = 0; i < db->num_variants; i++) {
|
||||
@ -742,6 +748,11 @@ Arch::Arch(ArchArgs args) : args(args)
|
||||
if (package == nullptr) {
|
||||
log_error("Unsuported package '%s'.\n", package_name.c_str(this));
|
||||
}
|
||||
|
||||
//
|
||||
log_info("Series:%s Device:%s Package:%s Speed:%s\n", family.c_str(), device_id.c_str(this),
|
||||
package_name.c_str(this), speed_id.c_str(this));
|
||||
|
||||
// setup db
|
||||
char buf[32];
|
||||
// The reverse order of the enumeration simplifies the creation
|
||||
|
@ -135,6 +135,7 @@ NPNR_PACKED_STRUCT(struct PartnumberPOD {
|
||||
uint32_t name_id;
|
||||
uint32_t package_id;
|
||||
uint32_t device_id;
|
||||
uint32_t speed_id;
|
||||
});
|
||||
|
||||
NPNR_PACKED_STRUCT(struct PackagePOD {
|
||||
@ -170,9 +171,7 @@ NPNR_PACKED_STRUCT(struct DatabasePOD {
|
||||
|
||||
struct ArchArgs
|
||||
{
|
||||
std::string device;
|
||||
std::string family;
|
||||
std::string speed;
|
||||
std::string partnumber;
|
||||
// y = mx + c relationship between distance and delay for interconnect
|
||||
// delay estimates
|
||||
|
@ -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?)([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?).*");
|
||||
std::smatch match;
|
||||
std::string device = vm["device"].as<std::string>();
|
||||
if (!std::regex_match(device, match, devicere)) {
|
||||
@ -62,8 +62,6 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Pr
|
||||
}
|
||||
ArchArgs chipArgs;
|
||||
char buf[36];
|
||||
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;
|
||||
// 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.
|
||||
@ -74,7 +72,6 @@ std::unique_ptr<Context> GowinCommandHandler::createContext(dict<std::string, Pr
|
||||
}
|
||||
chipArgs.family = buf;
|
||||
chipArgs.partnumber = match[0];
|
||||
chipArgs.speed = match[6];
|
||||
return std::unique_ptr<Context>(new Context(chipArgs));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user