diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/simple_fat_bfly/sim.c | 8 | ||||
| -rw-r--r-- | tests/simple_fat_bfly/test.c | 2 | ||||
| -rw-r--r-- | tests/simple_ideal_alloc/testbench.c | 17 | ||||
| -rw-r--r-- | tests/simple_ideal_noc/sim.c | 8 | ||||
| -rw-r--r-- | tests/simple_ideal_noc/test.c | 2 | ||||
| -rw-r--r-- | tests/simple_mem/traffic_gen.c | 12 | ||||
| -rw-r--r-- | tests/simple_mesh1d/sim.c | 4 | ||||
| -rw-r--r-- | tests/simple_mesh1d/test.c | 2 | ||||
| -rw-r--r-- | tests/simple_mesh2d/sim.c | 48 | ||||
| -rw-r--r-- | tests/simple_mesh3d/sim.c | 15 | ||||
| -rw-r--r-- | tests/simple_torus3d/sim.c | 96 | ||||
| -rw-r--r-- | tests/simple_torus3d/test.c | 11 | ||||
| -rw-r--r-- | tests/simple_uart/sim.c | 12 | ||||
| -rw-r--r-- | tests/starved_mesh/sim.c | 64 | ||||
| -rw-r--r-- | tests/starved_mesh/test.c | 3 |
15 files changed, 168 insertions, 136 deletions
diff --git a/tests/simple_fat_bfly/sim.c b/tests/simple_fat_bfly/sim.c index 7d7b166..98aa359 100644 --- a/tests/simple_fat_bfly/sim.c +++ b/tests/simple_fat_bfly/sim.c @@ -23,11 +23,13 @@ static stat build_ideal_noc(struct clock_domain *clk, uint32_t x) struct component *imem = create_simple_mem(4096); init_simple_mem(imem, 0, - build_tests_simple_fat_bfly_test_bin_len, - build_tests_simple_fat_bfly_test_bin); + build_tests_simple_fat_bfly_test_bin_len, + build_tests_simple_fat_bfly_test_bin); uint64_t rcv = fat_bfly_addr(i, 0); - struct component *rv64 = create_simple_riscv64(rcv, 0, imem, noc); + struct component *rv64 = create_simple_riscv64(rcv, 0, + imem, noc); + simple_riscv64_set_reg(rv64, 10, i); /* a0 */ simple_riscv64_set_reg(rv64, 11, x); /* a1 */ diff --git a/tests/simple_fat_bfly/test.c b/tests/simple_fat_bfly/test.c index 2e4a22c..aaf86c7 100644 --- a/tests/simple_fat_bfly/test.c +++ b/tests/simple_fat_bfly/test.c @@ -45,7 +45,7 @@ do_work: *control = x + 1; if (x == X - 1) - asm("ebreak"); + asm ("ebreak"); /* otherwise just loop */ while (1) {} diff --git a/tests/simple_ideal_alloc/testbench.c b/tests/simple_ideal_alloc/testbench.c index 703c2a8..b505c9d 100644 --- a/tests/simple_ideal_alloc/testbench.c +++ b/tests/simple_ideal_alloc/testbench.c @@ -1,11 +1,6 @@ #include <gran/if/alloc.h> #include "testbench.h" -struct reg { - struct packet pkt; - bool busy; -}; - struct tb { struct component component; struct component *dut; @@ -35,7 +30,8 @@ static stat tb_clock(struct tb *tb) switch (tb->state) { case ADD_REGION: { struct alloc_if_new n = {.space = 0, .start = 0, .end = 10}; - struct packet pkt = create_packet(0, ALLOC_IF_NEW, sizeof(n), &n, PACKET_WRITE); + struct packet pkt = create_packet(0, ALLOC_IF_NEW, sizeof(n), + &n, PACKET_WRITE); assert(SEND(tb, tb->dut, pkt) == OK); tb->state = QUERY_EXISTING; break; @@ -49,7 +45,8 @@ static stat tb_clock(struct tb *tb) assert(r->r == ALLOC_IF_OK); struct alloc_if_q q = {.space = 0, .addr = 5}; - struct packet pkt = create_packet(0, ALLOC_IF_Q, sizeof(q), &q, PACKET_WRITE); + struct packet pkt = create_packet(0, ALLOC_IF_Q, sizeof(q), &q, + PACKET_WRITE); assert(SEND(tb, tb->dut, pkt) == OK); tb->state = REMOVE_REGION; tb->in.busy = false; @@ -66,7 +63,8 @@ static stat tb_clock(struct tb *tb) assert(r->end == 10); struct alloc_if_rm rm = {.space = 0, .start = 0, .end = 10}; - struct packet pkt = create_packet(0, ALLOC_IF_RM, sizeof(rm), &rm, PACKET_WRITE); + struct packet pkt = create_packet(0, ALLOC_IF_RM, sizeof(rm), + &rm, PACKET_WRITE); assert(SEND(tb, tb->dut, pkt) == OK); tb->state = QUERY_NONEXISTING; tb->in.busy = false; @@ -81,7 +79,8 @@ static stat tb_clock(struct tb *tb) assert(r->r == ALLOC_IF_OK); struct alloc_if_q q = {.space = 0, .addr = 5}; - struct packet pkt = create_packet(0, ALLOC_IF_Q, sizeof(q), &q, PACKET_WRITE); + struct packet pkt = create_packet(0, ALLOC_IF_Q, sizeof(q), &q, + PACKET_WRITE); assert(SEND(tb, tb->dut, pkt) == OK); tb->state = FINAL; tb->in.busy = false; diff --git a/tests/simple_ideal_noc/sim.c b/tests/simple_ideal_noc/sim.c index 4aba71d..eb8f475 100644 --- a/tests/simple_ideal_noc/sim.c +++ b/tests/simple_ideal_noc/sim.c @@ -24,11 +24,13 @@ static stat build_ideal_noc(struct clock_domain *clk, uint32_t x) struct component *imem = create_simple_mem(4096); init_simple_mem(imem, 0, - build_tests_simple_ideal_noc_test_bin_len, - build_tests_simple_ideal_noc_test_bin); + build_tests_simple_ideal_noc_test_bin_len, + build_tests_simple_ideal_noc_test_bin); uint64_t rcv = ideal_noc_addr(i, 0); - struct component *rv64 = create_simple_riscv64(rcv, 0, imem, noc); + struct component *rv64 = create_simple_riscv64(rcv, 0, + imem, noc); + simple_riscv64_set_reg(rv64, 10, i); /* a0 */ simple_riscv64_set_reg(rv64, 11, x); /* a1 */ diff --git a/tests/simple_ideal_noc/test.c b/tests/simple_ideal_noc/test.c index 2e4a22c..aaf86c7 100644 --- a/tests/simple_ideal_noc/test.c +++ b/tests/simple_ideal_noc/test.c @@ -45,7 +45,7 @@ do_work: *control = x + 1; if (x == X - 1) - asm("ebreak"); + asm ("ebreak"); /* otherwise just loop */ while (1) {} diff --git a/tests/simple_mem/traffic_gen.c b/tests/simple_mem/traffic_gen.c index a4d5064..0a57fb1 100644 --- a/tests/simple_mem/traffic_gen.c +++ b/tests/simple_mem/traffic_gen.c @@ -21,7 +21,8 @@ struct traffic_gen { size_t counter; }; -static stat traffic_gen_receive(struct traffic_gen *tg, struct component *from, struct packet pkt) +static stat traffic_gen_receive(struct traffic_gen *tg, struct component *from, + struct packet pkt) { (void)from; tg->pkt = pkt; @@ -37,7 +38,8 @@ static stat traffic_gen_clock(struct traffic_gen *tg) switch (tg->counter) { case 0: c = 13; - tg->pkt = create_packet(tg->rcv, tg->addr, sizeof(c), &c, PACKET_WRITE); + tg->pkt = create_packet(tg->rcv, tg->addr, sizeof(c), &c, + PACKET_WRITE); assert(SEND(tg, tg->stress, tg->pkt) == OK); tg->counter++; break; @@ -51,7 +53,8 @@ static stat traffic_gen_clock(struct traffic_gen *tg) break; case 2: - tg->pkt = create_packet(0, tg->addr, sizeof(c), NULL, PACKET_READ); + tg->pkt = create_packet(0, tg->addr, sizeof(c), NULL, + PACKET_READ); assert(SEND(tg, tg->stress, tg->pkt) == OK); tg->counter++; break; @@ -75,7 +78,8 @@ static stat traffic_gen_clock(struct traffic_gen *tg) return OK; } -struct component *create_traffic_gen(struct component *stress, uintptr_t start, size_t size) +struct component *create_traffic_gen(struct component *stress, uintptr_t start, + size_t size) { struct traffic_gen *new = calloc(1, sizeof(struct traffic_gen)); if (!new) diff --git a/tests/simple_mesh1d/sim.c b/tests/simple_mesh1d/sim.c index b419633..7479a27 100644 --- a/tests/simple_mesh1d/sim.c +++ b/tests/simple_mesh1d/sim.c @@ -26,7 +26,9 @@ static stat build_node1d(struct clock_domain *clk, uint16_t x, uint16_t y) build_tests_simple_mesh1d_test_bin); uint64_t rcv = mesh1d_addr(i, j, 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 */ simple_riscv64_set_reg(rv64, 12, x); /* a2 */ diff --git a/tests/simple_mesh1d/test.c b/tests/simple_mesh1d/test.c index 293a91c..df86774 100644 --- a/tests/simple_mesh1d/test.c +++ b/tests/simple_mesh1d/test.c @@ -2,7 +2,7 @@ __attribute__((always_inline)) static inline uint64_t mesh1d_addr(uint16_t cluster, uint16_t elem, - uint32_t off) + uint32_t off) { return ((uint64_t)cluster << 48) | ((uint64_t)elem << 32) | off; } diff --git a/tests/simple_mesh2d/sim.c b/tests/simple_mesh2d/sim.c index 5afb1a7..cbce9f3 100644 --- a/tests/simple_mesh2d/sim.c +++ b/tests/simple_mesh2d/sim.c @@ -60,36 +60,36 @@ static stat build_mesh(struct clock_domain *clk, uint16_t x, uint16_t y) assert(pes); for (size_t i = 0; i < x; ++i) - for (size_t j = 0; j < y; ++j) { - struct component *node = create_mesh_node2d(i, j, 1); - clock_domain_add(clk, node); - mesh[idx_1d(i, j, x, y)] = node; + for (size_t j = 0; j < y; ++j) { + struct component *node = create_mesh_node2d(i, j, 1); + clock_domain_add(clk, node); + mesh[idx_1d(i, j, x, y)] = node; - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) + continue; - if (i == 0 && j == 1) - continue; + if (i == 0 && j == 1) + continue; - struct component *imem = create_simple_mem(4096); - init_simple_mem(imem, 0, - build_tests_simple_mesh2d_test_bin_len, - build_tests_simple_mesh2d_test_bin); + struct component *imem = create_simple_mem(4096); + init_simple_mem(imem, 0, + build_tests_simple_mesh2d_test_bin_len, + build_tests_simple_mesh2d_test_bin); - uint64_t rcv = mesh2d_addr(i, j, 0, 0); - 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 */ - simple_riscv64_set_reg(rv64, 12, x); /* a3 */ - simple_riscv64_set_reg(rv64, 13, y); /* a4 */ + uint64_t rcv = mesh2d_addr(i, j, 0, 0); + struct component *rv64 = create_simple_riscv64(rcv, 0, + imem, node); - clock_domain_add(clk, rv64); - clock_domain_add(clk, imem); + simple_riscv64_set_reg(rv64, 10, i); /* a0 */ + simple_riscv64_set_reg(rv64, 11, j); /* a1 */ + simple_riscv64_set_reg(rv64, 12, x); /* a3 */ + simple_riscv64_set_reg(rv64, 13, y); /* a4 */ - pes[idx_1d(i, j, x, y)] = rv64; - } + clock_domain_add(clk, rv64); + clock_domain_add(clk, imem); + + pes[idx_1d(i, j, x, y)] = rv64; + } struct component *uart = create_simple_uart(); clock_domain_add(clk, uart); diff --git a/tests/simple_mesh3d/sim.c b/tests/simple_mesh3d/sim.c index f5d6244..f1663ef 100644 --- a/tests/simple_mesh3d/sim.c +++ b/tests/simple_mesh3d/sim.c @@ -79,13 +79,16 @@ static stat build_mesh3d(struct clock_domain *clk, uint8_t x, uint8_t y, if (i == 0 && j == 0 && k == 1) continue; - struct component *imem = create_simple_mem(4096); + struct component *imem = + create_simple_mem(4096); init_simple_mem(imem, 0, - build_tests_simple_mesh3d_test_bin_len, - build_tests_simple_mesh3d_test_bin); + build_tests_simple_mesh3d_test_bin_len, + build_tests_simple_mesh3d_test_bin); uint64_t rcv = mesh3d_addr(i, j, k, 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 */ simple_riscv64_set_reg(rv64, 12, k); /* a2 */ @@ -116,7 +119,9 @@ static stat build_mesh3d(struct clock_domain *clk, uint8_t x, uint8_t y, if (i == 0 && j == 0 && k == 1) continue; - connect_mesh3d(mesh, pes[idx_1d(i, j, k, x, y, z)], i, j, k, x, y, z); + connect_mesh3d(mesh, + pes[idx_1d(i, j, k, x, y, z)], i, + j, k, x, y, z); } free(mesh); diff --git a/tests/simple_torus3d/sim.c b/tests/simple_torus3d/sim.c index b3ff41b..c996c42 100644 --- a/tests/simple_torus3d/sim.c +++ b/tests/simple_torus3d/sim.c @@ -18,20 +18,21 @@ static size_t idx_1d(int x, int y, int z, uint8_t xw, uint8_t yw, uint8_t zw) } static void torus3d_connect_grid(struct component **grid, struct component *c, - uint8_t x, uint8_t y, uint8_t z, - uint8_t xw, uint8_t yw, uint8_t zw) + uint8_t x, uint8_t y, uint8_t z, + uint8_t xw, uint8_t yw, uint8_t zw) { torus3d_node_connect(grid[idx_1d(x, y, z, xw, yw, zw)], - grid[idx_1d(x-1, y , z , xw, yw, zw)], - grid[idx_1d(x , y-1, z , xw, yw, zw)], - grid[idx_1d(x , y , z-1, xw, yw, zw)], - c, - grid[idx_1d(x+1, y , z , xw, yw, zw)], - grid[idx_1d(x , y+1, z , xw, yw, zw)], - grid[idx_1d(x , y , z+1, xw, yw, zw)]); + grid[idx_1d(x-1, y, z, xw, yw, zw)], + grid[idx_1d(x, y-1, z, xw, yw, zw)], + grid[idx_1d(x, y, z-1, xw, yw, zw)], + c, + grid[idx_1d(x+1, y, z, xw, yw, zw)], + grid[idx_1d(x, y+1, z, xw, yw, zw)], + grid[idx_1d(x, y, z+1, xw, yw, zw)]); } -static stat build_torus3d(struct clock_domain *clk, uint8_t x, uint8_t y, uint8_t z) +static stat build_torus3d(struct clock_domain *clk, uint8_t x, uint8_t y, + uint8_t z) { struct component **grid = calloc(x * y * z, sizeof(struct component *)); assert(grid); @@ -40,37 +41,42 @@ static stat build_torus3d(struct clock_domain *clk, uint8_t x, uint8_t y, uint8_ assert(pes); for (size_t i = 0; i < x; ++i) - for (size_t j = 0; j < y; ++j) - for (size_t k = 0; k < z; ++k) { - struct component *node = create_torus3d_node(i, j, k); - clock_domain_add(clk, node); - grid[idx_1d(i, j, k, x, y, z)] = node; + for (size_t j = 0; j < y; ++j) + for (size_t k = 0; k < z; ++k) { + struct component *node = create_torus3d_node(i, + j, + k); + clock_domain_add(clk, node); + grid[idx_1d(i, j, k, x, y, z)] = node; - if (i == 0 && j == 0 && k == 0) - continue; + if (i == 0 && j == 0 && k == 0) + continue; - if (i == 0 && j == 0 && k == 1) - continue; + if (i == 0 && j == 0 && k == 1) + continue; - struct component *imem = create_simple_mem(4096); - init_simple_mem(imem, 0, - build_tests_simple_torus3d_test_bin_len, - build_tests_simple_torus3d_test_bin); + struct component *imem = + create_simple_mem(4096); + init_simple_mem(imem, 0, + build_tests_simple_torus3d_test_bin_len, + build_tests_simple_torus3d_test_bin); - uint64_t rcv = torus3d_addr(i, j, k, 0); - 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 */ - simple_riscv64_set_reg(rv64, 12, k); /* a2 */ - simple_riscv64_set_reg(rv64, 13, x); /* a3 */ - simple_riscv64_set_reg(rv64, 14, y); /* a4 */ - simple_riscv64_set_reg(rv64, 15, z); /* a5 */ + uint64_t rcv = torus3d_addr(i, j, k, 0); + 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 */ + simple_riscv64_set_reg(rv64, 12, k); /* a2 */ + simple_riscv64_set_reg(rv64, 13, x); /* a3 */ + simple_riscv64_set_reg(rv64, 14, y); /* a4 */ + simple_riscv64_set_reg(rv64, 15, z); /* a5 */ - clock_domain_add(clk, rv64); - clock_domain_add(clk, imem); + clock_domain_add(clk, rv64); + clock_domain_add(clk, imem); - pes[idx_1d(i, j, k, x, y, z)] = rv64; - } + pes[idx_1d(i, j, k, x, y, z)] = rv64; + } struct component *uart = create_simple_uart(); clock_domain_add(clk, uart); @@ -81,17 +87,19 @@ static stat build_torus3d(struct clock_domain *clk, uint8_t x, uint8_t y, uint8_ torus3d_connect_grid(grid, dmem, 0, 0, 1, x, y, z); for (int i = 0; i < x; ++i) - for (int j = 0; j < y; ++j) - for (int k = 0; k < z; ++k) { - if (i == 0 && j == 0 && k == 0) - continue; + for (int j = 0; j < y; ++j) + for (int k = 0; k < z; ++k) { + if (i == 0 && j == 0 && k == 0) + continue; - if (i == 0 && j == 0 && k == 1) - continue; + if (i == 0 && j == 0 && k == 1) + continue; - torus3d_connect_grid(grid, pes[idx_1d(i, j, k, x, y, z)], - i, j, k, x, y, z); - } + torus3d_connect_grid(grid, + pes[idx_1d(i, j, k, x, y, + z)], + i, j, k, x, y, z); + } free(grid); free(pes); diff --git a/tests/simple_torus3d/test.c b/tests/simple_torus3d/test.c index 2953d41..646b387 100644 --- a/tests/simple_torus3d/test.c +++ b/tests/simple_torus3d/test.c @@ -6,7 +6,8 @@ static inline void print_int8(volatile char *uart, unsigned x) } __attribute__((always_inline)) -static inline void print_addr(volatile char *uart, unsigned x, unsigned y, unsigned z) +static inline void print_addr(volatile char *uart, unsigned x, unsigned y, + unsigned z) { *uart = '('; print_int8(uart, x); @@ -27,7 +28,8 @@ static inline unsigned wrap(unsigned x, unsigned X) } __attribute__((always_inline)) -static inline unsigned next_idx(unsigned x, unsigned y, unsigned z, unsigned X, unsigned Y, unsigned Z) +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; @@ -36,7 +38,8 @@ static inline unsigned next_idx(unsigned x, unsigned y, unsigned z, unsigned X, return (xi << 16) | (yi << 8) | zi; } -void _start(unsigned x, unsigned y, unsigned z, unsigned X, unsigned Y, unsigned Z) +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 */ @@ -54,7 +57,7 @@ do_work: *control = next_idx(x, y, z, X, Y, Z); if (x == X - 1 && y == Y - 1 && z == Z - 1) - asm("ebreak"); + asm ("ebreak"); /* otherwise just loop */ while (1) {} diff --git a/tests/simple_uart/sim.c b/tests/simple_uart/sim.c index c0d1f82..a5cd813 100644 --- a/tests/simple_uart/sim.c +++ b/tests/simple_uart/sim.c @@ -10,12 +10,12 @@ #include <gran/cpu/riscv/simple_riscv64.h> unsigned char simple_hello[] = { - 0xb7, 0x17, 0x00, 0x00, 0x13, 0x07, 0x80, 0x04, 0x23, 0x80, 0xe7, 0x00, - 0x13, 0x07, 0x50, 0x06, 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0xc0, 0x06, - 0x23, 0x80, 0xe7, 0x00, 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0xf0, 0x06, - 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0x10, 0x02, 0x23, 0x80, 0xe7, 0x00, - 0x13, 0x07, 0xa0, 0x00, 0x23, 0x80, 0xe7, 0x00, 0x73, 0x00, 0x10, 0x00, - 0x67, 0x80, 0x00, 0x00 + 0xb7, 0x17, 0x00, 0x00, 0x13, 0x07, 0x80, 0x04, 0x23, 0x80, 0xe7, 0x00, + 0x13, 0x07, 0x50, 0x06, 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0xc0, 0x06, + 0x23, 0x80, 0xe7, 0x00, 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0xf0, 0x06, + 0x23, 0x80, 0xe7, 0x00, 0x13, 0x07, 0x10, 0x02, 0x23, 0x80, 0xe7, 0x00, + 0x13, 0x07, 0xa0, 0x00, 0x23, 0x80, 0xe7, 0x00, 0x73, 0x00, 0x10, 0x00, + 0x67, 0x80, 0x00, 0x00 }; unsigned int simple_hello_len = 64; 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 */ |
