diff options
author | m8pple <dt10@imperial.ac.uk> | 2014-10-16 13:44:26 +0100 |
---|---|---|
committer | m8pple <dt10@imperial.ac.uk> | 2014-10-16 13:44:26 +0100 |
commit | 39288a6d59759b1a57ba00b845a01c7973f37c09 (patch) | |
tree | fb83fd0e4acea7c9a1f7493b9251ce854e21b86e /fragments | |
parent | 904de2b44ee9ea9d38b71764d12fc6fe6546be3c (diff) | |
download | MipsCPU-39288a6d59759b1a57ba00b845a01c7973f37c09.tar.gz MipsCPU-39288a6d59759b1a57ba00b845a01c7973f37c09.zip |
Initial push.
Diffstat (limited to 'fragments')
-rw-r--r-- | fragments/f_addu-mips.bin | bin | 0 -> 8 bytes | |||
-rw-r--r-- | fragments/f_addu-mips.diss | 9 | ||||
-rw-r--r-- | fragments/f_addu.c | 4 | ||||
-rw-r--r-- | fragments/f_fibonacci-mips.bin | bin | 0 -> 104 bytes | |||
-rw-r--r-- | fragments/f_fibonacci-mips.diss | 33 | ||||
-rw-r--r-- | fragments/f_fibonacci.c | 8 |
6 files changed, 54 insertions, 0 deletions
diff --git a/fragments/f_addu-mips.bin b/fragments/f_addu-mips.bin Binary files differnew file mode 100644 index 0000000..062ccaa --- /dev/null +++ b/fragments/f_addu-mips.bin diff --git a/fragments/f_addu-mips.diss b/fragments/f_addu-mips.diss new file mode 100644 index 0000000..a52488d --- /dev/null +++ b/fragments/f_addu-mips.diss @@ -0,0 +1,9 @@ + +fragments/f_addu-mips.o: file format elf32-tradbigmips + + +Disassembly of section .text: + +00000000 <f_addu>: + 0: 03e00008 jr ra + 4: 00851021 addu v0,a0,a1 diff --git a/fragments/f_addu.c b/fragments/f_addu.c new file mode 100644 index 0000000..e6d31d1 --- /dev/null +++ b/fragments/f_addu.c @@ -0,0 +1,4 @@ +#include <stdint.h> + +uint32_t f_addu(uint32_t a, uint32_t b) +{ return a+b; } diff --git a/fragments/f_fibonacci-mips.bin b/fragments/f_fibonacci-mips.bin Binary files differnew file mode 100644 index 0000000..d43b968 --- /dev/null +++ b/fragments/f_fibonacci-mips.bin diff --git a/fragments/f_fibonacci-mips.diss b/fragments/f_fibonacci-mips.diss new file mode 100644 index 0000000..d126053 --- /dev/null +++ b/fragments/f_fibonacci-mips.diss @@ -0,0 +1,33 @@ + +fragments/f_fibonacci-mips.o: file format elf32-tradbigmips + + +Disassembly of section .text: + +00000000 <f_fibonacci>: + 0: 27bdffe0 addiu sp,sp,-32 + 4: 2c820002 sltiu v0,a0,2 + 8: afb20018 sw s2,24(sp) + c: afbf001c sw ra,28(sp) + 10: afb10014 sw s1,20(sp) + 14: afb00010 sw s0,16(sp) + 18: 14400011 bnez v0,60 <f_fibonacci+0x60> + 1c: 00809021 move s2,a0 + 20: 00808021 move s0,a0 + 24: 00008821 move s1,zero + 28: 2604ffff addiu a0,s0,-1 + 2c: 0c000000 jal 0 <f_fibonacci> + 30: 2610fffe addiu s0,s0,-2 + 34: 2e030002 sltiu v1,s0,2 + 38: 1060fffb beqz v1,28 <f_fibonacci+0x28> + 3c: 02228821 addu s1,s1,v0 + 40: 32520001 andi s2,s2,0x1 + 44: 8fbf001c lw ra,28(sp) + 48: 02321021 addu v0,s1,s2 + 4c: 8fb00010 lw s0,16(sp) + 50: 8fb20018 lw s2,24(sp) + 54: 8fb10014 lw s1,20(sp) + 58: 03e00008 jr ra + 5c: 27bd0020 addiu sp,sp,32 + 60: 08000011 j 44 <f_fibonacci+0x44> + 64: 00008821 move s1,zero diff --git a/fragments/f_fibonacci.c b/fragments/f_fibonacci.c new file mode 100644 index 0000000..ba28c63 --- /dev/null +++ b/fragments/f_fibonacci.c @@ -0,0 +1,8 @@ +#include <stdint.h> + +uint32_t f_fibonacci(uint32_t n) +{ + if(n<=1) + return n; + return f_fibonacci(n-1)+f_fibonacci(n-2); +} |