diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-09-22 22:45:18 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-09-22 22:45:18 +0300 |
| commit | b1d67364b4b4832b8efed112f7b0ead1a0b3cd3b (patch) | |
| tree | 7926bfb428703515438c08b98c61cbffd34b3cbb /tests/simple_grid/test.c | |
| parent | 32f9719e29762001f73460acd31f2a6da8fd6298 (diff) | |
| download | gran-b1d67364b4b4832b8efed112f7b0ead1a0b3cd3b.tar.gz gran-b1d67364b4b4832b8efed112f7b0ead1a0b3cd3b.zip | |
start experimenting with processor grids
Diffstat (limited to 'tests/simple_grid/test.c')
| -rw-r--r-- | tests/simple_grid/test.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/simple_grid/test.c b/tests/simple_grid/test.c new file mode 100644 index 0000000..782062d --- /dev/null +++ b/tests/simple_grid/test.c @@ -0,0 +1,43 @@ +#define X 64 +#define Y 64 + +void _start(unsigned char x, unsigned char y) +{ + volatile unsigned long *counter = (unsigned long *)4096; + volatile char *uart = (char *)8192; + + /* very hacky, not recommended but good enough for testing */ + if (x == 0 && y == 0) + *counter = 0; + else + while (*counter != ((x << 8) | y)) + ; + + *uart = '('; + /* [0 - 63] as two octal numbers */ + *uart = ((x >> 3) & 0x7) + '0'; + *uart = ((x >> 0) & 0x7) + '0'; + + *uart = ','; + *uart = ' '; + + *uart = ((y >> 3) & 0x7) + '0'; + *uart = ((y >> 0) & 0x7) + '0'; + + *uart = ')'; + *uart = '\n'; + + if (y == 63) { + x++; + y = 0; + } + else + y++; + + *counter = (x << 8) | y; + + while (*counter != (64 << 8)) + ; + + asm ("ebreak\n"); +} |
