aboutsummaryrefslogtreecommitdiff
path: root/tests/simple_torus3d/test.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-08-29 22:41:27 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-08-29 22:41:27 +0300
commit260689ea747f93b018ec4a25a2526a7aa05b7cb0 (patch)
treea30befd0bafa3a44ec495aaaa8ced56112265f81 /tests/simple_torus3d/test.c
parent50a9b6780e04ae27cd03323d7fec02e15f7d3086 (diff)
downloadgran-260689ea747f93b018ec4a25a2526a7aa05b7cb0.tar.gz
gran-260689ea747f93b018ec4a25a2526a7aa05b7cb0.zip
remove torus3d
+ Might try to fix it at some point in the future but for now I don't want to carry around broken code
Diffstat (limited to 'tests/simple_torus3d/test.c')
-rw-r--r--tests/simple_torus3d/test.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/tests/simple_torus3d/test.c b/tests/simple_torus3d/test.c
deleted file mode 100644
index 646b387..0000000
--- a/tests/simple_torus3d/test.c
+++ /dev/null
@@ -1,64 +0,0 @@
-__attribute__((always_inline))
-static inline void print_int8(volatile char *uart, unsigned x)
-{
- *uart = ((x >> 4) & 0xf) + '0';
- *uart = ((x >> 0) & 0xf) + '0';
-}
-
-__attribute__((always_inline))
-static inline void print_addr(volatile char *uart, unsigned x, unsigned y,
- unsigned z)
-{
- *uart = '(';
- print_int8(uart, x);
- *uart = ',';
- *uart = ' ';
- print_int8(uart, y);
- *uart = ',';
- *uart = ' ';
- print_int8(uart, z);
- *uart = ')';
- *uart = '\n';
-}
-
-__attribute__((always_inline))
-static inline unsigned wrap(unsigned x, unsigned X)
-{
- return x + 1 >= X ? 0 : x + 1;
-}
-
-__attribute__((always_inline))
-static inline unsigned next_idx(unsigned x, unsigned y, unsigned z, unsigned X,
- unsigned Y, unsigned Z)
-{
- unsigned zi = wrap(z, Z);
- unsigned yi = zi < z ? wrap(y, Y) : y;
- unsigned xi = yi < y ? wrap(x, X) : x;
-
- return (xi << 16) | (yi << 8) | zi;
-}
-
-void _start(unsigned x, unsigned y, unsigned z, unsigned X, unsigned Y,
- unsigned Z)
-{
- volatile char *uart = (char *)4096;
- /* x = 1ULL << 32, y = 1ULL << 40, z = 1ULL << 48 I guess */
- volatile unsigned *control = (unsigned *)(1ULL << 48);
-
-
- if (x == 0 && y == 0 && z == 2) {
- goto do_work;
- } else {
- while (*control != ((x << 16) | (y << 8) | z)) {}
- }
-
-do_work:
- print_addr(uart, x, y, z);
- *control = next_idx(x, y, z, X, Y, Z);
-
- if (x == X - 1 && y == Y - 1 && z == Z - 1)
- asm ("ebreak");
-
- /* otherwise just loop */
- while (1) {}
-}