gowin: Check the chipdb version

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
This commit is contained in:
YRabbit 2021-11-07 09:05:34 +10:00
parent 2a27085ecb
commit deb14762aa
2 changed files with 7 additions and 1 deletions

View File

@ -674,8 +674,12 @@ Arch::Arch(ArchArgs args) : args(args)
// Load database
std::string chipdb = stringf("gowin/chipdb-%s.bin", family.c_str());
auto db = reinterpret_cast<const DatabasePOD *>(get_chipdb(chipdb));
if (db == nullptr)
if (db == nullptr) {
log_error("Failed to load chipdb '%s'\n", chipdb.c_str());
}
if (db->version != chipdb_version) {
log_error("Incorrect chipdb version %u is used. Version %u is required\n", db->version, chipdb_version);
}
if (db->family.get() != family) {
log_error("Database is for family '%s' but provided device is family '%s'.\n", db->family.get(),
family.c_str());

View File

@ -454,6 +454,8 @@ struct Arch : BaseArch<ArchRanges>
bool cellsCompatible(const CellInfo **cells, int count) const;
// start Z for the MUX2LUT5 bels
int const mux_0_z = 10;
// chip db version
unsigned int const chipdb_version = 1;
std::vector<IdString> cell_types;