firmware: sync exception names and ids

This commit is contained in:
abdul124 2024-08-21 17:17:39 +08:00
parent 6e6c1f850b
commit c0ab42d52d
1 changed files with 20 additions and 12 deletions

View File

@ -405,19 +405,27 @@ extern fn stop_fn(_version: c_int,
} }
} }
// Must be kept in sync with preallocate_runtime_exception_names() in artiq/language/embedding_map.py // Must be kept in sync with preallocate_runtime_exception_names() in `artiq.compiler.embedding`
static EXCEPTION_ID_LOOKUP: [(&str, u32); 11] = [ static EXCEPTION_ID_LOOKUP: [(&str, u32); 19] = [
("RuntimeError", 0), ("RTIOUnderflow", 0),
("RTIOUnderflow", 1), ("RTIOOverflow", 1),
("RTIOOverflow", 2), ("RTIODestinationUnreachable", 2),
("RTIODestinationUnreachable", 3), ("DMAError", 3),
("DMAError", 4), ("I2CError", 4),
("I2CError", 5), ("CacheError", 5),
("CacheError", 6), ("SPIError", 6),
("SPIError", 7), ("AssertionError", 7),
("ZeroDivisionError", 8), ("AttributeError", 8),
("IndexError", 9), ("IndexError", 9),
("UnwrapNoneError", 10), ("IOError", 10),
("KeyError", 11),
("NotImplementedError", 12),
("OverflowError", 13),
("RuntimeError", 14),
("TimeoutError", 15),
("TypeError", 16),
("ValueError", 17),
("ZeroDivisionError", 18),
]; ];
pub fn get_exception_id(name: &str) -> u32 { pub fn get_exception_id(name: &str) -> u32 {