diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 000000000..39c60c5af --- /dev/null +++ b/test/.gitignore @@ -0,0 +1 @@ +*.v diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 000000000..8af9165c2 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,21 @@ +CC = riscv64-unknown-elf-gcc +OBJDUMP = riscv64-unknown-elf-objdump +ODFLAGS = +OBJCOPY = riscv64-unknown-elf-objcopy +OCFLAGS = +ASFLAGS = -c +CFLAGS = +LDFLAGS = + +TESTS = add_test + +.S.o: + $(CC) $(ASFLAGS) -o $@ $< + + +# .c.o: +# $(CC) $(CFLAGS) -o $@ -c $< +# .v: .S.o + +$(TESTS): $(TESTS).o + $(OBJCOPY) -O verilog -I elf64-little $< $@.v diff --git a/test/add_test.S b/test/add_test.S new file mode 100755 index 000000000..e72d31922 --- /dev/null +++ b/test/add_test.S @@ -0,0 +1,24 @@ +.text + nop + addi x1, x0, 1 + addi x2, x0, 1 + add x3, x1, x2 + add x3, x1, x2 + add x4, x2, x3 + add x5, x3, x4 + add x6, x4, x5 + add x7, x5, x6 + add x8, x6, x7 + csrw mstatus, x7 + add x9, x7, x8 + csrr x1, mstatus + nop +L0: jal x0, L1 + nop + nop + nop + nop +L1: jal x0, L0 + nop + nop + addi x1, x0, 55 \ No newline at end of file