not wrapping the cpu initial jump anymore

also introduce padding after cpu_init (wip)
This commit is contained in:
Torsten Ruger
2018-05-12 18:36:59 +03:00
parent 232fe67c09
commit 2d901bf7b6
5 changed files with 26 additions and 42 deletions

View File

@ -8,8 +8,8 @@ module Arm
# the address is what an assembler calculates (a signed number for the amount of instructions),
# ie the relative (to pc) address -8 (pipeline) /4 so save space
# so the cpu adds the value*4 and starts loading that (load, decode, execute)
code = @machine.b( -4 ) #this jumps to the next instruction
assert_code code , :b , [0xff,0xff,0xff,0xea] #ea ff ff fe
code = @machine.b( 0 ) #this jumps to the next next instruction
assert_code code , :b , [0x0,0x0,0x0,0xea] #ea 00 00 00
end
def test_call #see comment above. bx not implemented (as it means into thumb, and no thumb here)
code = @machine.call( -4 ,{} )#this jumps to the next instruction

View File

@ -35,23 +35,14 @@ module Risc
@machine.position_all
@machine.create_binary
end
def test_has_binary
assert_equal Parfait::BinaryCode , @machine.binary_init.class
end
def test_has_jump
assert_equal "ea000fb4" , @machine.binary_init.get_word(1).to_s(16)
end
def test_pos_bin
assert_equal "0x0" , Position.get(@machine.binary_init).to_s
end
def test_pos_cpu
assert_equal 12 , Position.get(@machine.cpu_init).at
assert_equal 0 , Position.get(@machine.cpu_init).at
end
def test_cpu_at
assert_equal "0x3ee4" , Position.get(@machine.cpu_init.first).to_s
assert_equal "0x4d50" , Position.get(@machine.cpu_init.first).to_s
end
def test_cpu_bin
assert_equal "0x3ed8" , Position.get(Position.get(@machine.cpu_init.first).binary).to_s
assert_equal "0x4d44" , Position.get(Position.get(@machine.cpu_init.first).binary).to_s
end
def test_cpu_label
assert_equal Position::InstructionPosition , Position.get(@machine.cpu_init.first).class