aboutsummaryrefslogtreecommitdiff
path: root/tests/starved_mesh
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-08-09 17:35:26 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-08-09 17:35:26 +0300
commit489beadf61d05f40dd4ac40e4e5290502f7ad078 (patch)
tree58241d94c3376aae6b081c6fe16288aa0f4d8593 /tests/starved_mesh
parent1853f5d6594bc371e4d8e631c24acd011a620915 (diff)
downloadgran-489beadf61d05f40dd4ac40e4e5290502f7ad078.tar.gz
gran-489beadf61d05f40dd4ac40e4e5290502f7ad078.zip
format
Diffstat (limited to 'tests/starved_mesh')
-rw-r--r--tests/starved_mesh/sim.c64
-rw-r--r--tests/starved_mesh/test.c3
2 files changed, 37 insertions, 30 deletions
diff --git a/tests/starved_mesh/sim.c b/tests/starved_mesh/sim.c
index 990acc5..b15df57 100644
--- a/tests/starved_mesh/sim.c
+++ b/tests/starved_mesh/sim.c
@@ -11,32 +11,33 @@
#include <gran/cpu/riscv/simple_riscv64.h>
unsigned char _tmp_test_bin[] = {
- 0x1b, 0x86, 0x05, 0x00, 0x63, 0x18, 0x05, 0x00, 0x93, 0x07, 0x20, 0x00,
- 0x1b, 0x86, 0x05, 0x00, 0x63, 0x88, 0xf5, 0x0c, 0x93, 0x16, 0x05, 0x01,
- 0x13, 0x07, 0x10, 0x00, 0xb3, 0xe6, 0xb6, 0x00, 0x13, 0x17, 0x07, 0x03,
- 0x83, 0x37, 0x07, 0x00, 0xe3, 0x9e, 0xd7, 0xfe, 0x1b, 0x57, 0x35, 0x00,
- 0xb7, 0x17, 0x00, 0x00, 0x93, 0x06, 0x80, 0x02, 0x13, 0x77, 0x77, 0x00,
- 0x23, 0x80, 0xd7, 0x00, 0x13, 0x07, 0x07, 0x03, 0x93, 0x76, 0x75, 0x00,
- 0x23, 0x80, 0xe7, 0x00, 0x13, 0x87, 0x06, 0x03, 0x23, 0x80, 0xe7, 0x00,
- 0x93, 0x06, 0xc0, 0x02, 0x1b, 0xd7, 0x35, 0x00, 0x23, 0x80, 0xd7, 0x00,
- 0x13, 0x77, 0x77, 0x00, 0x93, 0x06, 0x00, 0x02, 0x23, 0x80, 0xd7, 0x00,
- 0x13, 0x07, 0x07, 0x03, 0x93, 0xf6, 0x75, 0x00, 0x23, 0x80, 0xe7, 0x00,
- 0x13, 0x87, 0x06, 0x03, 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0x90, 0x02,
- 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0xa0, 0x00, 0x23, 0x80, 0xe7, 0x00,
- 0x93, 0x07, 0xf0, 0x00, 0x1b, 0x07, 0x05, 0x00, 0x63, 0x06, 0xf5, 0x02,
- 0x63, 0x08, 0xf6, 0x02, 0x1b, 0x87, 0x15, 0x00, 0x13, 0x17, 0x07, 0x03,
- 0x13, 0x57, 0x07, 0x03, 0x93, 0x17, 0x05, 0x01, 0xb3, 0xe7, 0xe7, 0x00,
- 0x13, 0x07, 0x10, 0x00, 0x13, 0x17, 0x07, 0x03, 0x23, 0x30, 0xf7, 0x00,
- 0x6f, 0x00, 0x00, 0x00, 0xe3, 0x1e, 0xe6, 0xfc, 0x73, 0x00, 0x10, 0x00,
- 0x1b, 0x05, 0x15, 0x00, 0x13, 0x15, 0x05, 0x03, 0x13, 0x55, 0x05, 0x03,
- 0x13, 0x07, 0x00, 0x00, 0x6f, 0xf0, 0x1f, 0xfd, 0x93, 0x07, 0x10, 0x00,
- 0x93, 0x97, 0x07, 0x03, 0x23, 0xb0, 0x07, 0x00, 0x13, 0x07, 0x00, 0x03,
- 0xb7, 0x17, 0x00, 0x00, 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0xa0, 0x00,
- 0x23, 0x80, 0xe7, 0x00, 0x6f, 0xf0, 0xdf, 0xf2
+ 0x1b, 0x86, 0x05, 0x00, 0x63, 0x18, 0x05, 0x00, 0x93, 0x07, 0x20, 0x00,
+ 0x1b, 0x86, 0x05, 0x00, 0x63, 0x88, 0xf5, 0x0c, 0x93, 0x16, 0x05, 0x01,
+ 0x13, 0x07, 0x10, 0x00, 0xb3, 0xe6, 0xb6, 0x00, 0x13, 0x17, 0x07, 0x03,
+ 0x83, 0x37, 0x07, 0x00, 0xe3, 0x9e, 0xd7, 0xfe, 0x1b, 0x57, 0x35, 0x00,
+ 0xb7, 0x17, 0x00, 0x00, 0x93, 0x06, 0x80, 0x02, 0x13, 0x77, 0x77, 0x00,
+ 0x23, 0x80, 0xd7, 0x00, 0x13, 0x07, 0x07, 0x03, 0x93, 0x76, 0x75, 0x00,
+ 0x23, 0x80, 0xe7, 0x00, 0x13, 0x87, 0x06, 0x03, 0x23, 0x80, 0xe7, 0x00,
+ 0x93, 0x06, 0xc0, 0x02, 0x1b, 0xd7, 0x35, 0x00, 0x23, 0x80, 0xd7, 0x00,
+ 0x13, 0x77, 0x77, 0x00, 0x93, 0x06, 0x00, 0x02, 0x23, 0x80, 0xd7, 0x00,
+ 0x13, 0x07, 0x07, 0x03, 0x93, 0xf6, 0x75, 0x00, 0x23, 0x80, 0xe7, 0x00,
+ 0x13, 0x87, 0x06, 0x03, 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0x90, 0x02,
+ 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0xa0, 0x00, 0x23, 0x80, 0xe7, 0x00,
+ 0x93, 0x07, 0xf0, 0x00, 0x1b, 0x07, 0x05, 0x00, 0x63, 0x06, 0xf5, 0x02,
+ 0x63, 0x08, 0xf6, 0x02, 0x1b, 0x87, 0x15, 0x00, 0x13, 0x17, 0x07, 0x03,
+ 0x13, 0x57, 0x07, 0x03, 0x93, 0x17, 0x05, 0x01, 0xb3, 0xe7, 0xe7, 0x00,
+ 0x13, 0x07, 0x10, 0x00, 0x13, 0x17, 0x07, 0x03, 0x23, 0x30, 0xf7, 0x00,
+ 0x6f, 0x00, 0x00, 0x00, 0xe3, 0x1e, 0xe6, 0xfc, 0x73, 0x00, 0x10, 0x00,
+ 0x1b, 0x05, 0x15, 0x00, 0x13, 0x15, 0x05, 0x03, 0x13, 0x55, 0x05, 0x03,
+ 0x13, 0x07, 0x00, 0x00, 0x6f, 0xf0, 0x1f, 0xfd, 0x93, 0x07, 0x10, 0x00,
+ 0x93, 0x97, 0x07, 0x03, 0x23, 0xb0, 0x07, 0x00, 0x13, 0x07, 0x00, 0x03,
+ 0xb7, 0x17, 0x00, 0x00, 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0xa0, 0x00,
+ 0x23, 0x80, 0xe7, 0x00, 0x6f, 0xf0, 0xdf, 0xf2
};
unsigned int _tmp_test_bin_len = 260;
-static struct component *get_mesh(struct component **mesh, int i, int j, uint8_t x, uint8_t y)
+static struct component *get_mesh(struct component **mesh, int i, int j,
+ uint8_t x, uint8_t y)
{
if (i < 0)
return NULL;
@@ -74,10 +75,14 @@ static stat build_mesh(struct clock_domain *clk, uint8_t x, uint8_t y)
continue;
struct component *imem = create_simple_mem(4096);
- init_simple_mem(imem, 0, _tmp_test_bin_len, _tmp_test_bin);
+ init_simple_mem(imem, 0,
+ _tmp_test_bin_len,
+ _tmp_test_bin);
uint64_t rcv = mesh2d_addr(i, j, 0, 0);
- struct component *rv64 = create_simple_riscv64(rcv, 0, imem, node);
+ struct component *rv64 = create_simple_riscv64(rcv, 0,
+ imem, node);
+
simple_riscv64_set_reg(rv64, 10, i); /* a0 */
simple_riscv64_set_reg(rv64, 11, j); /* a1 */
@@ -113,10 +118,11 @@ static stat build_mesh(struct clock_domain *clk, uint8_t x, uint8_t y)
struct component *node = mesh[i * x + j];
struct component *lower = pes[i * x + j];
- struct component *left = get_mesh(mesh, i - 1, j , x, y);
- struct component *right = get_mesh(mesh, i + 1, j , x, y);
- struct component *up = get_mesh(mesh, i , j + 1, x, y);
- struct component *down = get_mesh(mesh, i , j - 1, x, y);
+ struct component *left = get_mesh(mesh, i - 1, j, x, y);
+ struct component *right = get_mesh(mesh, i + 1, j, x, y);
+ struct component *up = get_mesh(mesh, i, j + 1, x, y);
+ struct component *down = get_mesh(mesh, i, j - 1, x, y);
+
mesh_node2d_connect_north(node, up);
mesh_node2d_connect_south(node, down);
mesh_node2d_connect_east(node, left);
diff --git a/tests/starved_mesh/test.c b/tests/starved_mesh/test.c
index c91868c..3bde7ca 100644
--- a/tests/starved_mesh/test.c
+++ b/tests/starved_mesh/test.c
@@ -3,7 +3,8 @@
void _start(unsigned short x, unsigned short y)
{
- volatile unsigned long *counter = (unsigned long *)((unsigned long)1 << 48);
+ volatile unsigned long *counter = (unsigned long *)((unsigned long)1 <<
+ 48);
volatile char *uart = (char *)4096;
/* very hacky, not recommended but good enough for testing */