diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-08-09 17:20:05 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-08-09 17:20:05 +0300 |
| commit | 1853f5d6594bc371e4d8e631c24acd011a620915 (patch) | |
| tree | 1bfaabd3685d4eacc6595ee6836adddcc37ba841 /tests/simple_mesh1d | |
| parent | 3083284c797fc8fc267144b05c8a58395e4583e3 (diff) | |
| download | gran-1853f5d6594bc371e4d8e631c24acd011a620915.tar.gz gran-1853f5d6594bc371e4d8e631c24acd011a620915.zip | |
refactor mesh3d to match 2d,1d
Diffstat (limited to 'tests/simple_mesh1d')
| -rw-r--r-- | tests/simple_mesh1d/sim.c | 11 | ||||
| -rw-r--r-- | tests/simple_mesh1d/test.c | 13 |
2 files changed, 12 insertions, 12 deletions
diff --git a/tests/simple_mesh1d/sim.c b/tests/simple_mesh1d/sim.c index c5f7290..b419633 100644 --- a/tests/simple_mesh1d/sim.c +++ b/tests/simple_mesh1d/sim.c @@ -15,7 +15,6 @@ static stat build_node1d(struct clock_domain *clk, uint16_t x, uint16_t y) assert(mesh); for (int i = 1; i < x + 1; ++i) { - /* 4 CPUs + 1 mem = 5 elems in total */ struct component *node = create_mesh_node1d(i, y + 1); clock_domain_add(clk, node); mesh[i] = node; @@ -23,8 +22,8 @@ static stat build_node1d(struct clock_domain *clk, uint16_t x, uint16_t y) for (int j = 0; j < y; ++j) { struct component *imem = create_simple_mem(4096); init_simple_mem(imem, 0, - build_tests_simple_mesh1d_test_bin_len, - build_tests_simple_mesh1d_test_bin); + build_tests_simple_mesh1d_test_bin_len, + build_tests_simple_mesh1d_test_bin); uint64_t rcv = mesh1d_addr(i, j, 0); struct component *rv64 = create_simple_riscv64(rcv, 0, imem, node); @@ -44,7 +43,7 @@ static stat build_node1d(struct clock_domain *clk, uint16_t x, uint16_t y) mesh_node1d_connect(node, dmem, 4); } - /* extra I/O node (kind of?) */ + /* extra I/O node */ struct component *node = create_mesh_node1d(0, 2); clock_domain_add(clk, node); mesh[0] = node; @@ -59,10 +58,10 @@ static stat build_node1d(struct clock_domain *clk, uint16_t x, uint16_t y) for (int i = 0; i < x + 1; ++i) { if (i - 1 >= 0) - mesh_node1d_connect_right(mesh[i], mesh[i - 1]); + mesh_node1d_connect_south(mesh[i], mesh[i - 1]); if (i + 1 < x + 1) - mesh_node1d_connect_left(mesh[i], mesh[i + 1]); + mesh_node1d_connect_north(mesh[i], mesh[i + 1]); } free(mesh); diff --git a/tests/simple_mesh1d/test.c b/tests/simple_mesh1d/test.c index b3de347..293a91c 100644 --- a/tests/simple_mesh1d/test.c +++ b/tests/simple_mesh1d/test.c @@ -1,7 +1,8 @@ #include <stdint.h> __attribute__((always_inline)) -static inline uint64_t extreme_numa_addr(uint16_t cluster, uint16_t elem, uint32_t off) +static inline uint64_t mesh1d_addr(uint16_t cluster, uint16_t elem, + uint32_t off) { return ((uint64_t)cluster << 48) | ((uint64_t)elem << 32) | off; } @@ -40,18 +41,18 @@ static inline uint64_t next_idx(unsigned x, unsigned y, unsigned X, unsigned Y) unsigned yi = wrap(y, Y); unsigned xi = yi < y ? wrap(x, X) : x; - return extreme_numa_addr(xi, yi, 0); + return mesh1d_addr(xi, yi, 0); } void _start(unsigned x, unsigned y, unsigned X, unsigned Y) { - volatile char *uart = (char *)extreme_numa_addr(0, 0, 0); - volatile uint64_t *control = (uint64_t *)extreme_numa_addr(0, 1, 0); + volatile char *uart = (char *)mesh1d_addr(0, 0, 0); + volatile uint64_t *control = (uint64_t *)mesh1d_addr(0, 1, 0); if (x == 1 && y == 0) { goto do_work; } else { - while (*control != extreme_numa_addr(x, y, 0)) {} + while (*control != mesh1d_addr(x, y, 0)) {} } do_work: @@ -59,7 +60,7 @@ do_work: *control = next_idx(x, y, X, Y); if (x == X - 1 && y == Y - 1) - asm("ebreak"); + asm ("ebreak"); /* otherwise just loop */ while (1) {} |
