微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

带有 OR 和 AND 符号的 MIPS CODE 数学表达式

如何解决带有 OR 和 AND 符号的 MIPS CODE 数学表达式

有人可以帮助我如何在 MIPS 代码中使用 OR 和 AND 在这个方程中 ?[25] = [(? ∗ c/512 + ? ∗ ?) |16]&[?|? ∗ c/16 − ?[18]]

(? ∗ c/512 + ? ∗ ?) |16 或在这里使用

?|? 或者在这里使用。 and 用在两个表达式之间。

请帮忙!因为我已经完成了将近一半,剩下的一半。


print: .asciiz "  ?[25] = [(? ∗ c/512 + ? ∗ ?) |16]&[?|? ∗ c/16 − ?[18]] =   "
space: .asciiz "  "
A: .word 12 2 3 4 5 6 7 7 8 3 6 2 4 1 5 6 3 7 4 8 5 4 3 2 1
B: .word 23 2 3 4 5 6 7 7 8 3 6 2 4 1 5 6 3 7 
a: .word 4
b: .word 2
l: .word 6
c: .word 1024


.text

main:
#get the integer input n from user
    lw $t0,a # $t0 = a = 4
    lw $t1,b # $t1 = b = 2
    lw $t2,l # $t2 = l = 6
    lw $t3,c # $t3 = c = 512
    la $s5,A # $s5 = A[25] = .....total 25 indexes data
    la $s7,B # $s7 = B[18] = .....total 18 indexes data
    lw $t4,96($s5) # $t4 = A[25] = 1
    lw $t5,68($s7) # $t5 = B[18] = 7```
    
    srl $t6,$t3,9  # $t6 = c/512 = 1
    #showing c/512 = 1
    #li $v0,1
    #move $a0,$t6
    #add $t7,$t7,$t0
    sll $t7,$t0,1 # $t7 = 8 = a * c/512
    sll $s0,$t2,1 # $s0 = 12 = l ^ b
    add $s2,$s0 # a * c/512 + l ^ b ////  8 + 12 in $s2 = 20
    ori $s2,$s2,16
    
    li $v0,1
    move $a0,$s2
    syscall'''

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。