Skip to content

Commit

Permalink
SFPI test infra
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-TT committed Jan 27, 2025
1 parent 875ce89 commit 33c614a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gcc
2 changes: 1 addition & 1 deletion include/blackhole/sfpi_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace sfpi {

#elif __GNUC__
#if !__has_builtin(__builtin_rvtt_bh_sfpload)
#error TT builtins not found: compile with -mwormhole -march=rv32iw -mabi=ilp32
#error TT builtins not found: compile with -march=rv32im_xttbh -mabi=ilp32
#include <fails to compile without extensions>
#endif // !__has_builtin(__builtin_rvtt_bh_sfpload)

Expand Down
2 changes: 1 addition & 1 deletion include/grayskull/sfpi_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace sfpi {

#elif __GNUC__
#if !__has_builtin(__builtin_rvtt_gs_sfpload)
#error TT builtins not found: compile with -mgrayskull -march=rv32iy -mabi=ilp32
#error TT builtins not found: compile with -march=rv32i_xttgs -mabi=ilp32
#include <fails to compile without extensions>
#endif // !__has_builtin(__builtin_rvtt_gs_sfpload)

Expand Down
14 changes: 14 additions & 0 deletions include/sfpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,24 @@

#include <type_traits>

#if __riscv_tt_grayskull
#define ARCH_GRAYSKULL 1
#endif
#if __riscv_tt_wormhole
#define ARCH_WORMHOLE 1
#endif
#if __riscv_tt_blackhole
#define ARCH_BLACKHOLE 1
#endif
#if defined(ARCH_WORMHOLE_B0)
#define ARCH_WORMHOLE 1
#endif

#if defined(ARCH_GRAYSKULL) + defined(ARCH_WORMHOLE) + defined(ARCH_BLACKHOLE) != 1
#error "Exactly one SFPI architecture must be selected"
#include "stop now, no good will come"
#endif

#if defined(ARCH_GRAYSKULL)
#include <grayskull/sfpi_hw.h>
#elif defined(ARCH_WORMHOLE)
Expand Down
2 changes: 1 addition & 1 deletion include/wormhole/sfpi_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ namespace sfpi {

#elif __GNUC__
#if !__has_builtin(__builtin_rvtt_wh_sfpload)
#error TT builtins not found: compile with -mwormhole -march=rv32iw -mabi=ilp32
#error TT builtins not found: compile with -march=rv32im_xttwh -mabi=ilp32
#include <fails to compile without extensions>
#endif // !__has_builtin(__builtin_rvtt_wh_sfpload)

Expand Down

0 comments on commit 33c614a

Please sign in to comment.