aboutsummaryrefslogtreecommitdiff
path: root/tests/simple_torus3d
diff options
context:
space:
mode:
Diffstat (limited to 'tests/simple_torus3d')
-rw-r--r--tests/simple_torus3d/sim.c58
-rw-r--r--tests/simple_torus3d/source.mk25
2 files changed, 37 insertions, 46 deletions
diff --git a/tests/simple_torus3d/sim.c b/tests/simple_torus3d/sim.c
index c996c42..c53eed6 100644
--- a/tests/simple_torus3d/sim.c
+++ b/tests/simple_torus3d/sim.c
@@ -41,42 +41,40 @@ static stat build_torus3d(struct clock_domain *clk, uint8_t x, uint8_t y,
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_inc_bin_len,
+ build_tests_simple_torus3d_test_inc_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);
diff --git a/tests/simple_torus3d/source.mk b/tests/simple_torus3d/source.mk
index e045a3c..d376d05 100644
--- a/tests/simple_torus3d/source.mk
+++ b/tests/simple_torus3d/source.mk
@@ -1,18 +1,11 @@
-TORUS3D_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_torus3d/sim.c"
-TEST_PROGS += build/tests/simple_torus3d/sim
+SIMPLE_TORUS3D := tests/simple_torus3d
+SIMPLE_TORUS3D_SIM := $(SIMPLE_TORUS3D)/sim.c
-build/tests/simple_torus3d/test.inc: tests/simple_torus3d/test.c
- riscv64-unknown-elf-gcc -O2 -Wall -Wextra -ffreestanding -nostdlib \
- -march=rv64i -mabi=lp64 \
- -o build/tests/simple_torus3d/test \
- tests/simple_torus3d/test.c
- riscv64-unknown-elf-objcopy -Obinary \
- build/tests/simple_torus3d/test \
- build/tests/simple_torus3d/test.bin
- xxd -i build/tests/simple_torus3d/test.bin \
- > build/tests/simple_torus3d/test.inc
+TESTS += $(SIMPLE_TORUS3D)/sim
-build/tests/simple_torus3d/sim.o: build/tests/simple_torus3d/test.inc
-
-build/tests/simple_torus3d/sim: $(TORUS3D_TEST_OBJ) $(OBJS)
- $(COMPILE) $(TORUS3D_TEST_OBJ) $(OBJS) -o $@
+.PHONY: $(SIMPLE_TORUS3D)/sim
+$(SIMPLE_TORUS3D)/sim: $(SIMPLE_TORUS3D_SIM) libgran.a
+ mkdir -p build/$(SIMPLE_TORUS3D)
+ ./scripts/gen-rv64-fw -d build -o $(SIMPLE_TORUS3D)/test.inc $(SIMPLE_TORUS3D)/test.c
+ $(COMPILE_TEST) $(SIMPLE_TORUS3D_SIM) libgran.a -o build/$@
+ ./scripts/gen-report -d build $@