renaming update_status_flag to just update_status

This commit is contained in:
Torsten Ruger 2014-05-16 19:56:13 +03:00
parent b3f7b66ceb
commit 7e2210f772
10 changed files with 20 additions and 14 deletions

View File

@ -22,7 +22,7 @@ module Arm
def initialize(first, attributes)
super(first , attributes)
@attributes[:update_status_flag] = 0
@attributes[:update_status] = 0
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil
end

View File

@ -10,7 +10,7 @@ module Arm
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil
@operand = 0
@i = 0
@attributes[:update_status_flag] = 1
@attributes[:update_status] = 1
@rn = first
@rd = :r0
end

View File

@ -9,7 +9,7 @@ module Arm
# Only when an instruction affects the status is a subsequent compare instruction effective
# But to make the conditional execution (see cond) work for more than one instruction, one needs to
# be able to execute without changing the status
#attr_reader :update_status_flag
#attr_reader :update_status
module LogicHelper
# ADDRESSING MODE 1
@ -83,7 +83,7 @@ module Arm
raise inspect unless reg_code(@rd)
val |= shift(reg_code(@rd) , 12)
val |= shift(reg_code(@rn) , 12+4)
val |= shift(@attributes[:update_status_flag] , 12+4+4)#20
val |= shift(@attributes[:update_status] , 12+4+4)#20
val |= shift(op_bit_code , 12+4+4 +1)
val |= shift(@i , 12+4+4 +1+4)
val |= shift(instuction_class , 12+4+4 +1+4+1)

View File

@ -7,7 +7,7 @@ module Arm
def initialize(first , attributes)
super(first , attributes)
@attributes[:update_status_flag] = 0 if @attributes[:update_status_flag] == nil
@attributes[:update_status] = 0 if @attributes[:update_status] == nil
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil
@operand = 0
@ -61,7 +61,7 @@ module Arm
val = shift(@operand , 0)
val |= shift(reg_code(@first) , 12)
val |= shift(reg_code(@left) , 12+4)
val |= shift(@attributes[:update_status_flag] , 12+4+4)#20
val |= shift(@attributes[:update_status] , 12+4+4)#20
val |= shift(op_bit_code , 12+4+4 +1)
val |= shift(@immediate , 12+4+4 +1+4)
val |= shift(instuction_class , 12+4+4 +1+4+1)

View File

@ -8,7 +8,7 @@ module Arm
def initialize(first , attributes)
super(first , attributes)
@attributes[:update_status_flag] = 0 if @attributes[:update_status_flag] == nil
@attributes[:update_status] = 0 if @attributes[:update_status] == nil
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil
@operand = 0

View File

@ -7,7 +7,7 @@ module Arm
def initialize(first , attributes)
super(first , attributes)
@attributes[:update_status_flag] = 0 if @attributes[:update_status_flag] == nil
@attributes[:update_status] = 0 if @attributes[:update_status] == nil
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil
@attributes[:opcode] = attributes[:opcode]
@operand = 0
@ -59,7 +59,7 @@ module Arm
val = shift(@operand , 0)
val |= shift(reg_code(@first) , 12)
val |= shift(reg_code(@rn) , 12+4)
val |= shift(@attributes[:update_status_flag] , 12+4+4)#20
val |= shift(@attributes[:update_status] , 12+4+4)#20
val |= shift(op_bit_code , 12+4+4 +1)
val |= shift(@immediate , 12+4+4 +1+4)
val |= shift(instuction_class , 12+4+4 +1+4+1)

View File

@ -13,12 +13,12 @@ module Arm
def initialize(first , attributes)
super(first , attributes)
@attributes[:update_status_flag] = 0 if @attributes[:update_status_flag] == nil
@attributes[:update_status] = 0 if @attributes[:update_status] == nil
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil
@attributes[:opcode] = attributes[:opcode]
@operand = 0
@attributes[:update_status_flag]= 0
@attributes[:update_status]= 0
@rn = :r0 # register zero = zero bit pattern
# downward growing, decrement before memory access
# official ARM style stack as used by gas
@ -44,7 +44,7 @@ module Arm
val |= (reg_code(@rn) << 16)
val |= (is_pop << 16+4) #20
val |= (write_base << 16+4+ 1)
val |= (@attributes[:update_status_flag] << 16+4+ 1+1)
val |= (@attributes[:update_status] << 16+4+ 1+1)
val |= (up_down << 16+4+ 1+1+1)
val |= (pre_post_index << 16+4+ 1+1+1+1)#24
val |= (instuction_class << 16+4+ 1+1+1+1 +2)

View File

@ -50,7 +50,9 @@ module Vm
address += @body.length
@exit.link_at(address,context)
end
def position
@entry.position
end
def length
@entry.length + @exit.length + @body.length
end

View File

@ -27,6 +27,10 @@ class TestLogic < MiniTest::Test
code = @machine.sub :r2, left: :r0, right: 1
assert_code code, :sub , [0x01,0x20,0x40,0xe2] #e2 40 20 01
end
def test_subs
code = @machine.sub :r2, left: :r2, right: 1 , update_status: 1
assert_code code, :sub , [0x01,0x20,0x52,0xe2] #e2 52 20 01
end
def test_orr
code = @machine.orr :r2 , left: :r2 , right: :r3
assert_code code , :orr , [0x03,0x20,0x82,0xe1] #e1 82 20 03

View File

@ -18,7 +18,7 @@ class TestSmallProg < MiniTest::Test
start = Vm::Block.new("start")
add_code start
start.instance_eval do
sub :r0, left: :r0, right: 1 , :update_status_flag => 1 #2
sub :r0, left: :r0, right: 1 , :update_status => 1 #2
bne start ,{} #3
end
end