给出lw、sw、lui 、beq 、bne、j 、addi 、add 、and 的指令列表,包括指令格式、汇编语句、指令类型、指令代码和功能说明
时间: 2023-07-03 08:06:00 浏览: 210
1. 指令格式、汇编语句、指令类型、指令代码和功能说明如下:
lw $rt, offset($rs) # I-Type 100011 加载字指令,将地址为 $rs + offset 处的数据存入 $rt 中。
sw $rt, offset($rs) # I-Type 101011 存储字指令,将 $rt 中的数据存入地址为 $rs + offset 的存储器单元中。
lui $rt, immediate # I-Type 001111 将 16 位立即数 immediate 左移 16 位,存入 $rt 的高 16 位,低 16 位为 0。
beq $rs, $rt, offset # I-Type 000100 分支相等指令,如果 $rs 和 $rt 相等,则跳转到当前 PC 加上 offset 所存储的相对偏移量的地址处。
bne $rs, $rt, offset # I-Type 000101 分支不相等指令,如果 $rs 和 $rt 不相等,则跳转到当前 PC 加上 offset 所存储的相对偏移量的地址处。
j target # J-Type 000010 跳转指令,将 PC 设置为 target 所存储的地址,其中 target 的低 2 位为 0。
addi $rt, $rs, immediate # I-Type 001000 加立即数指令,将 $rs 和 immediate 相加的结果存入 $rt 中。
add $rd, $rs, $rt # R-Type 000000 100000 加指令,将 $rs 和 $rt 相加的结果存入 $rd 中。
and $rd, $rs, $rt # R-Type 000000 100100 与指令,将 $rs 和 $rt 逐位相与的结果存入 $rd 中。
2. 指令列表如下:
指令 | 格式 | 汇编语句 | 类型 | 代码 | 功能说明
----|------|----------|------|------|-------
lw | I-Type | lw $rt, offset($rs) | 加载字指令 | 100011 | 将地址为 $rs + offset 处的数据存入 $rt 中。
sw | I-Type | sw $rt, offset($rs) | 存储字指令 | 101011 | 将 $rt 中的数据存入地址为 $rs + offset 的存储器单元中。
lui | I-Type | lui $rt, immediate | 加载立即数指令 | 001111 | 将 16 位立即数 immediate 左移 16 位,存入 $rt 的高 16 位,低 16 位为 0。
beq | I-Type | beq $rs, $rt, offset | 分支相等指令 | 000100 | 如果 $rs 和 $rt 相等,则跳转到当前 PC 加上 offset 所存储的相对偏移量的地址处。
bne | I-Type | bne $rs, $rt, offset | 分支不相等指令 | 000101 | 如果 $rs 和 $rt 不相等,则跳转到当前 PC 加上 offset 所存储的相对偏移量的地址处。
j | J-Type | j target | 跳转指令 | 000010 | 将 PC 设置为 target 所存储的地址,其中 target 的低 2 位为 0。
addi| I-Type | addi $rt, $rs, immediate | 加立即数指令 | 001000 | 将 $rs 和 immediate 相加的结果存入 $rt 中。
add | R-Type | add $rd, $rs, $rt | 加指令 | 000000 100000 | 将 $rs 和 $rt 相加的结果存入 $rd 中。
and | R-Type | and $rd, $rs, $rt | 与指令 | 000000 100100 | 将 $rs 和 $rt 逐位相与的结果存入 $rd 中。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)