ELEC50010-IAC-CW/reference/edgecases/sravref.txt
2020-12-20 10:32:11 +00:00

43 lines
525 B
Plaintext

==SRA Shift right arithmetic ==
sra -3 // Will it be able to handle shifts greater than the highest 1 value
ori $4,$0,16
sra $2,$4, 6
jr $0
ref = 0
34040010
00000008
00041183
sra- 4 // negative number - does it sign extened (negative)
lui $4, 0xFFFF
ori $4, $4, 0x00FF
sra $2, $4, 4
jr $0
ref = FFFFF00F (4294963215 / -4081)
3c04ffff
348400ff
00000008
00041103
sra - 5 // Does it sign extend 0s
lui $4, 0x0FFF
ori $4, $4, 0x00FF
sra $2, $4, 4
jr $0
ref = 00FFF00F (16773135)
3c040fff
348400ff
00000008
00041103