MIPS - shift register values ​​by a numerical value

Can someone explain this to me? The problem is this:

sll $t2, $t0, 44

and the goal is to find the value of $ t2 after the operation. Initial Values:

$t2 = 0x12345678
$t0 = 0xAAAAAAAA

I understand that the pseudocode translation "sll $ t2, $ t0, 44" is:

t2 = t0 << 44

and that binary representation of t0 and t2:

t2 = 10010001101000101011001111000
t0 = 10101010101010101010101010101010

But how do you shift 44 bits? I thought that for a start it costs only 32 bits. How to find the value of $ t2 by shifting $ t0 by 44 bits?

+4
source share
1 answer

Sometimes it is necessary to perform a change of the variable supplied through the third register: sllv $ s1, $ s2, $ s3 # s1 = s2 <s3 Implement the new sllv instruction using the real MIPS instructions.

: 0 31 (). $s3 32. "000 000... 0011111 = 0x1F. , $s3 .

sllv $s1,$s2,$s3 # s1 = s2 << s3
add $s1, $s2, $0 # s1 <- s2
add $t0, $s3, $0 # t0 <- s3 (s3 must be preserved)
andi $t0, $t0, 0x1F # take mod 32
beq $t0, $0, EXIT # if t0 == 0, do nothing
addi $t1, $0, 0 # set i == 0 (start from 0)
LOOP:
sll $s1, $s1, 1
addi $t1, $t1, 1 # i=i+1
bne $t1, $t0, LOOP # LOOP while i is still not equal to t0
EXIT:

, , , 32- 32 ( 36 4, ), , , .

+1

Source: https://habr.com/ru/post/1531393/


All Articles