11 #include "sw/device/lib/testing/test_framework/check.h"
13 #define MODULE_ID MAKE_MODULE_ID('o', 'b', 't')
19 kOtbnWlenBytes = 256 / 8,
28 busy =
status != kDifOtbnStatusIdle &&
status != kDifOtbnStatusLocked;
32 uint32_t instruction_count;
39 TRY_CHECK(
status == kDifOtbnStatusIdle,
"OTBN is locked. Error bits: 0x%08x",
44 err_bits == expected_err_bits,
45 "OTBN error bits: got: 0x%08x, expected: 0x%08x.\nInstruction count: "
47 err_bits, expected_err_bits, instruction_count);
61 static void check_app_address_ranges(
const otbn_app_t *app) {
69 check_app_address_ranges(&app);
75 TRY_CHECK(imem_size %
sizeof(uint32_t) == 0);
76 TRY_CHECK(data_size %
sizeof(uint32_t) == 0);
93 const void *src, otbn_addr_t dest) {
99 otbn_addr_t src,
void *dest) {
104 status_t otbn_dump_dmem(
const dif_otbn_t *otbn, uint32_t max_addr) {
105 TRY_CHECK(max_addr % kOtbnWlenBytes == 0);
111 TRY_CHECK(max_addr <= UINT32_MAX,
"max_addr must fit in uint32_t");
112 for (uint32_t i = 0; i < max_addr; i += kOtbnWlenBytes) {
113 uint32_t data[kOtbnWlenBytes /
sizeof(uint32_t)];
115 LOG_INFO(
"DMEM @%04d: 0x%08x%08x%08x%08x%08x%08x%08x%08x",
116 i / kOtbnWlenBytes, data[7], data[6], data[5], data[4], data[3],
117 data[2], data[1], data[0]);