Fix interpreter and resolve method

Interpreter was not handling ssa correctly (ie overwriting)
Resolve was assuming wrong registers (also non ssa)
return value still broken
This commit is contained in:
2020-03-14 14:05:23 +02:00
parent 4db71c1c03
commit 5b0c1195e4
5 changed files with 53 additions and 49 deletions

View File

@ -15,7 +15,7 @@ module Risc
# fire events for changed pc and register contents
include Util::Eventable
include Util::Logging
log_level :debug
log_level :info
attr_reader :instruction , :clock , :pc # current instruction and pc
attr_reader :registers # the registers, 16 (a hash, sym -> contents)
@ -190,6 +190,7 @@ module Risc
index = get_register(@instruction.index)
end
object.set_internal_word( index , value )
log.debug "RegToSlot #{object}[#{index}] == #{value}"
trigger(:object_changed, @instruction.array , index)
true
end
@ -289,9 +290,7 @@ module Risc
result = result.to_i
end
log.debug "#{@instruction} == #{result}(#{result.class}) (#{left}|#{right})"
# overwrites
left
right = set_register(@instruction.left , result)
set_register(@instruction.result , result)
true
end