File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414static const uintptr_t rom_base = 0x80000ul ;
1515static const uintptr_t mailbox_base = 0x20010000ul ;
1616static const uintptr_t dv_test_status_base = 0x20020000ul ;
17+ static const uintptr_t dv_hw_id_base = 0x20020008ul ;
1718static const uintptr_t ethernet_base = 0x30000000ul ;
1819static const uintptr_t gpio_base = 0x40000000ul ;
1920static const uintptr_t clkmgr_base = 0x40020000ul ;
@@ -201,3 +202,12 @@ void *mocha_system_dv_test_status(void)
201202 return (void * )dv_test_status_base ;
202203#endif /* defined(__riscv_zcherihybrid) */
203204}
205+
206+ void * mocha_system_dv_hw_id (void )
207+ {
208+ #if defined(__riscv_zcherihybrid )
209+ return create_mmio_capability (dv_hw_id_base , 0x4u );
210+ #else /* !defined(__riscv_zcherihybrid) */
211+ return (void * )dv_hw_id_base ;
212+ #endif /* defined(__riscv_zcherihybrid) */
213+ }
Original file line number Diff line number Diff line change @@ -52,3 +52,10 @@ plic_t mocha_system_plic(void);
5252void * mocha_system_dram (void );
5353
5454void * mocha_system_dv_test_status (void );
55+ void * mocha_system_dv_hw_id (void );
56+
57+ typedef enum : uint32_t {
58+ HW_ID_FPGA_GENESYS2 = 0x0000000Au ,
59+ HW_ID_SIM_VERILATOR = 0x0000001Au ,
60+ HW_ID_SIM_UVM = 0x0000002Au ,
61+ } dv_hw_platform_t ;
Original file line number Diff line number Diff line change 22// Licensed under the Apache License, Version 2.0, see LICENSE for details.
33// SPDX-License-Identifier: Apache-2.0
44
5- #include "hal/uart.h"
5+ #include "hal/mmio.h"
6+ #include "hal/mocha.h"
67#include <stdbool.h>
78
89bool test_main (uart_t console )
910{
11+ dv_hw_platform_t hw_id = (dv_hw_platform_t )DEV_READ (mocha_system_dv_hw_id ());
12+
1013 uart_puts (console , "Test framework smoketest\n" );
11- return true;
14+
15+ switch (hw_id ) {
16+ case HW_ID_FPGA_GENESYS2 :
17+ uart_puts (console , "Platform: FpgaGenesys2\n" );
18+ return true;
19+ case HW_ID_SIM_VERILATOR :
20+ uart_puts (console , "Platform: SimVerilator\n" );
21+ return true;
22+ case HW_ID_SIM_UVM :
23+ uart_puts (console , "Platform: SimUvm\n" );
24+ return true;
25+ default :
26+ uart_puts (console , "Unknown HW_ID\n" );
27+ return false;
28+ }
1229}
You can’t perform that action at this time.
0 commit comments