cpu/test/test.S

108 lines
2.1 KiB
ArmAsm
Raw Normal View History

2020-09-27 18:04:08 -06:00
.global _start
.text
_start:
2020-10-03 13:49:14 -06:00
add x1, x0, x0
add x2, x0, x0
add x3, x0, x0
add x4, x0, x0
add x5, x0, x0
add x6, x0, x0
add x7, x0, x0
add x8, x0, x0
add x9, x0, x0
add x10, x0, x0
add x11, x0, x0
add x12, x0, x0
add x13, x0, x0
add x14, x0, x0
add x15, x0, x0
add x16, x0, x0
add x17, x0, x0
add x18, x0, x0
add x19, x0, x0
add x20, x0, x0
add x21, x0, x0
add x22, x0, x0
add x23, x0, x0
add x24, x0, x0
add x25, x0, x0
add x26, x0, x0
add x27, x0, x0
add x28, x0, x0
add x29, x0, x0
add x30, x0, x0
add x31, x0, x0
# NOTE: nop required because cpu currently does not detect when something is needed from a later stage of the pipeline.
# 4 clocks allows one instruction to finish before the next starts
# lui
nop
nop
nop
lui x1, 0xfedcb # x1 = 0xfedcb000
# addi
nop
nop
nop
addi x1, x1, 0x789 # x1 = 0xfedcb789
addi x2, x0, -1 # x2 = 0xffffffff
nop
nop
addi x3, x1, -0x777 # x3 = 0xfedcb012
# add
nop
nop
nop
add x4, x1, x2 # x4 = 0xfedcb788
# sub
nop
nop
nop
add x5, x1, x3 # x5 = 0x00000777 incorrect
# and
nop
nop
nop
and x6, x1, x2 # x6 = 0xfedcb789
and x7, x1, x0 # x7 = 0x00000000
and x8, x4, x3 # x8 = 0xfedcb002 incorrect
# or
nop
nop
nop
or x9, x1, x2 # x9 = 0xffffffff
or x10, x1, x0 # x10 = 0xfedcb789
or x11, x4, x3 # x11 = 0x0xfedcb798 incorrect
nop
nop
nop
addi x31, x0, 1 # x1 = 1
2020-09-27 18:04:08 -06:00
loop:
2020-10-03 13:49:14 -06:00
nop
nop
nop
addi x31, x31, 1 # increment x1
nop
nop
nop
j loop # loop forever
nop
nop
nop
nop
nop
nop
2020-09-27 18:04:08 -06:00
.data