Skip to content

Commit 1ea3d01

Browse files
[sw] Add HW_ID platform check
Update the test framework smoketest to read the HW_ID register, validate it against known values, and fail on an unrecognised ID. Co-authored-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org> Signed-off-by: martin-velay <mvelay@lowrisc.org>
1 parent 469dd39 commit 1ea3d01

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

sw/device/tests/test_framework/smoketest.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,32 @@
22
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
33
// SPDX-License-Identifier: Apache-2.0
44

5+
#include "hal/dv.h"
6+
#include "hal/mocha.h"
57
#include "hal/uart.h"
68
#include <stdbool.h>
79

810
bool test_main(uart_t console)
911
{
12+
dv_window_t dv_window = mocha_system_dv_window();
13+
uint32_t hwid = DEV_READ(&dv_window->hw_id);
14+
1015
uart_puts(console, "Test framework smoketest\n");
16+
17+
switch (hwid) {
18+
case dv_hwid_fpga_genesys2:
19+
uart_puts(console, "Platform: Genesys2 FPGA\n");
20+
break;
21+
case dv_hwid_sim_verilator:
22+
uart_puts(console, "Platform: Verilator Simulation\n");
23+
break;
24+
case dv_hwid_sim_uvm:
25+
uart_puts(console, "Platform: UVM Simulation\n");
26+
break;
27+
default:
28+
uart_puts(console, "Unknown Hardware ID\n");
29+
return false;
30+
}
31+
1132
return true;
1233
}

0 commit comments

Comments
 (0)