diff --git a/test_programs/.gitignore b/test_programs/.gitignore new file mode 100644 index 0000000..0a0178a --- /dev/null +++ b/test_programs/.gitignore @@ -0,0 +1,4 @@ +# Ignoring dump files +*.dump +*.o +./target \ No newline at end of file diff --git a/test_programs/Makefile b/test_programs/Makefile index e15867e..662a888 100644 --- a/test_programs/Makefile +++ b/test_programs/Makefile @@ -4,11 +4,10 @@ include $(TOPDIR)/Makefile.config # # Main targets # -objdumps: - $(MAKE) -C riscv_instructions - -programs: - $(MAKE) -C programs +dumps: + $(MAKE) dumps -C riscv_instructions/ + mkdir -p ${TOPDIR}/target + find . -name '*.dump' -exec mv {} ${TOPDIR}/target \; clean: rm -rf $(TOPDIR)/target \ No newline at end of file diff --git a/test_programs/Makefile.config b/test_programs/Makefile.config index fca5849..47436e8 100644 --- a/test_programs/Makefile.config +++ b/test_programs/Makefile.config @@ -11,8 +11,9 @@ RISCV_PREFIX=/opt/riscv/bin/ RISCV_AS = $(RISCV_PREFIX)riscv64-unknown-elf-gcc -x assembler-with-cpp -march=rv64imfd RISCV_GCC = $(RISCV_PREFIX)riscv64-unknown-elf-gcc RISCV_LD = $(RISCV_PREFIX)riscv64-unknown-elf-ld -RISCV_OBJDUMP = $(RISCV_PREFIX)riscv64-unknown-elf-objdump +RISCV_OBJCOPY = $(RISCV_PREFIX)riscv64-unknown-elf-objcopy +DUMP_FORMAT = ihex RISCV_ASFLAGS = $(RISCV_CPPFLAGS) RISCV_CPPFLAGS = #nil RISCV_CFLAGS = -Wall $(RISCV_CPPFLAGS) -march=rv64imfd -RISCV_LDFLAGS = #nil +RISCV_LDFLAGS = #nil \ No newline at end of file diff --git a/test_programs/Makefile.dumps b/test_programs/Makefile.dumps new file mode 100644 index 0000000..a9824c1 --- /dev/null +++ b/test_programs/Makefile.dumps @@ -0,0 +1,12 @@ +include $(TOPDIR)/Makefile.config + +%.o: %.c + $(RISCV_GCC) $(RISCV_CFLAGS) -c $< + + +%.dump: %.o + $(RISCV_OBJCOPY) -j .text -O $(DUMP_FORMAT) $< $@ + +clean: + rm -rf *.o 2> /dev/null + rm -rf *.dump 2> /dev/null \ No newline at end of file diff --git a/test_programs/Makefile.objdumps b/test_programs/Makefile.objdumps deleted file mode 100644 index 78a4520..0000000 --- a/test_programs/Makefile.objdumps +++ /dev/null @@ -1,24 +0,0 @@ -include $(TOPDIR)/Makefile.config - -COVERAGE = $(TOPDIR)/riscv_instructions - -AS = $(RISCV_AS) -c -GCC = $(RISCV_GCC) -LD = $(RISCV_LD) - -INCPATH += -I$(TOPDIR) -I$(COVERAGE) -ASFLAGS = $(RISCV_ASFLAGS) $(INCPATH) -CFLAGS = $(RISCV_CFLAGS) $(INCPATH) - -# Rules -%.a: - $(AR) rcv $@ $^ - -%.o: %.c - $(GCC) $(CFLAGS) -c $< - -%.o: %.s - $(AS) $(ASFLAGS) -c $< - -$(PROGRAMS): - $(LD) $+ -o $@ \ No newline at end of file diff --git a/test_programs/riscv_instructions/Makefile b/test_programs/riscv_instructions/Makefile index 29df4bd..c134d5f 100644 --- a/test_programs/riscv_instructions/Makefile +++ b/test_programs/riscv_instructions/Makefile @@ -1,2 +1,4 @@ -TOPDIR = ../ -include $(TOPDIR)/Makefile.objdumps +dumps: + make dumps -C boolean_logic/ + make dumps -C jump_instructions/ + make dumps -C simple_arithmetics/ \ No newline at end of file diff --git a/test_programs/riscv_instructions/boolean_logic/Makefile b/test_programs/riscv_instructions/boolean_logic/Makefile new file mode 100644 index 0000000..2150f14 --- /dev/null +++ b/test_programs/riscv_instructions/boolean_logic/Makefile @@ -0,0 +1,4 @@ +TOPDIR = ../.. +include $(TOPDIR)/Makefile.dumps + +dumps: comparisons.dump if.dump switch.dump \ No newline at end of file diff --git a/test_programs/riscv_instructions/jump_instructions/Makefile b/test_programs/riscv_instructions/jump_instructions/Makefile new file mode 100644 index 0000000..75b887b --- /dev/null +++ b/test_programs/riscv_instructions/jump_instructions/Makefile @@ -0,0 +1,4 @@ +TOPDIR = ../.. +include $(TOPDIR)/Makefile.dumps + +dumps: jump.dump ret.dump \ No newline at end of file diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.hex b/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.hex deleted file mode 100644 index d5a8502..0000000 --- a/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.hex +++ /dev/null @@ -1,15 +0,0 @@ -fe010113 -00813c23 -02010413 -fe042623 -00100793 -fef42423 -fec42783 -00078713 -fe842783 -00f707bb -fef42623 -00000013 -01813403 -02010113 -00008067 \ No newline at end of file diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.o b/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.o deleted file mode 100644 index 3d69445..0000000 Binary files a/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.o and /dev/null differ diff --git a/test_programs/riscv_instructions/simple_arithmetics/Makefile b/test_programs/riscv_instructions/simple_arithmetics/Makefile new file mode 100644 index 0000000..d775b97 --- /dev/null +++ b/test_programs/riscv_instructions/simple_arithmetics/Makefile @@ -0,0 +1,4 @@ +TOPDIR = ../.. +include $(TOPDIR)/Makefile.dumps + +dumps: unsigned_addition.dump unsigned_division.dump unsigned_multiplication.dump unsigned_substraction.dump \ No newline at end of file diff --git a/test_programs/riscv_instructions/simple_arithmerics/README.md b/test_programs/riscv_instructions/simple_arithmetics/README.md similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/README.md rename to test_programs/riscv_instructions/simple_arithmetics/README.md diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.c b/test_programs/riscv_instructions/simple_arithmetics/unsigned_addition.c similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/unsigned_addition.c rename to test_programs/riscv_instructions/simple_arithmetics/unsigned_addition.c diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_division.c b/test_programs/riscv_instructions/simple_arithmetics/unsigned_division.c similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/unsigned_division.c rename to test_programs/riscv_instructions/simple_arithmetics/unsigned_division.c diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_multiplication.c b/test_programs/riscv_instructions/simple_arithmetics/unsigned_multiplication.c similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/unsigned_multiplication.c rename to test_programs/riscv_instructions/simple_arithmetics/unsigned_multiplication.c diff --git a/test_programs/riscv_instructions/simple_arithmerics/unsigned_substraction.c b/test_programs/riscv_instructions/simple_arithmetics/unsigned_substraction.c similarity index 100% rename from test_programs/riscv_instructions/simple_arithmerics/unsigned_substraction.c rename to test_programs/riscv_instructions/simple_arithmetics/unsigned_substraction.c