From 82c77b22605d691884be4c4e1e6bae8d66598d02 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 10 Aug 2025 21:37:15 +0300 Subject: make tests actually useful + Apparently quite a few components are currently broken, didn't even remember --- tests/simple_fat_bfly/sim.c | 4 +-- tests/simple_fat_bfly/source.mk | 25 +++++--------- tests/simple_ideal_alloc/source.mk | 12 ++++--- tests/simple_ideal_noc/sim.c | 4 +-- tests/simple_ideal_noc/source.mk | 25 +++++--------- tests/simple_mem/source.mk | 30 +++++++++------- tests/simple_mesh1d/sim.c | 4 +-- tests/simple_mesh1d/source.mk | 26 +++++--------- tests/simple_mesh2d/sim.c | 4 +-- tests/simple_mesh2d/source.mk | 25 +++++--------- tests/simple_mesh3d/sim.c | 4 +-- tests/simple_mesh3d/source.mk | 25 +++++--------- tests/simple_riscv64/source.mk | 11 +++--- tests/simple_torus3d/sim.c | 70 ++++++++++++++++++-------------------- tests/simple_torus3d/source.mk | 25 +++++--------- tests/simple_uart/source.mk | 10 +++--- tests/starved_mesh/source.mk | 11 +++--- 17 files changed, 142 insertions(+), 173 deletions(-) (limited to 'tests') diff --git a/tests/simple_fat_bfly/sim.c b/tests/simple_fat_bfly/sim.c index 98aa359..1d5e2b8 100644 --- a/tests/simple_fat_bfly/sim.c +++ b/tests/simple_fat_bfly/sim.c @@ -23,8 +23,8 @@ 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_inc_bin_len, + build_tests_simple_fat_bfly_test_inc_bin); uint64_t rcv = fat_bfly_addr(i, 0); struct component *rv64 = create_simple_riscv64(rcv, 0, diff --git a/tests/simple_fat_bfly/source.mk b/tests/simple_fat_bfly/source.mk index 9aae373..f8c357d 100644 --- a/tests/simple_fat_bfly/source.mk +++ b/tests/simple_fat_bfly/source.mk @@ -1,18 +1,11 @@ -FAT_BFLY_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_fat_bfly/sim.c" -TEST_PROGS += build/tests/simple_fat_bfly/sim +SIMPLE_BAT_FLY := tests/simple_fat_bfly +SIMPLE_BAT_FLY_SIM := $(SIMPLE_BAT_FLY)/sim.c -build/tests/simple_fat_bfly/test.inc: tests/simple_fat_bfly/test.c - riscv64-unknown-elf-gcc -O2 -Wall -Wextra -ffreestanding -nostdlib \ - -march=rv64i -mabi=lp64 \ - -o build/tests/simple_fat_bfly/test \ - tests/simple_fat_bfly/test.c - riscv64-unknown-elf-objcopy -Obinary \ - build/tests/simple_fat_bfly/test \ - build/tests/simple_fat_bfly/test.bin - xxd -i build/tests/simple_fat_bfly/test.bin \ - > build/tests/simple_fat_bfly/test.inc +TESTS += $(SIMPLE_BAT_FLY)/sim -build/tests/simple_fat_bfly/sim.o: build/tests/simple_fat_bfly/test.inc - -build/tests/simple_fat_bfly/sim: $(FAT_BFLY_TEST_OBJ) $(OBJS) - $(COMPILE) $(FAT_BFLY_TEST_OBJ) $(OBJS) -o $@ +.PHONY: $(SIMPLE_BAT_FLY)/sim +$(SIMPLE_BAT_FLY)/sim: $(SIMPLE_BAT_FLY_SIM) libgran.a + mkdir -p build/$(SIMPLE_BAT_FLY) + ./scripts/gen-rv64-fw -d build -o $(SIMPLE_BAT_FLY)/test.inc $(SIMPLE_BAT_FLY)/test.c + $(COMPILE_TEST) $(SIMPLE_BAT_FLY_SIM) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ diff --git a/tests/simple_ideal_alloc/source.mk b/tests/simple_ideal_alloc/source.mk index f797cdd..450c866 100644 --- a/tests/simple_ideal_alloc/source.mk +++ b/tests/simple_ideal_alloc/source.mk @@ -1,7 +1,9 @@ -ALLOC_TB_OBJ != ./scripts/gen-deps --sources "tests/simple_ideal_alloc/testbench.c" -IDEAL_ALLOC_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_ideal_alloc/sim.c" +SIMPLE_IDEAL_ALLOC := tests/simple_ideal_alloc +SIMPLE_IDEAL_ALLOC_SIM := $(SIMPLE_IDEAL_ALLOC)/testbench.c $(SIMPLE_IDEAL_ALLOC)/sim.c -TEST_PROGS += build/tests/simple_ideal_alloc/sim +TESTS += $(SIMPLE_IDEAL_ALLOC)/sim -build/tests/simple_ideal_alloc/sim: $(ALLOC_TB_OBJ) $(IDEAL_ALLOC_TEST_OBJ) $(OBJS) - $(COMPILE) $(ALLOC_TB_OBJ) $(IDEAL_ALLOC_TEST_OBJ) $(TEST_OBJS) $(OBJS) -o $@ +$(SIMPLE_IDEAL_ALLOC)/sim: $(SIMPLE_IDEAL_ALLOC_SIM) libgran.a + mkdir -p build/$(SIMPLE_IDEAL_ALLOC) + $(COMPILE_TEST) $(SIMPLE_IDEAL_ALLOC_SIM) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ diff --git a/tests/simple_ideal_noc/sim.c b/tests/simple_ideal_noc/sim.c index eb8f475..dd93375 100644 --- a/tests/simple_ideal_noc/sim.c +++ b/tests/simple_ideal_noc/sim.c @@ -24,8 +24,8 @@ 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_inc_bin_len, + build_tests_simple_ideal_noc_test_inc_bin); uint64_t rcv = ideal_noc_addr(i, 0); struct component *rv64 = create_simple_riscv64(rcv, 0, diff --git a/tests/simple_ideal_noc/source.mk b/tests/simple_ideal_noc/source.mk index 2cf271b..d8c3f27 100644 --- a/tests/simple_ideal_noc/source.mk +++ b/tests/simple_ideal_noc/source.mk @@ -1,18 +1,11 @@ -IDEAL_NOC_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_ideal_noc/sim.c" -TEST_PROGS += build/tests/simple_ideal_noc/sim +SIMPLE_IDEAL_NOC := tests/simple_ideal_noc +SIMPLE_IDEAL_NOC_SIM := $(SIMPLE_IDEAL_NOC)/sim.c -build/tests/simple_ideal_noc/test.inc: tests/simple_ideal_noc/test.c - riscv64-unknown-elf-gcc -O2 -Wall -Wextra -ffreestanding -nostdlib \ - -march=rv64i -mabi=lp64 \ - -o build/tests/simple_ideal_noc/test \ - tests/simple_ideal_noc/test.c - riscv64-unknown-elf-objcopy -Obinary \ - build/tests/simple_ideal_noc/test \ - build/tests/simple_ideal_noc/test.bin - xxd -i build/tests/simple_ideal_noc/test.bin \ - > build/tests/simple_ideal_noc/test.inc +TESTS += $(SIMPLE_IDEAL_NOC)/sim -build/tests/simple_ideal_noc/sim.o: build/tests/simple_ideal_noc/test.inc - -build/tests/simple_ideal_noc/sim: $(IDEAL_NOC_TEST_OBJ) $(OBJS) - $(COMPILE) $(IDEAL_NOC_TEST_OBJ) $(OBJS) -o $@ +.PHONY: $(SIMPLE_IDEAL_NOC)/sim +$(SIMPLE_IDEAL_NOC)/sim: $(SIMPLE_IDEAL_NOC_SIM) libgran.a + mkdir -p build/$(SIMPLE_IDEAL_NOC) + ./scripts/gen-rv64-fw -d build -o $(SIMPLE_IDEAL_NOC)/test.inc $(SIMPLE_IDEAL_NOC)/test.c + $(COMPILE_TEST) $(SIMPLE_IDEAL_NOC_SIM) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ diff --git a/tests/simple_mem/source.mk b/tests/simple_mem/source.mk index 3a65965..48cff7a 100644 --- a/tests/simple_mem/source.mk +++ b/tests/simple_mem/source.mk @@ -1,17 +1,21 @@ -TRAFFIC_OBJ != ./scripts/gen-deps --sources "tests/simple_mem/traffic_gen.c" -NO_BUS_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_mem/no_bus.c" -BUS_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_mem/bus.c" -MANY_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_mem/many.c" +SIMPLE_MEM := tests/simple_mem +SIMPLE_MEM_NO_BUS := $(SIMPLE_MEM)/traffic_gen.c $(SIMPLE_MEM)/no_bus.c +SIMPLE_MEM_BUS := $(SIMPLE_MEM)/traffic_gen.c $(SIMPLE_MEM)/bus.c +SIMPLE_MEM_MANY := $(SIMPLE_MEM)/traffic_gen.c $(SIMPLE_MEM)/many.c -TEST_PROGS += build/tests/simple_mem/no_bus \ - build/tests/simple_mem/bus \ - build/tests/simple_mem/many +TESTS += $(SIMPLE_MEM)/no_bus $(SIMPLE_MEM)/bus $(SIMPLE_MEM)/many -build/tests/simple_mem/no_bus: $(NO_BUS_TEST_OBJ) $(TRAFFIC_OBJ) $(OBJS) - $(COMPILE) $(NO_BUS_TEST_OBJ) $(TRAFFIC_OBJ) $(OBJS) -o $@ +build/$(SIMPLE_MEM): + mkdir -p $@ -build/tests/simple_mem/bus: $(BUS_TEST_OBJ) $(TRAFFIC_OBJ) $(OBJS) - $(COMPILE) $(BUS_TEST_OBJ) $(TRAFFIC_OBJ) $(OBJS) -o $@ +$(SIMPLE_MEM)/no_bus: build/$(SIMPLE_MEM) $(SIMPLE_MEM_NO_BUS) libgran.a + $(COMPILE_TEST) $(SIMPLE_MEM_NO_BUS) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ -build/tests/simple_mem/many: $(MANY_TEST_OBJ) $(TRAFFIC_OBJ) $(OBJS) - $(COMPILE) $(MANY_TEST_OBJ) $(TRAFFIC_OBJ) $(OBJS) -o $@ +$(SIMPLE_MEM)/bus: build/$(SIMPLE_MEM) $(SIMPLE_MEM_BUS) libgran.a + $(COMPILE_TEST) $(SIMPLE_MEM_BUS) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ + +$(SIMPLE_MEM)/many: build/$(SIMPLE_MEM) $(SIMPLE_MEM_MANY) libgran.a + $(COMPILE_TEST) $(SIMPLE_MEM_MANY) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ diff --git a/tests/simple_mesh1d/sim.c b/tests/simple_mesh1d/sim.c index 7479a27..48197a1 100644 --- a/tests/simple_mesh1d/sim.c +++ b/tests/simple_mesh1d/sim.c @@ -22,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_inc_bin_len, + build_tests_simple_mesh1d_test_inc_bin); uint64_t rcv = mesh1d_addr(i, j, 0); struct component *rv64 = create_simple_riscv64(rcv, 0, diff --git a/tests/simple_mesh1d/source.mk b/tests/simple_mesh1d/source.mk index 5013c6e..f2792c9 100644 --- a/tests/simple_mesh1d/source.mk +++ b/tests/simple_mesh1d/source.mk @@ -1,19 +1,11 @@ -MESH1D_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_mesh1d/sim.c" -TEST_PROGS += build/tests/simple_mesh1d/sim +SIMPLE_MESH1D := tests/simple_mesh1d +SIMPLE_MESH1D_SIM := $(SIMPLE_MESH1D)/sim.c -build/tests/simple_mesh1d/test.inc: tests/simple_mesh1d/test.c - riscv64-unknown-elf-gcc -O2 -Wall -Wextra -ffreestanding -nostdlib \ - -march=rv64i -mabi=lp64 \ - -fno-delete-null-pointer-checks \ - -o build/tests/simple_mesh1d/test \ - tests/simple_mesh1d/test.c - riscv64-unknown-elf-objcopy -Obinary \ - build/tests/simple_mesh1d/test \ - build/tests/simple_mesh1d/test.bin - xxd -i build/tests/simple_mesh1d/test.bin \ - > build/tests/simple_mesh1d/test.inc +TESTS += $(SIMPLE_MESH1D)/sim -build/tests/simple_mesh1d/sim.o: build/tests/simple_mesh1d/test.inc - -build/tests/simple_mesh1d/sim: $(MESH1D_TEST_OBJ) $(OBJS) - $(COMPILE) $(MESH1D_TEST_OBJ) $(OBJS) -o $@ +.PHONY: $(SIMPLE_MESH1D)/sim +$(SIMPLE_MESH1D)/sim: $(SIMPLE_MESH1D_SIM) libgran.a + mkdir -p build/$(SIMPLE_MESH1D) + ./scripts/gen-rv64-fw -d build -o $(SIMPLE_MESH1D)/test.inc $(SIMPLE_MESH1D)/test.c + $(COMPILE_TEST) $(SIMPLE_MESH1D_SIM) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ diff --git a/tests/simple_mesh2d/sim.c b/tests/simple_mesh2d/sim.c index cbce9f3..f3e213d 100644 --- a/tests/simple_mesh2d/sim.c +++ b/tests/simple_mesh2d/sim.c @@ -73,8 +73,8 @@ static stat build_mesh(struct clock_domain *clk, uint16_t x, uint16_t y) 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); + build_tests_simple_mesh2d_test_inc_bin_len, + build_tests_simple_mesh2d_test_inc_bin); uint64_t rcv = mesh2d_addr(i, j, 0, 0); struct component *rv64 = create_simple_riscv64(rcv, 0, diff --git a/tests/simple_mesh2d/source.mk b/tests/simple_mesh2d/source.mk index 525efa3..af80ab1 100644 --- a/tests/simple_mesh2d/source.mk +++ b/tests/simple_mesh2d/source.mk @@ -1,18 +1,11 @@ -MESH2D_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_mesh2d/sim.c" -TEST_PROGS += build/tests/simple_mesh2d/sim +SIMPLE_MESH2D := tests/simple_mesh2d +SIMPLE_MESH2D_SIM := $(SIMPLE_MESH2D)/sim.c -build/tests/simple_mesh2d/test.inc: tests/simple_mesh2d/test.c - riscv64-unknown-elf-gcc -O2 -Wall -Wextra -ffreestanding -nostdlib \ - -march=rv64i -mabi=lp64 \ - -o build/tests/simple_mesh2d/test \ - tests/simple_mesh2d/test.c - riscv64-unknown-elf-objcopy -Obinary \ - build/tests/simple_mesh2d/test \ - build/tests/simple_mesh2d/test.bin - xxd -i build/tests/simple_mesh2d/test.bin \ - > build/tests/simple_mesh2d/test.inc +TESTS += $(SIMPLE_MESH2D)/sim -build/tests/simple_mesh2d/sim.o: build/tests/simple_mesh2d/test.inc - -build/tests/simple_mesh2d/sim: $(MESH2D_TEST_OBJ) $(OBJS) - $(COMPILE) $(MESH2D_TEST_OBJ) $(OBJS) -o $@ +.PHONY: $(SIMPLE_MESH2D)/sim +$(SIMPLE_MESH2D)/sim: $(SIMPLE_MESH2D_SIM) libgran.a + mkdir -p build/$(SIMPLE_MESH2D) + ./scripts/gen-rv64-fw -d build -o $(SIMPLE_MESH2D)/test.inc $(SIMPLE_MESH2D)/test.c + $(COMPILE_TEST) $(SIMPLE_MESH2D_SIM) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ diff --git a/tests/simple_mesh3d/sim.c b/tests/simple_mesh3d/sim.c index f1663ef..768e9ef 100644 --- a/tests/simple_mesh3d/sim.c +++ b/tests/simple_mesh3d/sim.c @@ -82,8 +82,8 @@ static stat build_mesh3d(struct clock_domain *clk, uint8_t x, uint8_t y, 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_inc_bin_len, + build_tests_simple_mesh3d_test_inc_bin); uint64_t rcv = mesh3d_addr(i, j, k, 0, 0); struct component *rv64 = create_simple_riscv64(rcv, 0, diff --git a/tests/simple_mesh3d/source.mk b/tests/simple_mesh3d/source.mk index 30aea2c..36c2556 100644 --- a/tests/simple_mesh3d/source.mk +++ b/tests/simple_mesh3d/source.mk @@ -1,18 +1,11 @@ -MESH3D_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_mesh3d/sim.c" -TEST_PROGS += build/tests/simple_mesh3d/sim +SIMPLE_MESH3D := tests/simple_mesh3d +SIMPLE_MESH3D_SIM := $(SIMPLE_MESH3D)/sim.c -build/tests/simple_mesh3d/test.inc: tests/simple_mesh3d/test.c - riscv64-unknown-elf-gcc -O2 -Wall -Wextra -ffreestanding -nostdlib \ - -march=rv64i -mabi=lp64 \ - -o build/tests/simple_mesh3d/test \ - tests/simple_mesh3d/test.c - riscv64-unknown-elf-objcopy -Obinary \ - build/tests/simple_mesh3d/test \ - build/tests/simple_mesh3d/test.bin - xxd -i build/tests/simple_mesh3d/test.bin \ - > build/tests/simple_mesh3d/test.inc +TESTS += $(SIMPLE_MESH3D)/sim -build/tests/simple_mesh3d/sim.o: build/tests/simple_mesh3d/test.inc - -build/tests/simple_mesh3d/sim: $(MESH3D_TEST_OBJ) $(OBJS) - $(COMPILE) $(MESH3D_TEST_OBJ) $(OBJS) -o $@ +.PHONY: $(SIMPLE_MESH3D)/sim +$(SIMPLE_MESH3D)/sim: $(SIMPLE_MESH3D_SIM) libgran.a + mkdir -p build/$(SIMPLE_MESH3D) + ./scripts/gen-rv64-fw -d build -o $(SIMPLE_MESH3D)/test.inc $(SIMPLE_MESH3D)/test.c + $(COMPILE_TEST) $(SIMPLE_MESH3D_SIM) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ diff --git a/tests/simple_riscv64/source.mk b/tests/simple_riscv64/source.mk index fbc541d..e61d511 100644 --- a/tests/simple_riscv64/source.mk +++ b/tests/simple_riscv64/source.mk @@ -1,6 +1,9 @@ -RV64_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_riscv64/sim.c" +SIMPLE_RV64 := tests/simple_riscv64 +SIMPLE_RV64_SIM := $(SIMPLE_RV64)/sim.c -TEST_PROGS += build/tests/simple_riscv64/sim +TESTS += $(SIMPLE_RV64)/sim -build/tests/simple_riscv64/sim: $(RV64_TEST_OBJ) $(TEST_OBJS) $(OBJS) - $(COMPILE) $(RV64_TEST_OBJ) $(TEST_OBJS) $(OBJS) -o $@ +$(SIMPLE_RV64)/sim: $(SIMPLE_RV64_SIM) libgran.a + mkdir -p build/$(SIMPLE_RV64) + $(COMPILE_TEST) $(SIMPLE_RV64_SIM) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ 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; - - if (i == 0 && j == 0 && k == 0) - 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); - - 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); - - pes[idx_1d(i, j, k, x, y, z)] = rv64; - } + 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 == 1) + continue; + + 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 */ + + clock_domain_add(clk, rv64); + clock_domain_add(clk, imem); + + 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 $@ diff --git a/tests/simple_uart/source.mk b/tests/simple_uart/source.mk index a42a447..70f26a7 100644 --- a/tests/simple_uart/source.mk +++ b/tests/simple_uart/source.mk @@ -1,6 +1,8 @@ -UART_TEST_OBJ != ./scripts/gen-deps --sources "tests/simple_uart/sim.c" +SIMPLE_UART := tests/simple_uart +SIMPLE_UART_SIM := $(SIMPLE_UART)/sim.c -TEST_PROGS += build/tests/simple_uart/sim +TEST += $(SIMPLE_UART)/sim -build/tests/simple_uart/sim: $(UART_TEST_OBJ) $(OBJS) - $(COMPILE) $(UART_TEST_OBJ) $(TEST_OBJS) $(OBJS) -o $@ +$(SIMPLE_UART)/sim: $(SIMPLE_UART_SIM) libgran.a + $(COMPILE_TEST) $(SIMPLE_UART_SIM) libran.a -o build/$@ + ./scripts/gen-report -d build $@ diff --git a/tests/starved_mesh/source.mk b/tests/starved_mesh/source.mk index 2d3a6e8..0874aa5 100644 --- a/tests/starved_mesh/source.mk +++ b/tests/starved_mesh/source.mk @@ -1,6 +1,9 @@ -STARVED_TEST_OBJ != ./scripts/gen-deps --sources "tests/starved_mesh/sim.c" +STARVED_MESH := tests/starved_mesh +STARVED_MESH_SIM := $(STARVED_MESH)/sim.c -TEST_PROGS += build/tests/starved_mesh/sim +TESTS += $(STARVED_MESH)/sim -build/tests/starved_mesh/sim: $(STARVED_TEST_OBJ) $(OBJS) - $(COMPILE) $(STARVED_TEST_OBJ) $(OBJS) -o $@ +$(STARVED_MESH)/sim: $(STARVED_MESH_SIM) libgran.a + mkdir -p build/$(STARVED_MESH) + $(COMPILE_TEST) $(STARVED_MESH_SIM) libgran.a -o build/$@ + ./scripts/gen-report -d build $@ -- cgit v1.3