reference to with these instructions

This commit is contained in:
ibzmo 2020-12-18 23:15:04 +00:00
parent 044e972176
commit 88eadf4f27
10 changed files with 354 additions and 0 deletions

View file

@ -0,0 +1,90 @@
==========DIVU - Divide unsigned==========
divu - 2 // is it seperating quotients & remainders correctly
ori $4, $0, 4
ori $5, $0, 3
divu $4, $5
mfhi $4
mflo $5
addu $2,$4,$5
jr $0
ref file = 2
34040004
34050003
0085001B
00002010
00002812
00851021
00000008
divu - 3 // -ve/-ve
lui $4, $0, 65535
ori $4, $4, -4
lui $5, $0, 65535
ori $5, $0, -2
divu $4, $5
mflo $2
jr $0
reg file = 2
3c04ffff
34a4fffc
3c05ffff
34a5fffe
0085001B
00001012
00000008
divu - 4 // +ve/-ve
ori $4, $0, 4
lui $5, $0, 65535 (All 1s 16 bits)
ori $5, $5, -2
divu $4, $5
mflo $2
jr $0
reg file = -2
34040004
3c05ffff
3405fffe
0085001A
00001012
00000008
divu - 5 // is it seperating quotients & remainders correctly - when dealing with negatives
ori $4, $0, 4
lui $4, $4, 65535
ori $5, $0, 3
lui $5, $5, 65535
divu $4, $5
mfhi $4
mflo $5
addu $2,$4,$5
jr $0
ref file = 2 - as we are adding -1 and -1 using addu
34040004
34050003
0085001A
00002010
00002812
00851021
00000008

View file

@ -0,0 +1,48 @@
==SRAV Shift right arithmetic variable ==
srav -2 // Will it be able to handle shifts greater than the highest 1 value
ori $4,$0,6
ori $5,$0,16
srav $2,$5,$4
jr $0
ref = 0
34040006
34050010
00000008
00851007
srav - 3 // negative number - does it sign extened (negative)
lui $4, 0xFFFF
ori $4, $4, 0x00FF
ori $5, $0, 4
srav $2, $4, $5
jr $0
ref = FFFFF00F (4294963215 / -4081)
3c04ffff
348400ff
34050004
00000008
00A41007
srav - 4 // Does it sign extend 0s
lui $4, 0x0FFF
ori $4, $4, 0x00FF
ori $5, $0, 4
srav $2, $4, $5
jr $0
ref = 00FFF00F (16773135)
3c040fff
348400ff
34050004
00000008
00A41007

View file

@ -0,0 +1,48 @@
==SRAV Shift right arithmetic variable ==
srav -2 // Will it be able to handle shifts greater than the highest 1 value
ori $4,$0,6
ori $5,$0,16
srav $2,$5,$4
jr $0
ref = 0
34040006
34050010
00000008
00851007
srav - 3 // negative number - does it sign extened (negative)
lui $4, 0xFFFF
ori $4, $4, 0x00FF
ori $5, $0, 4
srav $2, $4, $5
jr $0
ref = FFFFF00F (4294963215 / -4081)
3c04ffff
348400ff
34050004
00000008
00A41007
srav - 4 // Does it sign extend 0s
lui $4, 0x0FFF
ori $4, $4, 0x00FF
ori $5, $0, 4
srav $2, $4, $5
jr $0
ref = 00FFF00F (16773135)
3c040fff
348400ff
34050004
00000008
00A41007

View file

@ -0,0 +1,28 @@
==SRLV Shift right logical ==
srl -2 // Will it be able to handle shifts greater than the highest 1 value
ori $4,$0,16
srl $2,$4,6
jr $0
ref = 0
34040010
00000008
00041182
srl - 3 // negative number - does it push in a 0? (not sign extend)
lui $4, 0xFFFF
ori $4, $4, 0x00FF
srl $2, $4, 4
jr $0
ref = 0FFFF00F (268431375)
3c04ffff
348400ff
00000008
00041102

View file

@ -0,0 +1,32 @@
==SRLV Shift right logical variable==
srlv -2 // Will it be able to handle shifts greater than the highest 1 value
ori $4,$0,6
ori $5,$0,16
srlv $2,$5,$4
jr $0
ref = 0
34040006
34050010
00000008
00851006
srlv - 3 // negative number - does it push in a 0? (not sign extend)
lui $4, 0xFFFF
ori $4, $4, 0x00FF
ori $5, $0, 4
srlv $2, $4, $5
jr $0
ref = 0FFFF00F (268431375)
3c04ffff
348400ff
34050004
00000008
00A41006

View file

@ -0,0 +1,36 @@
==SUBU Subtract unsigned==
subu - 2 // can it deal with "negative" outputs
ori $4,$0,5
ori $5,$0,3
subu $2,$5,$4
jr $0
34040005
34050003
00a41023
00000008
register_v0 = FFFFFFFE (4294967294)
subu - 3 // can it deal with 2 negatives
lui $4, 0xFFFF
ori $4, $4, 0xFFFE
lui $5, 0xFFFF
ori $5, $5, 0xFFFF
subu $2, $4, $5
jr $0
register_v0 = FFFFFFFF (4294967295)
3c04ffff
3484fffe
3c05ffff
34a5ffff
00851023
00000008

View file

@ -0,0 +1,3 @@
==SW Store word==
Negative & postive offset as well as actual functionality already tested

View file

@ -0,0 +1,29 @@
==XORI Bitwise exclusive or immediate==
xori -3 //checking if all 1s gives us 0 for the first 16 bits
lui $4, 0xFFFF
ori $4, $4, 0xFFFF
xori $2, $4, 0xFFFF
jr $0
ref = 4294901760 - (FFFF0000)
3c04ffff
3484ffff
3882ffff
00000008
xori -4 //should have all 1s
lui $4, 0xFFFF
ori $4, $4, 0xFFFF
xori $2, $4, 0x0000
jr $0
ref = 4294967295 - (FFFFFFFF)
3c04ffff
3484ffff
38820000
00000008

View file

@ -0,0 +1,40 @@
==XOR Bitwise exclusive or ==
xor -3 //checking if all 1s gives us 0 for all 1 inputs
lui $4, 0xFFFF
ori $4, $4, 0xFFFF
lui $5, 0xFFFF
ori $5, $5, 0xFFFF
xor $2, $4, $5
jr $0
ref = 0
3c04ffff
3484ffff
3c05ffff
34a5ffff
00851026
00000008
==XOR Bitwise exclusive or ==
xor -4 //checking if all 1s gives us 1 for all opposite inputs
lui $4, 0xFFFF
ori $4, $4, 0xFFFF
lui $5, 0x0000
ori $5, $5, 0x0000
xor $2, $4, $5
jr $0
ref = 4294967295 (FFFFFFFF)
3c04ffff
3484ffff
3c050000
34a50000
00851026
00000008