rubyx/lib/risc/platform.rb

39 lines
989 B
Ruby
Raw Normal View History

module Risc
# A platform is (or will be) something like the linux tripple
#
# Currently it just provides a Translator and binary start point
#
class Platform
# return the translator instance that traslates risc intructions into
# platform specific ones
def translator
end
# return an integer where the binary is loaded
def loaded_at
end
2020-02-26 18:01:01 +01:00
# return the number of registers the platform supports
def num_registers
end
2020-03-13 19:18:34 +01:00
# Factory method to create a Platform object according to the platform
# string given.
# Currently only "Arm" and "Interpreter"
def self.for( name )
2018-07-02 08:36:29 +02:00
return name if name.is_a?(Platform)
name = name.to_s.capitalize
case name
when "Arm"
return Arm::ArmPlatform.new
when "Interpreter"
return Risc::InterpreterPlatform.new
else
raise "not recognized platform #{name.class}:#{name}"
end
end
end
end
require_relative "interpreter_platform"