From 04776b5cb27de2c0ca88c45ea632f68fdd59fb3e Mon Sep 17 00:00:00 2001 From: Alessandro Comodi Date: Mon, 21 Mar 2022 10:42:57 +0100 Subject: [PATCH] lib: tile segbits: add debug prints upon exceptions Signed-off-by: Alessandro Comodi --- prjxray/tile_segbits.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/prjxray/tile_segbits.py b/prjxray/tile_segbits.py index 5564a4b8d..313383833 100644 --- a/prjxray/tile_segbits.py +++ b/prjxray/tile_segbits.py @@ -85,15 +85,28 @@ def __init__(self, tile_db): if tile_db.ppips is not None: with OpenSafeFile(tile_db.ppips) as f: - self.ppips = read_ppips(f) + try: + self.ppips = read_ppips(f) + except Exception as e: + print(f"Error reading ppips from {tile_db.ppips}: {e}") + exit(1) if tile_db.segbits is not None: with OpenSafeFile(tile_db.segbits) as f: - self.segbits[BlockType.CLB_IO_CLK] = read_segbits(f) + try: + self.segbits[BlockType.CLB_IO_CLK] = read_segbits(f) + except Exception as e: + print(f"Error reading segbits from {tile_db.segbits}: {e}") + exit(1) + if tile_db.block_ram_segbits is not None: with OpenSafeFile(tile_db.block_ram_segbits) as f: - self.segbits[BlockType.BLOCK_RAM] = read_segbits(f) + try: + self.segbits[BlockType.BLOCK_RAM] = read_segbits(f) + except Exception as e: + print(f"Error reading ram segbits from {tile_db.block_ram_segbits}: {e}") + exit(1) for block_type in self.segbits: for feature in self.segbits[block_type]: