Software APIs
sw
device
lib
base
random_order.c
1
// Copyright lowRISC contributors (OpenTitan project).
2
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3
// SPDX-License-Identifier: Apache-2.0
4
5
#include "
sw/device/lib/base/random_order.h
"
6
7
#include "
sw/device/lib/base/bitfield.h
"
8
9
// TODO: The current implementation is just a skeleton, and currently just
10
// traverses from 0 to `min_len * 2`.
11
12
void
random_order_init
(
random_order_t
*ctx,
size_t
min_len) {
13
ctx->state = 0;
14
ctx->max = min_len * 2;
15
}
16
17
size_t
random_order_len
(
const
random_order_t
*ctx) {
return
ctx->max; }
18
19
size_t
random_order_advance
(
random_order_t
*ctx) {
return
ctx->state++; }
Return to
OpenTitan Documentation