aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/start.S
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-06-06 14:01:37 +0200
committerClifford Wolf <clifford@clifford.at>2015-06-06 14:14:32 +0200
commit77ba5a18973bd02b461ab96047acfcc3fb62cf7b (patch)
tree573afedb6a3a14c91224e16724fa21ba3a939de2 /firmware/start.S
downloadpicorv32-77ba5a18973bd02b461ab96047acfcc3fb62cf7b.tar.gz
picorv32-77ba5a18973bd02b461ab96047acfcc3fb62cf7b.zip
Initial import
Diffstat (limited to 'firmware/start.S')
-rw-r--r--firmware/start.S80
1 files changed, 80 insertions, 0 deletions
diff --git a/firmware/start.S b/firmware/start.S
new file mode 100644
index 0000000..34e44d8
--- /dev/null
+++ b/firmware/start.S
@@ -0,0 +1,80 @@
+ .section .text
+ .global start
+ .global sieve
+ .global stats
+
+#define TEST(n) \
+ .global n; .global n ## _ret; \
+ jal zero,n; n ## _ret:
+
+start:
+ TEST(lui)
+ TEST(auipc)
+ TEST(j)
+ TEST(jal)
+ TEST(jalr)
+
+ TEST(beq)
+ TEST(bne)
+ TEST(blt)
+ TEST(bge)
+ TEST(bltu)
+ TEST(bgeu)
+
+ TEST(lb)
+ TEST(lh)
+ TEST(lw)
+ TEST(lbu)
+ TEST(lhu)
+
+ TEST(sb)
+ TEST(sh)
+ TEST(sw)
+
+ TEST(addi)
+ TEST(slti) // also tests sltiu
+ TEST(xori)
+ TEST(ori)
+ TEST(andi)
+ TEST(slli)
+ TEST(srli)
+ TEST(srai)
+
+ TEST(add)
+ TEST(sub)
+ TEST(sll)
+ TEST(slt) // what is with sltu ?
+ TEST(xor)
+ TEST(srl)
+ TEST(sra)
+ TEST(or)
+ TEST(and)
+
+ TEST(fence_i)
+ TEST(simple)
+
+ /* set stack pointer */
+ lui sp,(64*1024)>>12
+
+ /* jump to sieve C code */
+ jal ra,sieve
+
+ /* jump to stats C code */
+ jal ra,stats
+
+ /* print "DONE\n" */
+ lui a0,0x10000000>>12
+ addi a1,zero,'D'
+ addi a2,zero,'O'
+ addi a3,zero,'N'
+ addi a4,zero,'E'
+ addi a5,zero,'\n'
+ sw a1,0(a0)
+ sw a2,0(a0)
+ sw a3,0(a0)
+ sw a4,0(a0)
+ sw a5,0(a0)
+
+ /* break */
+ sbreak
+