added load word immediate(lwi) pseudo-instruction
parent
b666aa05e9
commit
19e844f43e
20
assembler.rb
20
assembler.rb
|
@ -77,6 +77,7 @@ def ori(src, bits, dest)
|
|||
end
|
||||
|
||||
# store word
|
||||
# NOTE: this doesn't work unaligned
|
||||
def sw(src, offset, dest)
|
||||
# oooooo ddddd sssss iiiiiiii iiiiiiii
|
||||
op = 0b101011_00000_00000_00000000_00000000
|
||||
|
@ -93,6 +94,12 @@ def nop
|
|||
word 0x00000000
|
||||
end
|
||||
|
||||
# load word immediate
|
||||
def lwi(val, dest)
|
||||
lui val >> 16, dest
|
||||
ori dest, val, dest
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -137,20 +144,13 @@ nop ; jmp $base_addr + 16 ; nop ; word 0xdeadbeef
|
|||
# ops should always be in format of
|
||||
# src [args] -> dest
|
||||
|
||||
lui $gp0 >> 16, 1
|
||||
ori 1, $gp0, 1
|
||||
lwi $gp0, 1
|
||||
|
||||
nop
|
||||
|
||||
#lui 0, 3
|
||||
#ori 3, 0xffff, 3
|
||||
|
||||
#sw 1, 0, 2
|
||||
|
||||
32.times do |i|
|
||||
ori i, 0xf00d, i
|
||||
end
|
||||
lwi 0x10040, 2
|
||||
|
||||
sw 1, 0, 2
|
||||
|
||||
nop ; nop ; nop ; nop
|
||||
nop ; nop ; nop ; nop
|
||||
|
|
Loading…
Reference in New Issue