Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
.
  • Loading branch information
Omer Khan authored and Omer Khan committed Nov 24, 2020
1 parent 2afa446 commit 123057c
Show file tree
Hide file tree
Showing 5 changed files with 622 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pa4/Makefile
@@ -0,0 +1,14 @@
HEADERS = simulator.h

default: simulator

simulator.o: simulator.c $(HEADERS)
gcc -c simulator.c -o simulator.o -ggdb -std=c99

simulator: simulator.o
gcc simulator.o -o simulator -ggdb -std=c99

clean:
-rm -f simulator.o
-rm -f simulator
-rm -f *.out mdump.txt cdump.txt pipe_trace.txt *.aux *.bbl *.blg *.log *.out *.synctex.gz
51 changes: 51 additions & 0 deletions pa4/fibonacci.asm
@@ -0,0 +1,51 @@
.text
addi $t9, $zero, 10
addi $t1, $zero, 0
addi $t2, $zero, 1
j fibonacci

fibonacci:
add $t3, $t2, $t1
add $t1, $zero, $t2
add $t2, $zero, $t3
addi $t5, $t5, 1
bne $t5, $t9, fibonacci
addi $zero, $zero, 1


.data
2048: .word 10
2049: .word 10
2050: .word 20
2051: .word 30
2052: .word 40
2053: .word 50
2054: .word 60
2055: .word 70
2056: .word 80
2057: .word 90
2058: .word 100
2059: .word 3
2060: .word 3
2061: .word 3
2062: .word 3
2063: .word
2064: .word 11
2065: .word 10
2066: .word 20
2067: .word 30
2068: .word 40
2069: .word 50
2070: .word 60
2071: .word 70
2072: .word 80
2073: .word 90
2074: .word 100
2075: .word 3
2076: .word 3
2077: .word 3
2078: .word 3
2079: .word 3
2080: .word 5


35 changes: 35 additions & 0 deletions pa4/mipsInstructionMap.h
@@ -0,0 +1,35 @@
/*
*
* mipsInstructionMap.h
*
* Defines instructions as a hex value for comparison
*
* Modified by Omer Khan
*
*/

// R-Type Instructions
#define RTYPEOP 0x0
#define ADD 0x20
#define SUB 0x21
#define AND 0x24
#define OR 0x25
#define SLL 0x0
#define SLT 0x2A
#define SRL 0x2
#define JR 0x8

// I-Type Instructions
#define LW 0x23
#define SW 0x2B
#define ANDI 0xC
#define ORI 0xD
#define LUI 0xF
#define BEQ 0x4
#define BNE 0x5
#define SLTI 0xA
#define ADDI 0x8

// J-Type Instructions
#define J 0x2
#define JAL 0x3

0 comments on commit 123057c

Please sign in to comment.