- 5
- 0
- 约4.1千字
- 约 7页
- 2020-03-17 发布于河北
- 举报
Lab1 作业
学号 姓名:崔雪莹
Exercise 1: What will be 32-bit hex code for the above two examples.
LW R2, 100(R3) 指令为读指令,读R3寄存器内容为首址,偏移地址为100的内容字,存到R2寄存器里,格式 LW rt, Imm(rs)。
编码为:100011 00011 00010 01100100
Bit
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Field
6-Bit Op Code
rs Field
rt Field
16-bit Immediate field
1
0
0
0
1
1
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
SW R5, 100(R6) 指令为写指令,将R5内容写入以R6寄存器内容为首址,偏移地址为100的地址,格式 SW rt, Imm(rs)。
编码为:101011 00110 00101 01100100
Bit
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Field
6-Bit Op Code
rs Field
rt Field
16-bit Immediate field
1
0
1
0
1
1
0
0
1
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
Exercise 2: Find 32-bit code for OR R7, R18, R12 and SUB R5, R4, R31
OR R7, R18, R12 位或操作,格式 OpCode rd, rs, rt
编码为:000000 10010 01100 00111 00000 100101
Bit
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Field
0 0 0 0 0 0
rs Field
rt Field
rd field
Shift Amount
Function Field
0
0
0
0
0
0
1
0
0
1
0
0
1
1
0
0
0
0
1
1
1
0
0
0
0
0
1
0
0
1
0
1
SUB R5, R4, R31 减法,格式 OpCode rd, rs, rt
编码为:000000 00100 11111 00101 00000 100010
Bit
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Field
0 0 0 0 0 0
rs Field
rt Field
rd field
Shift Amount
Function Field
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
1
0
1
0
0
0
0
0
1
0
0
0
1
0
Exercise 3: Find 32-bit code for BNEQ R7, R8, -5.
0000101 00111 01000 11111011
If the PC value for branch instruction is 124 what will be new value of PC if the branch is taken 124+4-5*4=108 .
-5的补码为 1111 1111 1111 1011
Bit
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Field
000100 for BEQ 000101 for BNEQ
rs Field
rt Field
Branch offset in Number of Instructions
0
0
0
1
0
1
0
0
1
1
1
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
Exercise 5:
What is the
原创力文档

文档评论(0)