mirror of
https://github.com/supleed2/ELEC50010-IAC-CW.git
synced 2024-12-22 21:35:48 +00:00
All instructions except load finished - some test cases may need changing upon review
This commit is contained in:
parent
04b1ed4fed
commit
1bf7b5d40e
4
inputs/div.txt
Normal file
4
inputs/div.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
34040004
|
||||
34050003
|
||||
0085001A
|
||||
00000008
|
4
inputs/divu.txt
Normal file
4
inputs/divu.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
34040004
|
||||
34050003
|
||||
0085001B
|
||||
00000008
|
|
@ -271,4 +271,211 @@ register 0 = 16
|
|||
|
||||
34040003
|
||||
00041080
|
||||
00000008
|
||||
|
||||
======== SB Store byte =======
|
||||
|
||||
ori $4, $0, 1029
|
||||
ori $5, $0, 1
|
||||
sb $4, 1($5)
|
||||
jr $0
|
||||
|
||||
register 0 = 5
|
||||
|
||||
34040405
|
||||
34050001
|
||||
a0a40001
|
||||
00000008
|
||||
|
||||
======== ORI Bitwise or immediate ===
|
||||
|
||||
ori $4,$0,3
|
||||
jr $0
|
||||
|
||||
register a0 = 3
|
||||
|
||||
34040003
|
||||
00000008
|
||||
|
||||
======== OR Bitwise or ===
|
||||
|
||||
int main(){
|
||||
int a =5;
|
||||
int b= 3;
|
||||
|
||||
int c = 5 | 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ori $4, $0, 5
|
||||
ori $5, $0, 3
|
||||
or $2, $4, $5
|
||||
jr $0
|
||||
|
||||
|
||||
34040005
|
||||
34050003
|
||||
00851025
|
||||
00000008
|
||||
|
||||
register 0 = 7
|
||||
|
||||
======= MULT Multiply =====
|
||||
|
||||
ori $4, $0, 4
|
||||
ori $5, $0, 3
|
||||
mult $4, $5
|
||||
jr $0
|
||||
|
||||
$LO = 12
|
||||
|
||||
34040004
|
||||
34050003
|
||||
00850018
|
||||
00000008
|
||||
|
||||
|
||||
======= MULT Multiply =====
|
||||
|
||||
ori $4, $0, 4
|
||||
ori $5, $0, 3
|
||||
mult $4, $5
|
||||
mflo $2
|
||||
jr $0
|
||||
|
||||
register v0 = 12
|
||||
|
||||
34040004
|
||||
34050003
|
||||
00850018
|
||||
00001012
|
||||
00000008
|
||||
|
||||
======= MULTU Multiply unsigned =====
|
||||
|
||||
ori $4, $0, 4
|
||||
ori $5, $0, 3
|
||||
multu $4, $5
|
||||
jr $0
|
||||
|
||||
|
||||
$LO = 12
|
||||
|
||||
34040004
|
||||
34050003
|
||||
00850019
|
||||
00000008
|
||||
|
||||
|
||||
======= MULTU Multiply unsigned =====
|
||||
|
||||
ori $4, $0, 4
|
||||
ori $5, $0, 3
|
||||
multu $4, $5
|
||||
mflo $2
|
||||
jr $0
|
||||
|
||||
|
||||
$2 = 12
|
||||
|
||||
34040004
|
||||
34050003
|
||||
00850019
|
||||
00001012
|
||||
00000008
|
||||
|
||||
======= MFLO Move from lo ======
|
||||
|
||||
ori $4, $0, 4
|
||||
ori $5, $0, 3
|
||||
multu $4, $5
|
||||
mflo $2
|
||||
jr $0
|
||||
|
||||
|
||||
$2 = 12
|
||||
|
||||
34040004
|
||||
34050003
|
||||
00850019
|
||||
00001012
|
||||
00000008
|
||||
|
||||
=========== MFHI Move from Hi ==========
|
||||
|
||||
ori $4, $0, 3
|
||||
mthi $4
|
||||
mfhi $2
|
||||
jr $0
|
||||
|
||||
register v0 = 3
|
||||
|
||||
34040003
|
||||
00800011
|
||||
00001010
|
||||
00000008
|
||||
|
||||
======== MTHI Move to HI ====
|
||||
|
||||
ori $4, $0, 5
|
||||
mthi $4
|
||||
jr $0
|
||||
|
||||
|
||||
$HI = 5
|
||||
|
||||
34040005
|
||||
00800011
|
||||
00000008
|
||||
|
||||
======= MTLO Move to LO ===
|
||||
|
||||
ori $4, $0, 5
|
||||
mtlo $4
|
||||
jr $0
|
||||
|
||||
|
||||
$HI = 5
|
||||
|
||||
34040005
|
||||
00800013
|
||||
00000008
|
||||
|
||||
==================== SH Store half-word =======
|
||||
|
||||
/////////
|
||||
|
||||
|
||||
======== DIV Divide ======
|
||||
|
||||
|
||||
ori $4, $0, 4
|
||||
ori $5, $0, 3
|
||||
div $4, $5
|
||||
jr $0
|
||||
|
||||
|
||||
$LO = 1
|
||||
$HI = 1
|
||||
|
||||
34040004
|
||||
34050003
|
||||
0085001A
|
||||
00000008
|
||||
|
||||
========= DIVU Divide unsigned =====
|
||||
|
||||
ori $4, $0, 4
|
||||
ori $5, $0, 3
|
||||
divu $4, $5
|
||||
jr $0
|
||||
|
||||
$LO = 1
|
||||
$HI = 1
|
||||
|
||||
34040004
|
||||
34050003
|
||||
0085001B
|
||||
00000008
|
4
inputs/mfhi.txt
Normal file
4
inputs/mfhi.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
34040003
|
||||
00800011
|
||||
00001010
|
||||
00000008
|
5
inputs/mflo.txt
Normal file
5
inputs/mflo.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
34040004
|
||||
34050003
|
||||
00850019
|
||||
00001012
|
||||
00000008
|
3
inputs/mthi.txt
Normal file
3
inputs/mthi.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
34040005
|
||||
00800011
|
||||
00000008
|
3
inputs/mtlo.txt
Normal file
3
inputs/mtlo.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
34040005
|
||||
00800013
|
||||
00000008
|
5
inputs/mult.txt
Normal file
5
inputs/mult.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
34040004
|
||||
34050003
|
||||
00850018
|
||||
00001012
|
||||
00000008
|
4
inputs/multcurrent.txt
Normal file
4
inputs/multcurrent.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
34040004
|
||||
34050003
|
||||
00850018
|
||||
00000008
|
5
inputs/multu.txt
Normal file
5
inputs/multu.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
34040004
|
||||
34050003
|
||||
00850019
|
||||
00001012
|
||||
00000008
|
4
inputs/multucurrent.txt
Normal file
4
inputs/multucurrent.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
34040004
|
||||
34050003
|
||||
00850019
|
||||
00000008
|
4
inputs/or.txt
Normal file
4
inputs/or.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
34040005
|
||||
34050003
|
||||
00851025
|
||||
00000008
|
|
@ -1,8 +1,2 @@
|
|||
34040003
|
||||
00000008
|
||||
00000000
|
||||
00000000
|
||||
00000000
|
||||
00000000
|
||||
00000000
|
||||
00000000
|
|
@ -330,13 +330,21 @@ LW Load word
|
|||
LWL Load word left
|
||||
LWR Load word right
|
||||
|
||||
// DIVU Divide unsigned
|
||||
|
||||
// DIV Divide
|
||||
|
||||
//MFHI Move from Hi
|
||||
|
||||
//MFLO Move from lo
|
||||
|
||||
//MTHI Move to HI
|
||||
|
||||
//MTLO Move to LO
|
||||
|
||||
//MULT Multiply
|
||||
//MULT Multiply**
|
||||
|
||||
//MULTU Multiply unsigned
|
||||
//MULTU Multiply unsigned**
|
||||
|
||||
//OR Bitwise or
|
||||
|
||||
|
@ -344,11 +352,11 @@ LWR Load word right
|
|||
|
||||
//SB Store byte
|
||||
|
||||
//SH Store half-word
|
||||
//SH Store half-word**
|
||||
|
||||
//SLL Shift left logical
|
||||
|
||||
//SLLV Shift left logical variable
|
||||
//SLLV Shift left logical variable **
|
||||
|
||||
//SLT Set on less than (signed)
|
||||
|
||||
|
@ -360,11 +368,11 @@ LWR Load word right
|
|||
|
||||
//SRA Shift right arithmetic
|
||||
|
||||
//SRAV Shift right arithmetic
|
||||
//SRAV Shift right arithmetic**
|
||||
|
||||
//SRL Shift right logical
|
||||
|
||||
//SRLV Shift right logical variable
|
||||
//SRLV Shift right logical variable**
|
||||
|
||||
//SUBU Subtract unsigned
|
||||
|
||||
|
|
4
inputs/sb.txt
Normal file
4
inputs/sb.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
34040405
|
||||
34050001
|
||||
a0a40001
|
||||
00000008
|
0
inputs/sh.txt
Normal file
0
inputs/sh.txt
Normal file
Loading…
Reference in a new issue