-
Notifications
You must be signed in to change notification settings - Fork 783
/
status.h
88 lines (79 loc) · 2.97 KB
/
status.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
#ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_STATUS_H_
#define OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_STATUS_H_
/**
* Indicates the status of the software running on the CPU, from a testing
* perspective.
*
* It is useful to track the current status of the test SW executing on the CPU
* as a signal the helps aid in debug.
*
* The values set to these literals is arbitrary and do not possess any special
* meaning (other than being hex 'words'). They are chosen to be 16-bits wide.
* The upper 16-bits are reserved for future use.
*/
typedef enum test_status {
/**
* Indicates that the CPU has started executing the test_rom code.
*
* Writing this value to #kDeviceTestStatusAddress must not stop simulation of
* the current device.
*/
kTestStatusInBootRom = 0xb090, // 'bogo', BOotrom GO
/**
* Indicates that the CPU has seen ROM_EXEC_EN = 0 and will now stop
* execution.
*
* Writing this value to #kDeviceTestStatusAddress must not stop simulation of
* the current device.
*/
kTestStatusInBootRomHalt = 0xb057, // 'bost', BOotrom STop
/**
* Indicates that the CPU has started executing the test code.
*
* Writing this value to #kDeviceTestStatusAddress must not stop simulation of
* the current device.
*/
kTestStatusInTest = 0x4354, // 'test'
/**
* Indicates that the CPU is in the WFI state.
*
* Writing this value to #kDeviceTestStatusAddress must not stop simulation of
* the current device.
*/
kTestStatusInWfi = 0x1d1e, // 'idle'
/**
* This indicates that the test has passed. This is a terminal state. Any code
* appearing after this value is set is unreachable.
*
* Writing this value to #kDeviceTestStatusAddress may stop simulation of the
* current device.
*/
kTestStatusPassed = 0x900d, // 'good'
/**
* This indicates that the test has failed. This is a terminal state. Any code
* appearing after this value is set is unreachable.
*
* Writing this value to #kDeviceTestStatusAddress may stop simulation of the
* current device.
*/
kTestStatusFailed = 0xbaad // 'baad'
} test_status_t;
/**
* This signals the status of the software test with `test_status` value.
*
* It is mandatory for tests to indicate whether they passed or failed using
* this function with #kTestStatusPassed and #kTestStatusFailed.
*
* In simulated testing (Verilator, DV), this function writes `test_status` to
* a specific address, which may cause the simulation to end.
*
* In environments with a null #kDeviceTestStatusAddress, this logs a message
* for terminal states and calls abort. Otherwise, the function returns safely.
*
* @param test_status current status of the test.
*/
void test_status_set(test_status_t test_status);
#endif // OPENTITAN_SW_DEVICE_LIB_TESTING_TEST_FRAMEWORK_STATUS_H_