diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..8fdd269 Binary files /dev/null and b/.DS_Store differ diff --git a/inputs/.DS_Store b/inputs/.DS_Store new file mode 100644 index 0000000..2fef42f Binary files /dev/null and b/inputs/.DS_Store differ diff --git a/inputs/addu/addu-1.ref.txt b/inputs/addu/addu-1.ref.txt index 054a1f3..301160a 100644 --- a/inputs/addu/addu-1.ref.txt +++ b/inputs/addu/addu-1.ref.txt @@ -1 +1 @@ -4294963199 \ No newline at end of file +8 \ No newline at end of file diff --git a/inputs/addu/addu-1.txt b/inputs/addu/addu-1.txt index 176ff1d..1c079df 100644 --- a/inputs/addu/addu-1.txt +++ b/inputs/addu/addu-1.txt @@ -1,8 +1,4 @@ -3404FFFF -3405F000 +34040003 +34050005 00851021 -00000008 -00000000 -00000000 -00000000 -00000000 \ No newline at end of file +00000008 \ No newline at end of file diff --git a/inputs/and/and-1.ref.txt b/inputs/and/and-1.ref.txt index 9a03714..a97788c 100644 --- a/inputs/and/and-1.ref.txt +++ b/inputs/and/and-1.ref.txt @@ -1 +1 @@ -10 \ No newline at end of file +2290649224 \ No newline at end of file diff --git a/inputs/and/and-1.txt b/inputs/and/and-1.txt index 24529d7..26f7011 100644 --- a/inputs/and/and-1.txt +++ b/inputs/and/and-1.txt @@ -1,4 +1,6 @@ -3404000A -3405000F +3c05cccc +3405cccc +3c04aaaa +3404aaaa 00851024 00000008 \ No newline at end of file diff --git a/inputs/andi/andi-1.ref.txt b/inputs/andi/andi-1.ref.txt index 7813681..6981cd9 100644 --- a/inputs/andi/andi-1.ref.txt +++ b/inputs/andi/andi-1.ref.txt @@ -1 +1 @@ -5 \ No newline at end of file +34952 \ No newline at end of file diff --git a/inputs/andi/andi-1.txt b/inputs/andi/andi-1.txt index 74b3184..ccc9aa9 100644 --- a/inputs/andi/andi-1.txt +++ b/inputs/andi/andi-1.txt @@ -1,5 +1,4 @@ -34040005 -3082000f -00000008 -00000000 -00000000 \ No newline at end of file +3c04aaaa +3404aaaa +3082cccc +00000008 \ No newline at end of file diff --git a/inputs/div/div-1.txt b/inputs/div/div-1.txt index 6dcc0f5..5753c5a 100644 --- a/inputs/div/div-1.txt +++ b/inputs/div/div-1.txt @@ -1,4 +1,7 @@ -34040004 -34050003 -0085001A +34040003 +34050009 +00A4001A +00002010 +00002812 +00851021 00000008 \ No newline at end of file diff --git a/inputs/divu/divu-1.ref.txt b/inputs/divu/divu-1.ref.txt new file mode 100644 index 0000000..bff4927 --- /dev/null +++ b/inputs/divu/divu-1.ref.txt @@ -0,0 +1 @@ +1073741824 \ No newline at end of file diff --git a/inputs/divu/divu-1.txt b/inputs/divu/divu-1.txt index 039725b..71c00bc 100644 --- a/inputs/divu/divu-1.txt +++ b/inputs/divu/divu-1.txt @@ -1,4 +1,7 @@ -34040004 -34050003 +34048000 +34050002 0085001B +00002010 +00002812 +00851021 00000008 \ No newline at end of file diff --git a/inputs/j/j-1.ref.txt b/inputs/j/j-1.ref.txt index c793025..56a6051 100644 --- a/inputs/j/j-1.ref.txt +++ b/inputs/j/j-1.ref.txt @@ -1 +1 @@ -7 \ No newline at end of file +1 \ No newline at end of file diff --git a/inputs/j/j-1.txt b/inputs/j/j-1.txt index 8955259..0043747 100644 --- a/inputs/j/j-1.txt +++ b/inputs/j/j-1.txt @@ -1,11 +1,6 @@ -083F0004 +08000004 00000000 -00000000 -00000000 -00000000 - 00000008 00000000 -34020007 -00000008 - +34020001 +00000008 \ No newline at end of file diff --git a/inputs/jalr/jalr-1.txt b/inputs/jalr/jalr-1.txt index e4e33a8..fc2bb83 100644 --- a/inputs/jalr/jalr-1.txt +++ b/inputs/jalr/jalr-1.txt @@ -1,5 +1,5 @@ -3405001C 3C05BCF0 +3405001C 00A02009 00000000 24420001 diff --git a/inputs/jr/jr-1.ref.txt b/inputs/jr/jr-1.ref.txt index 19c7bdb..56a6051 100644 --- a/inputs/jr/jr-1.ref.txt +++ b/inputs/jr/jr-1.ref.txt @@ -1 +1 @@ -16 \ No newline at end of file +1 \ No newline at end of file diff --git a/inputs/jr/jr-1.txt b/inputs/jr/jr-1.txt index 88a1c8f..010289b 100644 --- a/inputs/jr/jr-1.txt +++ b/inputs/jr/jr-1.txt @@ -1,7 +1,7 @@ 3C05BFC0 -34A50014 +34050014 00A00008 00000000 00000008 -34020010 +34020001 00000008 diff --git a/inputs/lwl/lwl-1.txt b/inputs/lwl/lwl-1.txt index c682e96..a62ec0b 100644 --- a/inputs/lwl/lwl-1.txt +++ b/inputs/lwl/lwl-1.txt @@ -1,4 +1,4 @@ -34041001 +34041003 34025678 88820003 00000008 \ No newline at end of file diff --git a/inputs/lwr/lwr-1.txt b/inputs/lwr/lwr-1.txt index cea76c4..633db20 100644 --- a/inputs/lwr/lwr-1.txt +++ b/inputs/lwr/lwr-1.txt @@ -1,4 +1,4 @@ -34041002 3C021234 -98820002 +34041002 +98820003 00000008 \ No newline at end of file diff --git a/inputs/mfhi/mfhi-1.ref.txt b/inputs/mfhi/mfhi-1.ref.txt deleted file mode 100644 index e440e5c..0000000 --- a/inputs/mfhi/mfhi-1.ref.txt +++ /dev/null @@ -1 +0,0 @@ -3 \ No newline at end of file diff --git a/inputs/mfhi/mfhi-1.txt b/inputs/mfhi/mfhi-1.txt deleted file mode 100644 index fd75215..0000000 --- a/inputs/mfhi/mfhi-1.txt +++ /dev/null @@ -1,4 +0,0 @@ -34040003 -00800011 -00001010 -00000008 \ No newline at end of file diff --git a/inputs/mflo/mflo-1.ref.txt b/inputs/mflo/mflo-1.ref.txt deleted file mode 100644 index 3cacc0b..0000000 --- a/inputs/mflo/mflo-1.ref.txt +++ /dev/null @@ -1 +0,0 @@ -12 \ No newline at end of file diff --git a/inputs/mflo/mflo-1.txt b/inputs/mflo/mflo-1.txt deleted file mode 100644 index db18ff6..0000000 --- a/inputs/mflo/mflo-1.txt +++ /dev/null @@ -1,5 +0,0 @@ -34040004 -34050003 -00850019 -00001012 -00000008 diff --git a/inputs/mthi/mthi-1.txt b/inputs/mthi/mthi-1.txt index a8cc125..d3675d4 100644 --- a/inputs/mthi/mthi-1.txt +++ b/inputs/mthi/mthi-1.txt @@ -1,3 +1,4 @@ 34040005 00800011 +00001010 00000008 \ No newline at end of file diff --git a/inputs/mtlo/mtlo-1.ref.txt b/inputs/mtlo/mtlo-1.ref.txt new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/inputs/mtlo/mtlo-1.ref.txt @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/inputs/mtlo/mtlo-1.txt b/inputs/mtlo/mtlo-1.txt index dc818bc..92e658f 100644 --- a/inputs/mtlo/mtlo-1.txt +++ b/inputs/mtlo/mtlo-1.txt @@ -1,3 +1,4 @@ 34040005 00800013 +00001012 00000008 \ No newline at end of file diff --git a/inputs/multcurrent/multcurrent-1.txt b/inputs/multcurrent/multcurrent-1.txt deleted file mode 100644 index 38f4bf0..0000000 --- a/inputs/multcurrent/multcurrent-1.txt +++ /dev/null @@ -1,4 +0,0 @@ -34040004 -34050003 -00850018 -00000008 \ No newline at end of file diff --git a/inputs/multucurrent/multucurrent-1.txt b/inputs/multucurrent/multucurrent-1.txt deleted file mode 100644 index 7f898e1..0000000 --- a/inputs/multucurrent/multucurrent-1.txt +++ /dev/null @@ -1,4 +0,0 @@ -34040004 -34050003 -00850019 -00000008 \ No newline at end of file diff --git a/inputs/ori/ori-1.ref.txt b/inputs/ori/ori-1.ref.txt index 301160a..c793025 100644 --- a/inputs/ori/ori-1.ref.txt +++ b/inputs/ori/ori-1.ref.txt @@ -1 +1 @@ -8 \ No newline at end of file +7 \ No newline at end of file diff --git a/inputs/ori/ori-1.txt b/inputs/ori/ori-1.txt index 3cc3faa..43a087f 100644 --- a/inputs/ori/ori-1.txt +++ b/inputs/ori/ori-1.txt @@ -1,8 +1,3 @@ +34020003 00000008 -34020008 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 \ No newline at end of file +34020005 \ No newline at end of file diff --git a/inputs/sb/sb-1.ref.txt b/inputs/sb/sb-1.ref.txt new file mode 100644 index 0000000..8bc6583 --- /dev/null +++ b/inputs/sb/sb-1.ref.txt @@ -0,0 +1 @@ +120 \ No newline at end of file diff --git a/inputs/sb/sb-1.txt b/inputs/sb/sb-1.txt index 01cfb59..a2e8fd6 100644 --- a/inputs/sb/sb-1.txt +++ b/inputs/sb/sb-1.txt @@ -1,4 +1,7 @@ -34040405 -34050001 -a0a40001 +3C041234 +34045678 +3C05BFC0 +3405001C +A0A40000 +80A20000 00000008 \ No newline at end of file diff --git a/inputs/sh/sh-1.ref.txt b/inputs/sh/sh-1.ref.txt new file mode 100644 index 0000000..2bb616a --- /dev/null +++ b/inputs/sh/sh-1.ref.txt @@ -0,0 +1 @@ +22136 \ No newline at end of file diff --git a/inputs/sh/sh-1.txt b/inputs/sh/sh-1.txt index e69de29..17b333d 100644 --- a/inputs/sh/sh-1.txt +++ b/inputs/sh/sh-1.txt @@ -0,0 +1,7 @@ +3C041234 +34045678 +3C05BFC0 +3405001C +A4A40000 +84A40000 +00000008 \ No newline at end of file diff --git a/inputs/slt/.DS_Store b/inputs/slt/.DS_Store new file mode 100644 index 0000000..a6c4cc6 Binary files /dev/null and b/inputs/slt/.DS_Store differ diff --git a/inputs/slt/slt-1.ref.txt b/inputs/slt/slt-1.ref.txt index 56a6051..c227083 100644 --- a/inputs/slt/slt-1.ref.txt +++ b/inputs/slt/slt-1.ref.txt @@ -1 +1 @@ -1 \ No newline at end of file +0 \ No newline at end of file diff --git a/reference/reference.txt b/reference.txt similarity index 89% rename from reference/reference.txt rename to reference.txt index 8afe438..3440da4 100644 --- a/reference/reference.txt +++ b/reference.txt @@ -36,7 +36,6 @@ LUI $5,0xCCCC ORI $5,$0,0xCCCC LUI $4,0xAAAA ORI $4,$0,0xAAAA - AND $2,$4,$5 JR $0 @@ -473,14 +472,14 @@ register_v0 = 0x12345678 ==LWL Load word left== -ORI $4,$0,0x1001 +ORI $4,$0,0x1003 ORI $2,$0,0x5678 LWL $2,3($4) JR $0 -Instruction Hex -34041001 +34041003 34025678 88820003 00000008 @@ -498,14 +497,14 @@ register_v0 = 0x12345678 LUI $2,0x1234 ORI $4,$0,0x1002 -LWR $2,2($4) +LWR $2,3($4) JR $0 -Instruction Hex 3C021234 34041002 -98820002 +98820003 00000008 -Memory Hex @@ -653,7 +652,7 @@ jr $0 00041080 00000008 -register_v0 = 16 +register_v0 = 12 ==SLLV Shift left logical variable== @@ -667,7 +666,7 @@ jr $0 00851004 00000008 -register_v0 = 16 +register_v0 = 12 ==SLT Set on less than (signed)== @@ -721,7 +720,7 @@ jr $0 register_v0 = 0 -==SRA Shift right arithmetic== +#==SRA Shift right arithmetic== ori $4,$0,2 sra $2,$4,1 diff --git a/reference/ibrahimreference.txt b/reference/ibrahimreference.txt deleted file mode 100644 index af79036..0000000 --- a/reference/ibrahimreference.txt +++ /dev/null @@ -1,483 +0,0 @@ -===== ADDIU ========== -int main(void) { - int a = -2147483648 + -32768 ; -} - -ORI $4,$0,-2147483648 -ADDIU $2,$4,-32768 -JR $0 - -//used to check for overflow 32768 is 2^15 which should -be sign extended. 21... is 2^31 - - -register_v0 = - -==========XORI Bitwise exclusive or immediate============= - -int main(void) { - int a = 5 ^ 2; -} - -ori $4,$0,5 -xori $2,$4,2 -jr $0 - -register 0 = 7 - -34040005 -38820002 -00000008 - -convert to little endian - -//////// - -====XOR Bitwise exclusive or========== - -int main(void) { - int a = 5 ^ 2; -} - -ori $4, $0, 5 -ori $5, $0, 2 -xor $2, $4, $5 -jr $0 - -register 0 = 7 - -34040005 -34050002 -00851026 -00000008 - -convert to little endian - -//////// - -========SW Store word============== - -int main(void) { - - -ori $4, $0, 5 -ori $5, $0, 1 -sw $4, 1($5) -jr $0 - -register 0 = 5 - -34040005 -34050001 -aca40001 -00000008 - - -=========== SUBU Subtract unsigned =========== - -int main(void) { - int a = 5-3; -} - -ori $4,$0,5 -ori $5,$0,3 -subu $2,$4,$5 -jr $0 - - -register_v0 = 2 - - -34040005 -34050003 -00851023 -00000008 - - -========= SRLV Shift right logical variable ====== - - -int main(void) { - int a = 2; - int b = 16>>a; -} - -ori $4,$0,2 -ori $5,$0,16 -srlv $2,$5,$4 -jr $0 - -register 0 = 3 - -34040002 -34050010 -////// -////// - -=============== SRL Shift right logical ============== - - -int main(void) { - int a = -2147483647>>2; #logical shift - should feed in 0s -} - -ori $4,$0,-2147483647 -srl $2,$4,$2 -jr $0 - -register 0 = 536870912 (2^29) - -34040001 -00041002 -00000008 - -========== SRAV Shift right arithmetic variable ======= - -int main(void) { - int a = 2; - int b = -2147483647>>2; #arithemtic shift not logical - feed in 1s (sign extension) -} - -ori $4, $0, 4 -ori $5,$0,0xF000 -srav $2,$5,$4 -SRAv $v0 $a1 $a0 -jr $0 - -register 0 = -536870912 (first 3 bits high - rest low) - -34040004 -3405F000 - -//////// -/////// - -====== SRA Shift right arithmetic ========== - -int main(void) { - int a = -2147483647>>2; #arithemtic shift not logical - feed in 1s (sign extension) -} - - -ori $4,$0,-2147483647 -sra $2,$4,$2 -jr $0 - -register 0 = -536870912 (first 3 bits high - rest low) - -34040001 -00041003 -00000008 - -======= SLTU Set on less than unsigned ===== - -int main() { - int a = 10; - int b = 9; - - max = a < b ? 1 : 0; - - return max; -} - - -ori $4, $0, 10 -ori $5, $0, 9 -sltu $2, $4, $5 -jr $0 - -register 0 = 0 - -3404000a -34050009 -0085102b -00000008 - -=========== SLTIU Set on less than immediate unsigned ================== - -int main() { - int a = 10; - - max = a < 9 ? 1 : 0; - - return max; -} - - -ori $4, $0, 10 -sltiu $2, $4, 9 -jr $0 - -register 0 = 0 - -3404000a -2c820009 -00000008 - -======= SLTI Set on less than immediate (signed) ======== - -int main() { - int a = 10; - - max = a < 9 ? 1 : 0; - - return max; -} - - -ori $4, $0, 10 -slti $2, $4, 9 -jr $0 - -register 0 = 0 - -3404000a -28820009 -00000008 - - - -======= SLLV Shift left logical variable ====== - - -int main(void) { - int a = 2; - int b = 3<