-
Notifications
You must be signed in to change notification settings - Fork 0
/
test instructions
47 lines (36 loc) · 1.72 KB
/
test instructions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
20010048 20020065 2003006c 2004006c 2005006f 20060020 20070057 2008006f
20090072 200a006c 200b0064 200c002e 200d000a 08000000 # prints hello world, loops back to beginning
2003006c # write 'l' to register $3
AC430064 # write from $3 to mem[$2 + 100]
8C050064 # load from mem[$2 + 100] to $5
Instructions to test my RAM:
asm
addi $1, $0, 1 # $1 = 1
addi $2, $0, 2 # $2 = 2
sw $1, 0($0) # mem[0] = $1
sw $2, 5($0) # mem[5] = $2
lw $3, 0($0) # $3 = mem[0]
lw $4, 5($0) # $4 = mem[5]
hex
20010001
20020002
AC010000
AC020005
8C030000
8C040005
# After running this code, we should have $1 = 1, $2 = 2, $3 = 1, $4 = 2, mem[0] = 1 and mem[5] = 2.
----------------
hello world
addi r1, r0, 0x48 # 00100000000000010000000001001000 # 0x20010048 # 'H' to $1
addi r2, r0, 0x65 # 00100000000000100000000001100101 # 0x20020065 # 'e' to $2
addi r3, r0, 0x6c # 00100000000000110000000001101100 # 0x2003006C # 'l' to $3
addi r4, r0, 0x6c # 00100000000001000000000001101100 # 0x2004006C # 'l' to $4
addi r5, r0, 0x6f # 00100000000001010000000001101111 # 0x2005006F # 'o' to $5
addi r6, r0, 0x20 # 00100000000001100000000000100000 # 0x20060020 # ' ' to $6
addi r7, r0, 0x57 # 00100000000001110000000001010111 # 0x20070057 # 'W' to $7
addi r8, r0, 0x6f # 00100000000010000000000001101111 # 0x2008006F # 'o' to $8
addi r9, r0, 0x72 # 00100000000010010000000001110010 # 0x20090072 # 'r' to $9
addi r10, r0, 0x6c # 00100000000010100000000001101100 # 0x200A006C # 'l' to $10
addi r11, r0, 0x64 # 00100000000010110000000001100100 # 0x200B0064 # 'd' to $11
addi r12, r0, 0x2e # 00100000000011000000000000101110 # 0x200C002E # '.' to $12
addi r13, r0, 0xa # 00100000000011010000000000001010 # 0x200D000A # '\n' to $13