adding register_names to instruction protocol

This commit is contained in:
2020-03-18 17:49:23 +02:00
parent 8df1b8126f
commit d0b734c57c
13 changed files with 69 additions and 0 deletions

View File

@ -29,6 +29,13 @@ module Risc
end
attr_accessor :array , :index , :register
# return an array of names of registers that is used by the instruction
def register_names
names = [array.symbol , register.symbol]
names << index.symbol if index.is_a?(RegisterValue)
names
end
def to_s
class_source "#{array}[#{index}] -> #{register}"
end