also redid the get/set internal byte with builder

had to pimp register value to use a semblance of the dsl
using <= for bytes and << for words
This commit is contained in:
Torsten Ruger
2018-08-09 20:16:55 +03:00
parent 7002956e81
commit 99a95d40a6
4 changed files with 64 additions and 28 deletions

View File

@ -59,6 +59,13 @@ module Risc
assert_equal @r1 , ret.right
assert_equal :<< , ret.operator
end
def test_byte_to_reg
instr = @r0 <= @r1[1]
assert_equal ByteToReg , instr.class
assert_equal @r1 , instr.array
assert_equal @r0 , instr.register
assert_equal 1 , instr.index
end
def test_slot_to_reg
instr = @r0 << @r1[:next_message]
assert_equal SlotToReg , instr.class
@ -66,6 +73,13 @@ module Risc
assert_equal @r0 , instr.register
assert_equal 3 , instr.index
end
def test_reg_to_byte
instr = @r1[1] <= @r0
assert_equal RegToByte , instr.class
assert_equal @r1 , instr.array
assert_equal @r0 , instr.register
assert_equal 1 , instr.index
end
def test_reg_to_slot
instr = @r1[:next_message] << @r0
assert_equal RegToSlot , instr.class