ecp5: Add an error for out-of-sync constids and bba
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
371d33146f
commit
475fcd4425
@ -117,6 +117,9 @@ Arch::Arch(ArchArgs args) : args(args)
|
|||||||
log_error("Unsupported ECP5 chip type.\n");
|
log_error("Unsupported ECP5 chip type.\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (chip_info->const_id_count != DB_CONST_ID_COUNT)
|
||||||
|
log_error("Chip database 'bba' and nextpnr code are out of sync; please rebuild (or contact distribution "
|
||||||
|
"maintainer)!\n");
|
||||||
package_info = nullptr;
|
package_info = nullptr;
|
||||||
for (int i = 0; i < chip_info->num_packages; i++) {
|
for (int i = 0; i < chip_info->num_packages; i++) {
|
||||||
if (args.package == chip_info->package_info[i].name.get()) {
|
if (args.package == chip_info->package_info[i].name.get()) {
|
||||||
|
@ -194,6 +194,7 @@ NPNR_PACKED_STRUCT(struct ChipInfoPOD {
|
|||||||
int32_t num_tiles;
|
int32_t num_tiles;
|
||||||
int32_t num_location_types;
|
int32_t num_location_types;
|
||||||
int32_t num_packages, num_pios;
|
int32_t num_packages, num_pios;
|
||||||
|
int32_t const_id_count;
|
||||||
RelPtr<LocationTypePOD> locations;
|
RelPtr<LocationTypePOD> locations;
|
||||||
RelPtr<int32_t> location_type;
|
RelPtr<int32_t> location_type;
|
||||||
RelPtr<GlobalInfoPOD> location_glbinfo;
|
RelPtr<GlobalInfoPOD> location_glbinfo;
|
||||||
|
@ -58,6 +58,8 @@ enum ConstIds
|
|||||||
#define X(t) , ID_##t
|
#define X(t) , ID_##t
|
||||||
#include "constids.inc"
|
#include "constids.inc"
|
||||||
#undef X
|
#undef X
|
||||||
|
,
|
||||||
|
DB_CONST_ID_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
#define X(t) static constexpr auto id_##t = IdString(ID_##t);
|
#define X(t) static constexpr auto id_##t = IdString(ID_##t);
|
||||||
|
@ -441,6 +441,7 @@ def write_database(dev_name, chip, ddrg, endianness):
|
|||||||
bba.u32(len(location_types), "num_location_types")
|
bba.u32(len(location_types), "num_location_types")
|
||||||
bba.u32(len(packages), "num_packages")
|
bba.u32(len(packages), "num_packages")
|
||||||
bba.u32(len(pindata), "num_pios")
|
bba.u32(len(pindata), "num_pios")
|
||||||
|
bba.u32(const_id_count, "const_id_count")
|
||||||
|
|
||||||
bba.r("locations", "locations")
|
bba.r("locations", "locations")
|
||||||
bba.r("location_types", "location_type")
|
bba.r("location_types", "location_type")
|
||||||
@ -457,11 +458,12 @@ def write_database(dev_name, chip, ddrg, endianness):
|
|||||||
dev_names = {"25k": "LFE5UM5G-25F", "45k": "LFE5UM5G-45F", "85k": "LFE5UM5G-85F"}
|
dev_names = {"25k": "LFE5UM5G-25F", "45k": "LFE5UM5G-45F", "85k": "LFE5UM5G-85F"}
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global max_row, max_col
|
global max_row, max_col, const_id_count
|
||||||
pytrellis.load_database(database.get_db_root())
|
pytrellis.load_database(database.get_db_root())
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Read port pin file
|
# Read port pin file
|
||||||
|
const_id_count = 1 # count ID_NONE
|
||||||
with open(args.constids) as f:
|
with open(args.constids) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
line = line.replace("(", " ")
|
line = line.replace("(", " ")
|
||||||
@ -473,7 +475,7 @@ def main():
|
|||||||
assert line[0] == "X"
|
assert line[0] == "X"
|
||||||
idx = len(constids) + 1
|
idx = len(constids) + 1
|
||||||
constids[line[1]] = idx
|
constids[line[1]] = idx
|
||||||
|
const_id_count += 1
|
||||||
|
|
||||||
constids["SLICE"] = constids["TRELLIS_SLICE"]
|
constids["SLICE"] = constids["TRELLIS_SLICE"]
|
||||||
constids["PIO"] = constids["TRELLIS_IO"]
|
constids["PIO"] = constids["TRELLIS_IO"]
|
||||||
|
Loading…
Reference in New Issue
Block a user