5 #ifndef OPENTITAN_SW_DEVICE_LIB_RUNTIME_IBEX_H_
6 #define OPENTITAN_SW_DEVICE_LIB_RUNTIME_IBEX_H_
32 kIbexExcInstrMisaligned = 0,
33 kIbexExcInstrAccessFault = 1,
34 kIbexExcIllegalInstrFault = 2,
35 kIbexExcBreakpoint = 3,
36 kIbexExcLoadAccessFault = 5,
37 kIbexExcStoreAccessFault = 7,
38 kIbexExcUserECall = 8,
39 kIbexExcMachineECall = 11,
49 kIbexInternalIrqLoadInteg = 0xffffffe0,
50 kIbexInternalIrqNmi = 0x8000001f
79 uint32_t cycle_low = 0;
80 uint32_t cycle_high = 0;
81 uint32_t cycle_high_2 = 0;
89 :
"=r"(cycle_high),
"=r"(cycle_low),
"=r"(cycle_high_2)
91 return (uint64_t)cycle_high << 32 | cycle_low;
215 #define IBEX_SPIN_FOR(expr, timeout_usec) \
217 const ibex_timeout_t timeout_ = ibex_timeout_init(timeout_usec); \
219 CHECK(!ibex_timeout_check(&timeout_), \
220 "Timed out after %d usec (%d CPU cycles) waiting for " #expr, \
221 (uint32_t)timeout_usec, (uint32_t)timeout_.cycles); \
232 #define IBEX_TRY_SPIN_FOR(expr, timeout_usec) \
234 const ibex_timeout_t timeout_ = ibex_timeout_init(timeout_usec); \
236 if (ibex_timeout_check(&timeout_)) { \
237 return DEADLINE_EXCEEDED(); \
242 #endif // OPENTITAN_SW_DEVICE_LIB_RUNTIME_IBEX_H_